This is a very short tutorial on how to turn a Javascript, Node-style callback function into an Angular promise. For me, this came up when I was trying to integrate Stripe.js and Stripe Checkout into an Angular app. Soon, I’ll be writing a longer tutorial on all of ...
Articles in the Programming category
My first CoffeeScript: An angular filter
I finally started writing my first CoffeeScript today. I’m working on a very complicated AngularJS app, so this is probably the worst time to be trying something new, but since Angular directives, filters, etc. are all of a very similar boilerplate format, this actually seemed like a good time ...
A decorator decorator for Django views
Hitting a new level of meta, I just wrote a decorator decorator for Django views.
The context here is that I needed to write some custom view decorators that gave me access to the
request
object, since the normal built-in decorators likeuser_passes_test
only offer access to therequest.user ...
How to destroy your Python program
I discovered today that Python’s
True
andFalse
are actually constants—which means that their values can be changed. While this has been disallowed in Python 3, it still allows you to wreak some havoc in your—or someone else’s—Python 2 programs.Definitely don’t do this ...
Tagged in: pythonTricking Markdown to let me use ![]() syntax within HTML tags
By using HTML comments to insert fake ending tags, you can trick Markdown into allowing you to stick Markdown syntax inside HTML tags.
Text-to-Columns in Google Docs Spreadsheets (with Python)
Despite being an Excel power user, I’m currently without Excel on my computer for the time being so for some data analysis I had to do I had to make do with Google Docs’ spreadsheets. While decent, and impressive for a web application, unfortunately it’s not great for ...
Ruby-like string interpolation in Python
I’ve been experimenting with Rails a bit for the past couple weeks. This has been pretty exciting for me, as I’ve generally been much more of a Python developer and I’d never touched Ruby before, so it was very interesting to see a completely different approach to ...
Include the weather in your bash prompt!
About a third of the way into Hacker School, I got myself entrenched in a rather unusual project—trying to figure out how to get an automatically updated weather icon into my Bash prompt, doing it purely in Bash for practical (and aesthetic) reasons.
I called it BashWeather.
I gave a Hacker School Seminar
Today at Hacker School, I gave a seminar entitled “Freelance and Travel for Fun and Profit,” talking about the year I spent traveling the world while supporting myself as a freelance programmer. I’ve long been meaning to write this up as both a series of blog posts and a ...
!-->Killing a Python WAT: Forcing immutable default arguments
Fellow Hacker Schooler Amy had a great post today on mutable default arguments in Python, a very typical Python “WAT”.
(If you haven’t seen the CodeMash 2012 WAT video, you should.)
In this case, Amy wrote about how unintuitively in Python, when creating a function with default arguments, those ...
Re-implementing Clojure’s comp
While working through Clojure for the Brave and True, I came across an explanation of Clojure’s
comp
function and some basic implementations of versions ofcomp
that take only two arguments or three arguments. The tutorial challenged me to try to completely re-implementcomp
to accept an arbitrary number ...Automatically restarting your process or server on crash
Matasano Crypto Challenges
As I’ve always been interested in cryptography and cybersecurity, I started working on it a bit while at Hacker School, mainly by working on the challenges in the Microcorruption capture the flag game.
Today, thanks to Filippo (also the guy behind the extremely popular and valuable Heartbleed vulnerability tester ...
Introduction to HTML5 canvas
In my quest to learn a bit more about front-end and responsive design, I’ve decided to do a mini-project building a Pacman map-editor in the browser. Hopefully, I’ll also be able to make it playable. This was inspired by a conversation with Mary about ...
!-->!-->Ultrasonic distance detectors in Arduino
Matt at Hacker School has plans to go back home and hook up a Raspberry Pi or an Arduino to a motion sensor in order to detect when his cat jumps onto the table (which apparently happens too much)—and maybe scare him as well, making it make a loud ...
!-->Getting syntax highlighting on Scriptogr.am (and other hosted static site generators)
The benefits of hosted static site generators include crazy ease of use, auto-deployment, hosting, etc.—but on the downside, you’re sometimes a bit more limited in the control you have over the site.
When starting out with trying Scriptogr.am, I was a bit disappointed by the lack of ...
Static site generators and choices
TL;DR
I’m undecided on exactly where to settle on hosting my site. The main things I’m looking for are:
- Code syntax highlighting
- Nicely formatted list of categories and full archive on the sidebar
- Editing from anywhere
- Ease of publishing/deployment
Intro
As of this writing, my Hacker ...
Tagged in: hackerschool, pelican, jekyll, scriptogr.am, dropbox, zapier, markdown, static-site-generatorsSome things I learned about Android
Activity layouts: XML vs Java
For a long while, I couldn’t really understand the difference between the XML files and the Java files. It seemed at first like the XML files determine what objects are available on the display for a particular activity, and then the actions and interactivity ...
How to use getopts inside a Bash function
As part of my quest to finish packaging up my Bash function that gets the updated weather in your Bash prompt, I needed to better organize my code, and so started putting some code into functions. Bash, however, is a fickle language, and the difficulty that quickly arose was using ...
Asynchronous programming with Arduino
I’ve been working quite a bit this week and last week with Arduinos and Spark Cores (an Arduino-like device with WiFi and a cloud service built-in). I’ve been working on a few projects, including many out of the Arduino starter book, hooking up a remote control car to ...
Pages
Categories
Tags
- algorithms
- android
- angular-filters
- angularjs
- arduino
- async
- bash
- bashweather
- C
- callbacks
- canvas
- capture-the-flag
- clojure
- coffeescript
- comp
- compression
- crash
- crypto
- decorator
- decorators
- default-args
- dial-up-over-cell-phone
- distance
- django
- doorbot
- doorduino
- down-the-rabbit-hole
- dropbox
- error-correction
- framing
- freelance
- getopts
- getting-started
- google-docs
- hackerschool
- highlightjs
- html
- html5
- images
- internet
- it-works
- jabber
- java
- javascript
- jekyll
- keyboards
- markdown
- matasano
- mel-chua
- messages-app
- meta
- mutability
- os-x
- pacman
- pelican
- productively-lost
- promises
- python
- quick-union
- restart
- ruby
- scriptogr.am
- seminar
- server
- signal-processing
- sort
- spreadsheets
- static-site-generators
- string-interpolation
- syntax-highlighting
- tcp
- text-to-columns
- travel
- ultrasonic
- wat
- weather
- zapier