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 ruby | |
ROMAN = { | |
1000 => 'M', | |
900 => 'CM', | |
800 => 'DCCC', | |
500 => 'D', | |
400 => 'CD', | |
100 => 'C', | |
90 => 'XC', |
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 rspec | |
# Given an amount (a positive int) and a currency (a hash of {coin (a string) | |
# => value (an int)}), return how many of each coin is needed to make the | |
# amount as a hash {coin (a string) => count (an int)}. This method is useful | |
# for more than money, but money is a nicely concrete example of its utility. | |
# | |
# make_change assigns counts based on the iteration order of the currency you | |
# pass in. If you want optimal change, the currency you pass in must be sorted | |
# in descending order of value. |
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
#include <stdio.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#define SUDOKU_SZ 9 | |
#define SUDOKU_BLK_SZ 3 | |
typedef struct { | |
uint8_t cells[SUDOKU_SZ * SUDOKU_SZ]; |
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
#include <stdio.h> | |
#include <assert.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <dispatch/dispatch.h> | |
#include <sys/time.h> | |
#define SUDOKU_SZ 9 | |
#define SUDOKU_BLK_SZ 3 |
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
<!doctype html> | |
<html> | |
<head> | |
<script src="inkpad.js"></script> | |
<style> | |
body { | |
margin: 0; padding: 0; | |
} | |
ink-pad#ink { |
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 'open-uri' | |
require 'nokogiri' | |
url = ARGV[0] | |
while true | |
puts '******************************************' | |
puts "ashibrowse v.0.0000001 — Retrieving #{url}" | |
body = open(url).read | |
doc = Nokogiri::HTML(body) |
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 ruby | |
# tree.rb prints a directory tree. | |
# Prints a tree with all the descendants of path | |
# if path is a directory. If path is not a directory, | |
# does nothing. | |
def print_tree(path, prefix='') | |
return unless File.directory?(path) | |
Dir.entries(path).each_with_index do |entry, index| |
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
<!doctype html> | |
<html> | |
<head> | |
<script src="using-onload.js"></script> | |
<script> | |
new Status.Error("Something went wrong"); | |
new Status.Error("I feel confused"); | |
new Status.Error("Rampancy emminent."); | |
</script> | |
<style> |
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 p() { | |
// call console.log with this=console and all our arguments | |
// as positional args. | |
console.log.apply(console, arguments); | |
} | |
p('hello'); | |
p('hello', 'world'); | |
function hello(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
<!doctype html> | |
<html> | |
<head> | |
<script src=carousel.js></script> | |
<style> | |
body, html { | |
margin: 0; | |
padding: 0; | |
background: black; | |
} |
OlderNewer