Skip to content

Instantly share code, notes, and snippets.

SELECT
people."id" AS "people#id", people."created_at" AT TIME ZONE 'UTC' AS "people#created_at", people."updated_at" AT TIME ZONE 'UTC' AS "people#updated_at", people."family_name" AS "people#family_name", people."given_name" AS "people#given_name", people."title" AS "people#title", people."description" AS "people#description", people."child_person_id" AS "people#child_person_id", people."admin_event_id" AS "people#admin_event_id", people."owner_event_id" AS "people#owner_event_id",
events."id" AS "events#id", events."created_at" AT TIME ZONE 'UTC' AS "events#created_at", events."updated_at" AT TIME ZONE 'UTC' AS "events#updated_at", events."title" AS "events#title", events."description" AS "events#description",
photos."id" AS "photos#id", photos."created_at" AT TIME ZONE 'UTC' AS "photos#created_at", photos."updated_at" AT TIME ZONE 'UTC' AS "photos#updated_at", photos."title" AS "photos#title", photos."description" AS "photos#description", photos."location" AS "photos#location", photos."taken_at" AT TIME Z
Using worker: worker-linux-4-1.bb.travis-ci.org:travis-linux-16
travis_fold:start:git.1
$ git clone --depth=50 --branch=master git://github.com/geddy/model.git geddy/model
Cloning into 'geddy/model'...
remote: Counting objects: 1024, done.
remote: Compressing objects: 0% (1/560) 
remote: Compressing objects: 1% (6/560) 
remote: Compressing objects: 2% (12/560) 
remote: Compressing objects: 3% (17/560) 
@implementation MainViewController {
NSURLSession *_session;
}
- (void) doSomethingElse
{
[self doSomethingWithCompletionHandler: ^(){
// create session.. add download tasks..
// _session = blah blah
// _session.createDownloadTask etc
@ben-ng
ben-ng / fixPrefixes.m
Created November 14, 2014 20:10
Use UIWebView's `loadHTMLString:baseURL:` and set the baseURL to where your assets are in the app bundle. Then replace all absolute paths in your html/js/css with relative ones using something like the script below. The relative URLs will be loaded relative to the baseURL, whereas absolute ones are loaded relative to the root of the filesystem, …
// This doodad converts absolute paths like "/assets/thing.jpg" into relative ones like "assets/thing.jpg"
NSString * (^fixPrefix)(NSString *, NSString *) = ^NSString *(NSString * input, NSString *prefix) {
NSString *needle = [[@"/" stringByAppendingString:prefix] stringByAppendingString:@"/"];
NSString *replacement = [prefix stringByAppendingString:@"/"];
input = [input stringByReplacingOccurrencesOfString:[@"'" stringByAppendingString:needle] withString:[@"'" stringByAppendingString:replacement]];
input = [input stringByReplacingOccurrencesOfString:[@"\"" stringByAppendingString:needle] withString:[@"\"" stringByAppendingString:replacement]];
input = [input stringByReplacingOccurrencesOfString:[@"(" stringByAppendingString:needle] withString:[@"(" stringByAppendingString:replacement]];
return input;
@ben-ng
ben-ng / Readme.md
Created November 15, 2014 01:56
How should I do this?

If you're interested in my OTA update system for iOS PhoneGap apps, let me know how you think I should release it, and why:

(Sorted in order from "it just works" to "most flexible, but requires deeper knowledge of iOS apps")

  • A CLI tool that patches an app (you would run this on platforms/ios)
  • A complete PhoneGap iOS application (you would clone this repo and edit it to your tastes)
  • The update logic only, as a library (I'd provide example replacements for MainViewController.m, AppDelegate.m)
  • Other (I'm not a huge fan of any of these, so I'm open to suggestions)
@ben-ng
ben-ng / gist:297cc283f04638005048
Last active August 29, 2015 14:19
setTimeout without setTimeout
/**
* Just call __PBSJC_drain at the end of your code
*/
var __PBSJC_funcHandles = []
, __PBSJC_funcHandleCount = 0
, __PBSJC_drain = function __PBSJC_drain () {
var extracted, i, ii, cur
while (__PBSJC_funcHandles.length) {
extracted = __PBSJC_funcHandles
@ben-ng
ben-ng / server.js
Created June 4, 2015 15:18
A simple, slow server for testing deis' zero downtime deploys
setTimeout(function () {
require('http').createServer(function (req, res) {
res.end('yo!')
}).listen(process.env.PORT)
}, 45000)
@ben-ng
ben-ng / keybase.md
Created March 21, 2016 16:28
Keybase

Keybase proof

I hereby claim:

  • I am ben-ng on github.
  • I am benng (https://keybase.io/benng) on keybase.
  • I have a public key ASDpep_MuCxliK8Ty1NbkbFqxaqIh4dbgrd1NNpMoUV3tQo

To claim this, I am signing this object:

@ben-ng
ben-ng / 1-README.md
Last active March 31, 2016 19:26
Test Spec

Tasks

Before you start

Depending on your assigned system, read the README-ORACLE.md or README-POSTGRES.md file.

You might need to configure user accounts and permissions to accomplish these tasks.

Tasks