Skip to content

Instantly share code, notes, and snippets.

View popthestack's full-sized avatar
🍩
Eating Donuts

Ryan Martinsen popthestack

🍩
Eating Donuts
View GitHub Profile
@popthestack
popthestack / promises-and-this.js
Created March 30, 2016 14:02
Passing methods that use `this` into promises or promisifying them with bluebird can lead to confusing results. This isn't specific to promises, but rather how the prototype works.
var Promise = require('bluebird');
function Blah() {
this.foo = 'blah';
}
Blah.prototype.tester = function() {
console.log(this.foo);
};
@popthestack
popthestack / fiveminutejournal.md
Last active December 26, 2021 18:26
Five minute journal template for use with the Day One app. I use it with a TextExpander shortcut ";fiveminutejournal". Inspired by http://mattmazur.com/2015/12/16/the-joy-of-the-five-minute-journal/

Five Minute Journal Entry

3 things I am grateful for…

3 things that would make today great…

require 'rubygems'
require 'yaml'
require 'net/http'
require 'uri'
#
# Check that the HTTP Response is as expected.
# See -help for format of the input file
#
class CheckHttpResponse

Keybase proof

I hereby claim:

  • I am popthestack on github.
  • I am popthestack (https://keybase.io/popthestack) on keybase.
  • I have a public key whose fingerprint is 94AD BD13 B133 D1B1 9F25 238B 114E 783D 48EC 7F47

To claim this, I am signing this object:

Originally found here: http://newyork.craigslist.org/brk/mis/3985247459.html
I saw you on the Manhattan-bound Brooklyn Q train.
I was wearing a blue-striped t-shirt and a pair of maroon pants. You were
wearing a vintage red skirt and a smart white blouse. We both wore glasses. I
guess we still do.
You got on at DeKalb and sat across from me and we made eye contact, briefly. I
fell in love with you a little bit, in that stupid way where you completely make
@popthestack
popthestack / gist:5877965
Last active December 19, 2015 01:39
RFC 3339 date string in Objective C
NSDate *now = [[NSDate alloc] init];
NSTimeZone *localTimeZone = [NSTimeZone systemTimeZone];
NSDateFormatter *rfc3339DateFormatter = [[NSDateFormatter alloc] init];
NSLocale *enUSPOSIXLocale = [[NSLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"];
[rfc3339DateFormatter setLocale:enUSPOSIXLocale];
[rfc3339DateFormatter setDateFormat:@"yyyy'-'MM'-'dd'T'HH':'mm':'ssZ"];
[rfc3339DateFormatter setTimeZone:localTimeZone];
NSString *dateString = [rfc3339DateFormatter stringFromDate:now];
@popthestack
popthestack / am-pm-other-locales.markdown
Last active December 18, 2015 18:28
Anyone have any idea what these prefixes mean? Are they AM or PM?

Unknown

11:21:45 em
10:16:03 e.m.

12:44:04 e.h.

10:29:20 f.m.
08:36:43 fm

lol ~= haha
LOL ~= HAHA ~= hahaha
rofl ~= HAHAHAH ~= hahahahahahaha
ROFL ~= HAHAHAHAHAHHAHAHAHA ~= hahahahahahahahahahahaha
LMFAO ~= HAHAHAe+26 snort
@popthestack
popthestack / wp-to-nanoc.php
Created April 29, 2012 18:48
Hacked together Wordpress -> Nanoc script
<?php
$db = mysql_connect('localhost', 'db_user', 'db_password');
mysql_select_db('blog');
$sql = "SELECT * FROM wp_posts WHERE post_status IN ('publish', 'private') AND post_type = 'post'";
$r = mysql_query($sql);
get_posts($r);
// do drafts separately in order to keep them from messing with published posts' URLs
@popthestack
popthestack / gps1.bash
Created February 1, 2012 00:09 — forked from bobthecow/gps1.bash
A better PS1 for Git
#!/bin/bash
#
# A better PS1 for Git
#
# Author: Justin Hileman (http://justinhileman.com)
#
# Installation:
# Add the following function to your `.bashrc` or `.bash_profile`,
# or save it somewhere (e.g. `~/.gps1.bash`) and source it in `.bashrc`