Skip to content

Instantly share code, notes, and snippets.

View jstn's full-sized avatar

Justin Ouellette jstn

View GitHub Profile
@nicerobot
nicerobot / README.md
Last active December 24, 2025 22:30
GNUStep

Objective-C on Linux

Just run:

curl -ks https://gist.github.com/nicerobot/5652802/raw/install.sh | bash -
@marcuswestin
marcuswestin / aws-ssl-termination-digicert.md
Last active August 28, 2018 15:18
How to set up an AWS SSL terminating Elastic Load Balancer with a Digicert certificate

1: Generate CSR

openssl req -new -newkey rsa:2048 -nodes -keyout server-cert.key -out server-cert-sign-req.csr

# Country Name (2 letter code) [AU]:US
# State or Province Name (full name) [Some-State]:California
# Locality Name (eg, city) []:
# Organization Name (eg, company) [Internet Widgits Pty Ltd]:Flutterby Labs, Inc.
# Organizational Unit Name (eg, section) []:
# Common Name (eg, YOUR name) []:www.dogo.co
@srpouyet
srpouyet / create_related_users.rb
Last active November 2, 2019 03:05
Self referential HABTM (has_and_belongs_to_many) in Rails 3
@irace
irace / gist:3828834
Created October 3, 2012 18:29
Basic Node.js screen-scraping
var express = require('express')
, app = express()
, jsdom = require('jsdom');
app.set('views', __dirname);
app.get('/', function(request, response) {
jsdom.env({
html: 'http://bryanirace.com',
scripts: ['http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.0/jquery.min.js'],
@irace
irace / BIWebViewDelegate.m
Created September 10, 2012 02:51
JavaScript/native bridge for iOS's UIWebView
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request
navigationType:(UIWebViewNavigationType)navigationType {
NSString *urlString = [[request URL] absoluteString];
if ([urlString hasPrefix:@"js:"]) {
NSString *jsonString = [[[urlString componentsSeparatedByString:@"js:"] lastObject]
stringByReplacingPercentEscapes];
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
NSError *error;
@brandon-rhodes
brandon-rhodes / gist:3438936
Created August 23, 2012 17:19
Geographically correct alternative to Radarmatic.com's sweepArc() function
/* NOTE: this function requires the Google Maps "geometry" library which
Radarmatic does not currently load. It would need to load Maps with:
http://maps.google.com/maps/api/js?libraries=geometry&sensor=false */
function sweepArc(context, center_x, center_y, radius, width,
start_angle, end_angle) {
/* Special case: if we are being asked to draw the big gray circle
around the current radar site, then draw a big gray circle. */
@irace
irace / gist:3366283
Last active October 8, 2015 17:38
Git cheat sheet
# Checkout remote branch
git checkout -t origin/<branch>
# Delete branch (local, remote)
git branch -d <branch>
git push origin --delete <branch>
# Tagging
git fetch --tags [email protected]:jstn/JXHTTP.git
git tag -f 1.0.0 # Move a tag to the latest commit
@irace
irace / gist:3363569
Created August 15, 2012 20:54
Generate iOS Localizable.strings format from PO file
#!/usr/bin/python
import sys
if __name__ == '__main__':
filename = sys.argv[1];
input = open(filename)
output = open(filename + '.out', 'w')
for line in input:
@irace
irace / gist:3349415
Created August 14, 2012 13:51
Micro-templating for iOS
// https://github.com/jasonmoo/t.js, http://news.ycombinator.com/item?id=4378578
static inline NSString *F(NSString *string, id object) {
NSMutableString *result = [[string mutableCopy] autorelease];
void (^replace)(NSMutableString *, NSString *, id) =
^ (NSMutableString *string, NSString *key, id value) {
NSString *stringValue = [value isKindOfClass:[NSNumber class]]
? [NSString stringWithFormat:@"%@", (NSNumber *)value] : value;
@agaviria
agaviria / Ledger_3_commands.dat
Created August 10, 2012 20:03
Collection of ledger-cli commands
# comments example for .dat or .ledger files
@smallexample
; This is a single line comment,
# and this,
% and this,
| and this,
* and this.
# If you have a deeply nested tree of accounts,
# it may be convenient to define an alias, for example: