Instantly share code, notes, and snippets.

View gist:3881421
// Get the connection uri and set it up for processing
var uri = process.env.MONGOLAB_URI;
var uri = uri.slice(uri.indexOf('/')+1);
var user = uri.substring(1, uri.indexOf(':'));
var pass = uri.substring(uri.indexOf(':')+1, uri.indexOf("@"));
var dbName = uri.substring(uri.lastIndexOf("/")+1);
var port = uri.substring(uri.lastIndexOf(":") + 1, uri.lastIndexOf("/"));
var host = uri.substring(uri.lastIndexOf("@") + 1, uri.lastIndexOf(":"));
View gist:4067528
/*
* Gets the starting index of the selected text
*/
function _getSelectionHtml() {
/*
* Returns HTML String of current selection
*/
var html = "";
View gist:5573378
for (NSString *familyName in [UIFont familyNames]) {
for (NSString *fontName in [UIFont fontNamesForFamilyName:familyName]) {
NSLog(@"%@ - %@", familyName, fontName);
}
}
View gist:5573402
NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@"camera"];
[string setAttributes:@{(NSString *)kCTLigatureAttributeName:[NSNumber numberWithInt:2]} range:NSMakeRange(0, string.length)];
self.myUILabel.attributedText = string;
View emoji-support.js
/**
* Determine if this browser supports emoji.
*
* Modified from https://gist.github.com/mwunsch/4710561
* and probobly originally github's javascript source
*/
function doesSupportEmoji() {
var context, smiley;
if (!document.createElement('canvas').getContext) return;
context = document.createElement('canvas').getContext('2d');
View index.js
var Sequelize = require('sequelize');
module.exports = function(config) {
var models = {};
sequelize = new Sequelize(config.database, config.username, config.password, config.options);
// Bootstrap models
fs.readdirSync(__dirname).forEach(function (file) {
View .gitignore
lib-cov
*.seed
*.log
*.csv
*.dat
*.out
*.pid
*.gz
*.tmp
*.db
View Preferences.sublime-settings
{
"remember_open_files": false,
"hot_exit": false
}
View README.md

Mouseover to see flights originating at the specified airport. The cool thing about this technique is that the interaction requires zero JavaScript — it’s all done in CSS using the :hover state to toggle visibility of an airport’s associated outgoing flight routes.

View colors.pde
void setup() {
size(640, 360);
colorMode(HSB, 360, 1, 1);
background(0);
}
void draw() {