-
Making Backbone.js a little nicer
I've been working on a little framework for extending Backbone.js. This is largely to reduce the amount of boilerplate I have to write. I'll keep updating, but feel free to look at it and poke around. https://github.com/mcotton/Rocket
-
Deploying with Git
I want to deploy new code to using a simple command like git push stage master or git push prod master On the server, make a new git repository git init Edit the config file inside of .git/ [core] repositoryformatversion = 0 filemode = true bare = false logallrefupdates = true [receive] denyCurrentBranch = ignore Make a post-receive hook with these commands #!/bin/sh cd .. GIT_DIR='.git' umask 002 && git reset --hard Make that hook exacutable chmod +x post-receive On your
-
Consuming vs Producing
Everyone is up in arms about the ending of Google Reader. I use it daily and more importantly my iPhone/iPad use it as the syncing protocol for RSS apps. What I don't understand is why everyone isn't seeing this as an opportunity? Google created a product and now everyone has their shot to show what they can do. Think that Google is amazing? Try to make your own version and see how you compare. Think Google is past their prime? Try to make your own version and see how you compare. Don't care
-
Presentation idea for local meetup
I sent out this email about a presentation I would be willing to give. Are you interested in a node talk about camera uploads directly from iPhone to Node and then to S3? Starting from nothing, then use Why use Node? Why make it async? node-formidable to handle uploads knox to upload to S3 router to make sensible URLs, structure for REST nano to integrate with CouchDB Depending on the experience of the audience, I can include: socket.io integration for upload progress indicator making a REST-ful
-
JavaScript: quick debugging tip
I have been doing a lot of in-browser testing. Because of this I want an insight to what the browser is doing. console.log('DEBUG: ' + data) But this gets unmanageable very quickly. The next evolution is to place a flag for what should be logged. It also helps to prefix all the logs with a category (DEBUG, INFO, ERROR, etc) debug = true if (debug) console.log('DEBUG: ' + data) This is a little better but still isn't that much better. The next jump is to make debug into an object and get mor
-
JavaScript Journal - Updating an image without flickering
This is how I'm approaching the problem of trying to simulate live video from a series of preview images. After initial page setup, we start the polling service After each polling response we look for new preview images ('pre') For each preview response, we ask each camera to update its image As an optimization we only update the cameras that are currently on screen When the new image has loaded, we swap it with the one being displayed (this eliminates flickering) If the image has taken longer t
-
JavaScript Journal - looping
Depending on when you started learning JavaScript (and when you stopped keeping up) you might find a lot of this inside your code for(var i=0;i<arr.length;i++) { html = "<li>" + arr[i] + "</li>" } or if you started with jQuery you will have copy and pasted something like this from stackoverflow $.getJSON(url, function(data) { $.each(data, function(item) { $('#thing').append('<li>' + item + '</li>') } } or you could be doing something like this and use a client-side templete,
-
JavaScript Journal - Making a Single Page App
Right now I am in the process of creating a large, complex single page app. Some of the challenges I am running through right now are rendering, user management and API proxying. client-side vs server-side rendering Traditionally the page would be rendered on the server. When a page changes the server renders it again and can always return the latest data. You can then progressively enhance some of the data client-side to make it nicer. Everything is just a refresh away. There is very litt
-
JavaScript Choices
On my current project, I would really like to move away from YUI and towards Backbone.js. I am a believer in using a hybrid approach of the best components instead of using a single monolithic library. YUI is a large, heavy framework that enforces their way of development. While their way isn't wrong, it does makes us beholden to Yahoo and their choices. YUI has incorporated much of Backbone.js into their later releases but it is significantly behind where Backbone.js is. It is also forced
-
What I learned interviewing
October has been a very strange month and thankfully I came out of it better than I expected. I had the chance to meet some great people. The Good Swift software had a great idea for the technical phone interview, the team reviewed a project of mine on github and then had me answer questions about it for an hour. They prepared a follow-up assignment adding features to that project. OKCupid Labs and CrowdFlower both had me pair-program with a team member and work a real bug on their actual code
-
Single Page App
Want to test your server code but you inherited a code base without tests? Can't justify spending weeks writing test? Want to prove that your API is working? Need to debug the iPhone client but don't want to open XCode. HTML5 to the rescue! Need the app to be location based? Use geoLocation . Need to store data localy? Use localStorage . Not a designer, having trouble laying out your css? Use twitter bootstrap . Want to use a design pattern like the cool kids? How about pub/sub with ampli
-
Making Python and Django more social with awe.sm
Our users like to share the deal they just received with their friends on Facebook. We would like to know how well those links do and what kind of traffic they receive. awe.sm is a company that does exactly that. This blog post is about showing how easy it is to integrate into python and Django. def facebook_share_checkin(checkin, points): try: # I removed the code for getting the user token graph = facebook.GraphAPI(token) # The facebook API specifies what they wa
-
Local datastore for Google App Engine
You can make life extra nice by specifying a datastore. Save it or add it .gitignore, it's all cool with me. --datastore_path=/tmp/myapp_datastore
-
Making a 3rd-party JavaScript widget
At QliqUp, we had the idea of making a widget that merchants could place into their existing webpage that would let them show the current deals they offer. This was mostly straight forward but I wanted to explain some of the sharp edges that slowed us down. You can see the final product at: http://qliqup.com/widgets/ First we had to make a public endpoint inside of our API. I left out some the docstrings because it only cluttered this example. class PublicDealsHandler(BaseHandler): def re
-
My new TestRunner
I am trying to get some test for our code base that doesn't have any. None at all. There isn't even a documented test plan. Because the API server is the core of our porduct, and because testing RESTful things is easier, we'll start by making a JavaScript tester. And because a webpage is friendlier that a command-line, it'll report in the browser. https://github.com/mcotton/TestRunner And because a working webapp is even better documentation than a simple test suite. https://github.com/mcotto
-
Making profile pages more sane
We encourage our merchants to include a facebook page with their profiles so that users can share that page when they check-in, check-out, unlock a deal, or redeem a deal. But some people didn't understand what that means and we had all sorts of crazy input. Instead of explaining the steps they'll need to get us the correct URL, we'll just take whatever they mashed out on their keyboard and fix it. Django has some weird points, but it mostly has awesome ones. I needed to clean up our database
-
Making user logins more forgiving
We are currently working on making our login system more forgiving. We started by creating usernames, and then people forgot their usernames so we now we are wanting to use e-mail addresses as usernames. This is great except for the users who remember their username. We decided to try logging in assuming they gave us a username, if that fails, try it again matching against their email. While we are at it we also smush everything down to lowercase so that we can eliminate some typos. We are d
-
How to reset Django admin password
Sometimes you just can't remember what you set it to, or like me, you restore from an SQL file that you never knew the password for. Anyway, python to the rescue. > python manage.py shell from django.contrib.auth.models import User u = User.objects.all() u=User.objects.get(username__exact=’admin’) u.set_password(‘whatever’); u.save() thanks to http://coderseye.com/2007/howto-reset-the-admin-password-in-django.html and the first comment
-
New Job at a Startup
I have a new job as a backend developer at http://Qliqup.com It is a young venture backed tech start-up and I am very excited. Look forward to future posts about what I am doing there.
-
Keeping a secure password list
Keeping a secure password list should be an easy task but it isn't. This is the solution I am trying out. Download keepass and install on your laptop. Create a master password. Create entries, for existing passwords you'll need to edit the generated password Save it to a file and place in your Dropbox folder Install and login into Dropbox on your iPhone Install MiniKeePass on your iPhone Open the encrypted keepass database on your phone from Dropbox. It won't be able to display anything, but th