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
gem install fog | |
Successfully installed fog-0.7.2 | |
1 gem installed | |
cat ~/.fog | |
:default: | |
:ecloud_username: <ecloud username> | |
:ecloud_password: <ecloud password> | |
:ecloud_versions_uri: https://services.enterprisecloud.terremark.com/api/versions |
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 Hash | |
def with_defaults(defaults={}) | |
self.merge(defaults) { |k,o,n| o } | |
end | |
def with_defaults!(defaults={}) | |
self.merge!(defaults) { |k,o,n| o } | |
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
def work | |
@count += 1 | |
GC.start | |
before = Hash.new(0) | |
ObjectSpace.each_object { |o| before[o.class] += 1 } | |
super | |
GC.start | |
after = Hash.new(0) | |
ObjectSpace.each_object { |o| after[o.class] += 1 } | |
p "count: #{@count}" |
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
int motorPin = 9; | |
int potPin = 0; | |
int lastValue = 0; | |
int motorSpeed = 0; | |
int delayTime = 250; | |
void setup() { | |
Serial.begin(9600); | |
pinMode(motorPin, OUTPUT); | |
analogWrite(motorPin, motorSpeed); |
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
> io dsl1.io | |
list(Ed Muller) | |
list(555-555-1212) | |
^^ works | |
via the repl \/ it doesn't. I get... | |
pn := doString("{ \"Ed Muller\": \"555-555-1212\" }") | |
Exception: Map does not respond to 'call' |
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
Looking for creative FizzBuzziness..... | |
One per file, all languages accepted. |
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 preify() { | |
if ( $('#tmplPaging').css('display') == 'none' ) { | |
setTimeout( preify, 1000); | |
} else { | |
$('#offline_occurrences li h2') | |
.replaceWith(function() { return '<pre>' + $(this).text() + '</pre>' }); | |
} | |
} | |
$(document).ready( preify ); |
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
CREATE OR REPLACE FUNCTION fizzbuzz() | |
RETURNS setof text as $$ | |
BEGIN | |
FOR i IN 1 .. 100 LOOP | |
IF MOD(i, 15) = 0 THEN | |
return next 'FizzBuzz'; | |
ELSIF MOD(i, 5) = 0 THEN | |
return next 'Buzz'; |
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
package main | |
import ( | |
"strings" | |
"code.google.com/p/go-tour/wc" | |
) | |
// Maybe strings.Fields is cheating? | |
func WordCount(s string) map[string]int { |
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
package main | |
import ( | |
"code.google.com/p/go-tour/pic" | |
) | |
func Pic(dx, dy int) [][]uint8 { | |
s := make([][]uint8, dy) | |
for y := range s { | |
s[y] = make([]uint8, dx) |