Skip to content

Instantly share code, notes, and snippets.

Matthew Conlen mathisonian

Block or report user

Report or block mathisonian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mathisonian
mathisonian / gist:3881421
Created Oct 12, 2012
node.js and mongolab on heroku
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(":"));
@mathisonian
mathisonian / gist:4067528
Created Nov 13, 2012
Getting the starting index of selected text
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);
}
}
@mathisonian
mathisonian / gist:5573402
Created May 14, 2013
ligatures and symbol fonts on ios
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;
@mathisonian
mathisonian / emoji-support.js
Created Dec 10, 2013
Detect emoji support
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');
@mathisonian
mathisonian / index.js
Last active Oct 3, 2019
postgres full text search in sequelize.js. see this blog post for more information http://www.mathisonian.com/weblog/postgres-full-text-search-with-sequelizejs
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
@mathisonian
mathisonian / Preferences.sublime-settings
Created Apr 15, 2014
sublime text options for command line usage
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.

@mathisonian
mathisonian / colors.pde
Created May 9, 2014
cosmic latte gradients
View colors.pde
void setup() {
size(640, 360);
colorMode(HSB, 360, 1, 1);
background(0);
}
void draw() {
You can’t perform that action at this time.