Skip to content

Instantly share code, notes, and snippets.

@johnnyclem
johnnyclem / gist:8215415
Created January 2, 2014 05:31
End the tyranny of UITextFields not resigning first responder when you expect them to, simply add this method to any UIViewController and keyboards will disappear whenever the user touches anywhere other than the keyboard itself or another UITextField
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
for (UIControl *control in self.view.subviews) {
if ([control isKindOfClass:[UITextField class]]) {
[control endEditing:YES];
}
}
}
@johnnyclem
johnnyclem / gist:4054112
Created November 11, 2012 07:50
Store an image in redis
var fs = require('fs'),
querystring = require('querystring'),
redis = require('redis'),
r = redis.createClient(),
allowedTypes = {
'text/javascript': 'js',
'text/css': 'css',
'image/png': 'png',
'image/jpeg': 'jpg',
@johnnyclem
johnnyclem / command line shell
Created November 6, 2012 21:18 — forked from blakmatrix/command line shell
Getting Meteor todos up on nodejitsu/jitsu
meteor create --example todos
meteor bundle myapp.tgz
tar xzf myapp.tgz
cd bundle
(create package json with settings below)
jitsu databases create mongo <dbname>
(grab dbstring)
jitsu env set PORT 3000
jitsu env set MONGO_URL <dbstring>
jitsu deploy