Skip to content

Instantly share code, notes, and snippets.

:shipit:
f*ck it, ship it

Sam Gammon sgammon

:shipit:
f*ck it, ship it
Block or report user

Report or block sgammon

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
@sgammon
sgammon / keen-js-v2.3.1.js
Last active Aug 29, 2015
Minimal rewrite of Keen IO's JavaScript library :) version 2.3.1
View keen-js-v2.3.1.js
/***
*
*
* /$$ /$$ /$$$$$ /$$$$$$
* | $$ /$$/ |__ $$ /$$__ $$
* | $$ /$$/ /$$$$$$ /$$$$$$ /$$$$$$$ | $$| $$ \__/
* | $$$$$/ /$$__ $$ /$$__ $$| $$__ $$ | $$| $$$$$$
* | $$ $$ | $$$$$$$$| $$$$$$$$| $$ \ $$ /$$ | $$ \____ $$
* | $$\ $$ | $$_____/| $$_____/| $$ | $$ | $$ | $$ /$$ \ $$
* | $$ \ $$| $$$$$$$| $$$$$$$| $$ | $$ | $$$$$$/| $$$$$$/
View keen-minimal-2.3.2.js
/***
*
*
* /$$ /$$ /$$$$$ /$$$$$$
* | $$ /$$/ |__ $$ /$$__ $$
* | $$ /$$/ /$$$$$$ /$$$$$$ /$$$$$$$ | $$| $$ \__/
* | $$$$$/ /$$__ $$ /$$__ $$| $$__ $$ | $$| $$$$$$
* | $$ $$ | $$$$$$$$| $$$$$$$$| $$ \ $$ /$$ | $$ \____ $$
* | $$\ $$ | $$_____/| $$_____/| $$ | $$ | $$ | $$ /$$ \ $$
* | $$ \ $$| $$$$$$$| $$$$$$$| $$ | $$ | $$$$$$/| $$$$$$/
@sgammon
sgammon / why-swift-is-pretty.swift
Last active Aug 29, 2015
swanky closures and defaults
View why-swift-is-pretty.swift
import UIKit
import Foundation
// how to make it
func timing(name: String, start: NSTimeInterval = NSDate().timeIntervalSince1970)() {
println("\(name): \(NSDate().timeIntervalSince1970 - start)")
}
View example_zip_yahoo_geoplanet_output.xml
<places xmlns="http://where.yahooapis.com/v1/schema.rng" xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:start="0" yahoo:count="1" yahoo:total="4">
<place yahoo:uri="http://where.yahooapis.com/v1/place/55805667" xml:lang="en-US">
<woeid>55805667</woeid>
<placeTypeName code="11">Zip Code</placeTypeName>
<name>95811</name>
<country type="Country" code="US">United States</country>
View app.yaml
application: judes-login-test
runtime: python
version: 1
api_version: 1
handlers:
- url: /.*
script: main.py
login: required
View gist:887995
from sampletext import finn, stopwords
from nltk.stem.porter import PorterStemmer
from nltk.tokenize.punkt import PunktLanguageVars
import string
index_mappings = {}
for word in [w.replace('.','') for w in filter(lambda xstring: xstring not in stopwords and xstring.replace('.', '').isalnum(), (PunktLanguageVars().word_tokenize(finn.lower())))]:
k = (PorterStemmer().stem(word), word)
if k in index_mappings:
@sgammon
sgammon / object_sort.py
Created Mar 25, 2011
Write an algorithm to sort these objects in ascending order, by the property "score".
View object_sort.py
import random
import hashlib
class SearchResult(object):
key = None
score = None
def __init__(self):
self.score = round(random.random(),2)*5
h = hashlib.md5()
h.update(str(self.score))
View gist:980347
import pipeline
from pipeline import common
from google.appengine.ext import db
from google.appengine.api import mail
from google.appengine.api import xmpp
###### Models ######
class User(db.Model):
View gist:1005254
__ _ _
/ _| | | | |
| |_ __ _| |_ ___ __ _| |_ _ __ ___ __ _ _ __
| _/ _` | __| / __/ _` | __| | '_ ` _ \ / _` | '_ \
| || (_| | |_ | (_| (_| | |_ | | | | | | (_| | |_) |
|_| \__,_|\__| \___\__,_|\__| |_| |_| |_|\__,_| .__/
<^..^> | | BETA
|_|
==========================================================================
View gist:1005559

FatCatMap Labs

##Change Log

Thu, June 02 2011 version tag 1-alpha

  • The platform is nearing a place where it can be used. Along with the new version tag:
  • some git spring cleaning
  • including some new FCM graphics
You can’t perform that action at this time.