This file contains hidden or 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
;; Start of what the above flow in clojure would look like. | |
;; Tokenization step. | |
(->> (clojure.string/split (slurp "/tmp/X") #" ") tokenize-word) | |
;; For debugging, just look at the first 100 words... | |
(->> (clojure.string/split (slurp "/tmp/X") #" ") tokenize-word (take 100)) | |
;; or, look at some in the middle... | |
(->> (clojure.string/split (slurp "/tmp/X") #" ") |
This file contains hidden or 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
# Should enable the little battery icon. | |
xfce4-power-manager | |
echo "Setting middle button emulation" | |
xinput set-int-prop 12 "Evdev Middle Button Emulation" 8 1 | |
echo "Turning off dual mode video" | |
sudo sh -c "echo OFF > /sys/kernel/debug/vgaswitcheroo/switch" | |
echo "Turhing off bluetooth" |
This file contains hidden or 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
// Demonstration of how easy it is for this to mess up your loops. | |
var txt = ["a","b","c"]; | |
for (var i = 0; i < 3; ++i ) { | |
var msg = txt[i]; | |
setTimeout(function() { alert(msg); }, i*1000); | |
} | |
// Alerts 'c', 'c', 'c' |
This file contains hidden or 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
(defn create-security-header | |
"Given an optional environment (:stage, :prod), creates the authentication." | |
[credentials] | |
(let [soap-factory (SOAPFactory/newInstance) | |
security (.. soap-factory (createElement (QName. security-namespace "Security"))) | |
user-token (.. soap-factory (createElement (QName. security-namespace "UsernameToken"))) | |
username (.. soap-factory (createElement (QName. security-namespace "Username"))) | |
password (.. soap-factory (createElement (QName. security-namespace "Password")))] | |
(.. username (addTextNode (get credentials :username))) | |
(.. password (addTextNode (get credentials :password))) |
This file contains hidden or 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 | |
# | |
# This script reads packages from .s3. | |
# Given a directory, will pull all .s3 packages in it recursively. | |
# Or, if you specify a .s3 file, it will pull just that package. | |
# | |
# Copyright (C) 2010-2012 ReadyForZero (ReadyForZero.com) | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by |
This file contains hidden or 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
(defmachine PaymentsMachine | |
(state :user-submitted | |
(on-in (fn [data] | |
(log/put "User submitted ...") | |
(send-email "...")))) | |
(state :sent-off | |
(on-in (fn [data] | |
(log/put "sent payment")))) | |
(state :error |
This file contains hidden or 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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<title>Ember Bug</title> | |
</head> | |
<body> | |
<script src="http://code.jquery.com/jquery-1.7.1.js"></script> | |
<script src="https://github.com/downloads/emberjs/ember.js/ember-0.9.1.js"></script> | |
<script type="text/x-handlebars" data-template-name="president"> | |
The President of the United States is {{name}}. |
This file contains hidden or 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
0: clojure.lang.LazySeq.sval(LazySeq.java:47) | |
1: clojure.lang.LazySeq.seq(LazySeq.java:63) | |
2: clojure.lang.RT.seq(RT.java:450) | |
3: clojure.core$seq.invoke(core.clj:122) | |
4: clojure.core$dorun.invoke(core.clj:2450) | |
5: clojure.core$doall.invoke(core.clj:2465) | |
6: pallet.core$parallel_lift.invoke(core.clj:720) | |
7: pallet.core$lift_nodes_for_phase$fn__8250.invoke(core.clj:742) | |
8: clojure.lang.ArrayChunk.reduce(ArrayChunk.java:58) | |
9: clojure.core$r.invoke(core.clj:797) |
This file contains hidden or 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
# Commands to initialize a simple heroku noir app. You can cut and paste them together. | |
# Install latest version of noir. If an older version is installed, remove it first. | |
lein plugin install lein-noir "1.1.0-SNAPSHOT" | |
# Create new noir project. | |
lein noir new noir-mongo-heroku | |
cd noir-mongo-heroku | |
# Create instructions for heroku. | |
echo 'web: lein run' > Procfile | |
# Create git repository. |
This file contains hidden or 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
def solve(eq,var='x'): | |
eq1 = eq.replace("=","-(")+")" | |
c = eval(eq1,{var:1j}) | |
return -c.real/c.imag | |
class CalculatorHandler: | |
def __init__(self): | |
self.log = {} | |