Skip to content

Instantly share code, notes, and snippets.

View sgammon's full-sized avatar
:shipit:
f*ck it, ship it

Sam Gammon sgammon

:shipit:
f*ck it, ship it
View GitHub Profile
@sgammon
sgammon / keen-js-v2.3.1.js
Last active August 29, 2015 13:55
Minimal rewrite of Keen IO's JavaScript library :) version 2.3.1
/***
*
*
* /$$ /$$ /$$$$$ /$$$$$$
* | $$ /$$/ |__ $$ /$$__ $$
* | $$ /$$/ /$$$$$$ /$$$$$$ /$$$$$$$ | $$| $$ \__/
* | $$$$$/ /$$__ $$ /$$__ $$| $$__ $$ | $$| $$$$$$
* | $$ $$ | $$$$$$$$| $$$$$$$$| $$ \ $$ /$$ | $$ \____ $$
* | $$\ $$ | $$_____/| $$_____/| $$ | $$ | $$ | $$ /$$ \ $$
* | $$ \ $$| $$$$$$$| $$$$$$$| $$ | $$ | $$$$$$/| $$$$$$/
/***
*
*
* /$$ /$$ /$$$$$ /$$$$$$
* | $$ /$$/ |__ $$ /$$__ $$
* | $$ /$$/ /$$$$$$ /$$$$$$ /$$$$$$$ | $$| $$ \__/
* | $$$$$/ /$$__ $$ /$$__ $$| $$__ $$ | $$| $$$$$$
* | $$ $$ | $$$$$$$$| $$$$$$$$| $$ \ $$ /$$ | $$ \____ $$
* | $$\ $$ | $$_____/| $$_____/| $$ | $$ | $$ | $$ /$$ \ $$
* | $$ \ $$| $$$$$$$| $$$$$$$| $$ | $$ | $$$$$$/| $$$$$$/
@sgammon
sgammon / why-swift-is-pretty.swift
Last active August 29, 2015 14:22
swanky closures and defaults
import UIKit
import Foundation
// how to make it
func timing(name: String, start: NSTimeInterval = NSDate().timeIntervalSince1970)() {
println("\(name): \(NSDate().timeIntervalSince1970 - start)")
}
<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>
application: judes-login-test
runtime: python
version: 1
api_version: 1
handlers:
- url: /.*
script: main.py
login: required
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 March 25, 2011 21:33
Write an algorithm to sort these objects in ascending order, by the property "score".
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))
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):
@sgammon
sgammon / gist:1005254
Created June 2, 2011 20:38
fatcatmap
__ _ _
/ _| | | | |
| |_ __ _| |_ ___ __ _| |_ _ __ ___ __ _ _ __
| _/ _` | __| / __/ _` | __| | '_ ` _ \ / _` | '_ \
| || (_| | |_ | (_| (_| | |_ | | | | | | (_| | |_) |
|_| \__,_|\__| \___\__,_|\__| |_| |_| |_|\__,_| .__/
<^..^> | | BETA
|_|
==========================================================================

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