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
javascript:(function(){var d=document,j=d.getElementById('__cornify_nodes'),k=null;var file='https://gist.github.com/mikelikesbikes/4766d1815476568f4212/raw/990e81435eba381592b3396db38b5b068b444117/gistfile1.txt';if(j){cornify_add();}else{k=d.createElement('div');k.id='__cornify_nodes';d.getElementsByTagName('body')[0].appendChild(k);j=d.createElement('script');k.appendChild(j);j.onload=function(){console.log("woo");cornify_add();};j.src=file;}})(); |
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
arr=`echo $PATH | tr ':' '\n'`; | |
for path in ${arr[*]}; do | |
printf "%5s %s\n" `ls $path | wc -l` $path | |
done |
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
/* Here is your chance to take over Socrates! | |
Spend 10 minutes on each of the following hacks to the socrates website. | |
Enter them in the console to make sure it works and then save | |
your results here. | |
Choose a new pair for each. Add your names to the section you complete. | |
*/ |
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
$15.05 | |
mixed fruit,$2.15 | |
french fries,$2.75 | |
side salad,$3.35 | |
hot wings,$3.55 | |
mozzarella sticks,$4.20 | |
sampler plate,$5.80 |
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 java.io.BufferedReader; | |
import java.io.BufferedWriter; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.FileWriter; | |
import java.io.InputStreamReader; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.util.Vector; |
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
require 'optparse' | |
require 'ostruct' | |
options = OpenStruct.new | |
parser = OptionParser.new do |opts| | |
opts.on("-f", "--force", "Force something to happen") do |force| | |
options.force = force | |
end | |
end |
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
CHECKSUM_CHARS = ((?A..?Z).to_a + (0..5).to_a).join | |
# String -> String | |
def id_with_checksum(sfid) | |
# protection from bad people who misuse things | |
return sfid if sfid.length == 18 | |
raise ArgumentError.new("sfid must be 15 characters") unless sfid.length == 15 | |
# The meat. | |
suffix = sfid.chars \ # String -> [String] |
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
(ns katas.change-maker) | |
(defn num-pairs | |
"Returns all combinations of [x y] and (<= x y) where (= cents (+ x y))" | |
[cents] | |
(for [x (reverse (range 1 (inc (quot cents 2)))) ;; use the range from midpoint to 1 so that we walk the | |
;; shortest side of the tree first | |
:let [y (- cents x)]] | |
[x y])) |
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
require 'benchmark' | |
require 'hamster' | |
require 'deps/clojure-1.4.0.jar' | |
Benchmark.bm do |bm| | |
def fill(hash) | |
(0..10000).reduce(hash) do |h, i| | |
if h.class == Java::ClojureLang::PersistentHashMap | |
h.assoc(i, 1) | |
elsif h.respond_to?(:put) |
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
brew tap homebrew/dupes | |
brew install apple-gcc42 |