Skip to content

Instantly share code, notes, and snippets.

View artlung's full-sized avatar
💭
🤖

Joe Crawford artlung

💭
🤖
View GitHub Profile
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
var meta = document.getElementsByTagName('meta');
var apple_launch_elem;
for (var i=0;i < meta.length; i++) {
var elem = meta[i];
@artlung
artlung / zodiac-fragment.py
Created March 21, 2012 23:49 — forked from anonymous/zodiac.py
ZODIAC.PY FRAGMENT
def main():
name = raw_input ("Enter Your Name: ")
month = raw_input("Enter Birth Month: ")
day = int(raw_input("Enter Birth Day of Month: "))
if month == "March":
if day > 20:
print "Aries"
else:
print "Pisces"
# displays alphanumeric character count and sum of digits in file
import sys
if len(sys.argv) < 2:
print "Usage: python charcount.py <input.txt>"
exit()
f = open(sys.argv[1])
@artlung
artlung / gist:587176
Created September 19, 2010 22:29 — forked from alandipert/gist:585336
challenge in clojure
;;; FIRST CHALLENGE
(defn challenge1
"Given file name f reads it and prints statistics."
[f]
(let [{numbers false letters true} (group-by #(nil? (re-matches #"\d*" %))
(clojure.contrib.duck-streams/read-lines f))
letter-freqs (frequencies letters)
sum (reduce + (map #(Integer/parseInt %)
numbers))]