Skip to content

Instantly share code, notes, and snippets.

@pashields
pashields / MapperConfig+PListReader.m
Created February 6, 2012 02:33
A simple MapperConfig extension to load from a plist
#import "MapperConfig.h"
@interface MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName;
@end
@implementation MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName {
NSString *path = [[NSBundle mainBundle] pathForResource:pListName ofType:@"plist"];
NSDictionary *mappings = [[NSDictionary alloc] initWithContentsOfFile:path];
@pashields
pashields / gist:1837707
Created February 15, 2012 17:51
An example of loading ClassMapper keymappings from a plist file
#import "MapperConfig.h"
@interface MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName;
@end
@implementation MapperConfig (PListReader)
- (void)importFromPList:(NSString*)pListName {
NSString *path = [[NSBundle mainBundle] pathForResource:pListName ofType:@"plist"];
NSDictionary *mappings = [[NSDictionary alloc] initWithContentsOfFile:path];
@pashields
pashields / gist:5460214
Created April 25, 2013 14:40
Engine v1 api doc
AdOS API
========
The AdOS api allows you to bulk request image based ads via a json-based interface.
Request Format
--------------
The basic format of a request is: GET http://engine.adzerk.net/api/v1?request={ url encoded request data }
The request data should be an array of placement objects. A placement object can contain the following fields
* divName [String] an arbitrary unique id for the placement
@pashields
pashields / gist:6021292
Created July 17, 2013 14:52
JAVASCRIPT DATES!
debug> repl
Press Ctrl + C to leave debug repl
> this.start
Wed Dec 31 1969 19:00:00 GMT-0500 (EST)
> this.start.valueOf()
'NaN'
>
private static final String[] = {"a", "b", "c"};
public String toDelimitedString(Model record) {
StringBuilder b = new StringBuilder();
// Add n-1 fields with delim
for (int i=0; i<fields.length-1; i++) { // With guava or commons colls could use iter here
b.append(record.get(fields[i]));
b.append(delim);
}
@pashields
pashields / line-compare.clj
Last active January 3, 2016 02:09
A little json-y diff action in clojure.
(ns line-compare.core
(:require [cheshire.core :refer :all]
[clojure.set :refer :all]
[clojure.java.io :refer :all]))
(defn read-file
[file]
(with-open [rdr (reader file)]
(set (parsed-seq rdr))))
@pashields
pashields / gist:8712295
Created January 30, 2014 16:19
hard coding testing dates
futureAd = Ad.fromJSON JSON.parse adJson
# Haha. Dear future person or alien fixing this test in 2286,
# Sorry. I hoped you all would have given up on javascript
# by now. In that way, I blame this on you. Enjoy your legal weed.
futureAd.flight.startDate = new Date(9999999999999)
module.exports.futureAd = futureAd
@pashields
pashields / gist:f7936684c22f9e7a235a
Created December 9, 2014 15:37
ga4gh server install
(2.7)λ pashields server → λ git setuppy-fixmes → python setup.py sdist
running sdist
running egg_info
creating ga4gh.egg-info
writing requirements to ga4gh.egg-info/requires.txt
writing ga4gh.egg-info/PKG-INFO
writing top-level names to ga4gh.egg-info/top_level.txt
writing dependency_links to ga4gh.egg-info/dependency_links.txt
writing entry points to ga4gh.egg-info/entry_points.txt
writing manifest file 'ga4gh.egg-info/SOURCES.txt'
import java.util.logging.Logger
object Test {
val logger = Logger.getLogger("Test Logger")
def main(args: Array[String]): Unit = {
logger.info(sys.env.get("SPARK_ENV_VAR").toString)
logger.info(sys.env.get("NOT_SPARK_ENV_VAR").toString)
}
}
@pashields
pashields / keybase.md
Created February 15, 2019 19:28
keybase.md

Keybase proof

I hereby claim:

  • I am pashields on github.
  • I am pashields (https://keybase.io/pashields) on keybase.
  • I have a public key ASDJHh9CYZxvc4-qCYrgFXlI4dwAWw89uEqjLnb9WnAZ9go

To claim this, I am signing this object: