This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
dictionary="/usr/share/dict/words" | |
# usage: scrabble.py <letters> | |
# also, pass it through grep if you want more complex patterns. Personally, my regex-fu isn't that strong. | |
# for the most part, I'll do something like './scrabble.py oschwi*us | grep 'us$' for a word ending in us. | |
# that's about the extent of my regex-fu | |
def readDict(diction=dictionary): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function CSSScanner(e) { | |
this.init(e) | |
} | |
function CSSParser(e) { | |
this.mToken = null, this.mLookAhead = null, this.mScanner = new CSSScanner(e), this.mPreserveWS = !0, this.mPreserveComments = !0, this.mPreservedTokens = [], this.mError = null | |
} | |
function jscsspToken(e, t, n) { | |
this.type = e, this.value = t, this.unit = n |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import MathKit | |
let p = SimplePolynomial(string: "3x^2 + x + 1") | |
let p2 = SimplePolynomial(string: "(x)(y)") | |
let p3 = SimplePolynomial(string: "thisIsOneLongVariable^2") | |
p + p2 // returns 3x^2 + x + (x)(y) + 1 | |
p - p2 // returns 3x^2 + x - (x)(y) + 1 | |
p * p2 // don't feel like figuring that one out. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax on | |
set tabstop=2 | |
set expandtab | |
set shiftwidth=2 | |
let mapleader = "," | |
nnoremap / /\v | |
vnoremap / /\v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Foo: NSObject { | |
var obj: NSObject? = nil | |
} | |
func createObjectOfType(type: NSObject.self) -> Foo { | |
let obj = type() | |
if obj.respondsToSelector("obj") { | |
obj.setValue(NSObject(), forKey: "obj") // never gets called | |
} | |
//obj.setValue(NSObject(), forKey: "obj") // Exceptions if you don't call it with 'Foo.self' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func ==(a: Polynomial, b: Polynomial) -> Bool { | |
return a.description == b.description | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
homeassistant: | |
name: Apartment | |
latitude: [Redacted] | |
longitude: [Redacted] | |
temperature_unit: F | |
time_zone: America/Los_Angeles | |
customize: | |
scene.romantic: | |
friendly_name: "Romantic" | |
scene.lights_on: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pushd ~/foo/twIRCk/ # change this to wherever you keep your twIRCk sources. | |
git pull origin master | |
# removing the mac app store signing | |
cp TwIRCk.xcodeproj/project.pbxproj backup.pbxproj | |
sed '/CODE_SIGN_IDENTITY/d' < TwIRCk.xcodeproj/project.pbxproj >> new.pbxproj | |
mv new.pbxproj TwIRCk.xcodeproj/project.pbxproj | |
xcodebuild -target twIRCk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [ $# -ne 1 ]; then | |
echo "Usage: $0 <reponame>" | |
else | |
echo "creating $1.git" | |
mkdir $1.git | |
cd $1.git | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from PIL import Image | |
import math | |
import requests | |
import StringIO | |
def deg2num(lat_deg, lon_deg, zoom): | |
lat_rad = math.radians(lat_deg) | |
n = 2.0 ** zoom |
OlderNewer