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
READ_BUF = 1024 | |
HIGH_WATER = 1024 | |
$fin = nil | |
$fout = nil | |
def open_fin | |
if $fin.nil? || ($fin.is_a?(File) && ($fin.eof? || $fin.closed?)) |
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
--- configure.in | |
+++ configure.in | |
@@ -3337,6 +3337,7 @@ | |
dependency_warning="no" | |
dependency_error="no" | |
+plugin_vmware="yes" | |
plugin_ascent="no" | |
plugin_battery="no" | |
plugin_bind="no" |
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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
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
largestDivisible :: Integer | |
largestDivisible = head (filter p [100000,99999..]) | |
where p x = x `mod` 3829 == 0 | |
Solved! | |
Oh duh. It's a function! | |
p x = x `mod` 3829 == 0 | |
p takes x and performs |
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
Rule #1 - "Start with a vision" | |
Rule #2 - "Throwing more bodies at software projects only makes things worse" | |
Rule #3 - "There are three vectors that drive software craftsmanship: quality, schedule, and features. The challenge is that you only get to pick two" |
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' |
OlderNewer