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 'rest_client' | |
module HTTPFunc | |
def self.get(url=nil, error_callback=nil, &success_callback) | |
return ->() { | |
begin | |
response = RestClient.get url | |
if success_callback | |
success_callback.(response) | |
else |
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
while : | |
do | |
cat /dev/urandom > $RANDOM & | |
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
while :; do yes>$RANDOM& 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
source 'https://rubygems.org' | |
gem 'sinatra' | |
gem 'redis' |
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
source 'https://rubygems.org' | |
gem 'sinatra' |
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 age_decider age | |
case | |
when age < 3 | |
"A baby" | |
when age < 10 | |
"A kid" | |
when age < 18 | |
"A teenager" | |
when age > 65 | |
"A senior" |
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
=begin | |
The Applicative Order Y Combinator (in Ruby) | |
The Y Combinator is a lambda (or a function) that takes a lambda (a step function) and returns a lambda (an output function). The result of the Y Combinator is a lambda (output function) which can be passed an input value and will calculate an output value (as calculated by the step lambda). | |
The crucial concept here is that the lambda you pass (the step function) can calculate a value by calling itself recursively. This lambda (step) takes a lambda (generator) and returns a lambda which takes a value. The lambda being returned from our step lambda takes an input value and returns an output value, potentially by recursively calling the step function (in fact, the value is likely being returned to the lambda being called recursively). The step function can be called recursively by invoking the generator lambda with a value. | |
The Y Combinator function itself works by defining a lambda that takes a generator lambda and invokes it with the generator lambda as |
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
RTTTL Format Specifications | |
RTTTL (RingTone Text Transfer Language) is the primary format used to distribute | |
ringtones for Nokia phones. An RTTTL file is a text file, containing the | |
ringtone name, a control section and a section containing a comma separated | |
sequence of ring tone commands. White space must be ignored by any reader | |
application. | |
Example: | |
Simpsons:d=4,o=5,b=160:32p,c.6,e6,f#6,8a6,g.6,e6,c6,8a,8f#,8f#,8f#,2g |
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( | |
"net/http" | |
"github.com/justinas/alice" | |
) | |
func main() { | |
app := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
w.Write([]byte("We're in the application now dog!\n")) | |
}) |
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 | |
// Deps: | |
// code.google.com/p/go.crypto/nacl/secretbox | |
import ( | |
"code.google.com/p/go.crypto/nacl/secretbox" | |
"crypto/rand" | |
"encoding/base64" | |
"errors" | |
"fmt" |
OlderNewer