Some exercises from the Falsy Values workshops.
The good parts:
- HTTP server and client in same script
- Express cookies example
- Express routing example
- Express error handling
- Express middlewares example
- Simple HTTP proxy
class Accuracy < ActiveRecord::Base | |
belongs_to :measurable, :polymorphic => true | |
end | |
class Organisation < ActiveRecord::Base | |
has_one :accuracy, :as => :measurable | |
end | |
class CreateAccuracies < ActiveRecord::Migration | |
def self.up |
Xcode | |
http://developer.apple.com/technology/xcode.html | |
[OR] | |
Mac OS X install disc 2 | |
GNU wget | |
http://ftp.gnu.org/gnu/wget/wget-latest.tar.gz | |
Git | |
http://code.google.com/p/git-osx-installer/ |
> This is a Shortwave configuration file | |
> http://shortwaveapp.com/ | |
> | |
> Some triggers copied from benpickles (http://gist.github.com/43371) | |
> | |
> Urls may contain the following replacement tokens: | |
> | |
> %s → search terms | |
> %r → URL of current page | |
> %d → domain part of the current URL |
path: | |
/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec | |
tests: | |
export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/libexec |
module God | |
module Conditions | |
class FileTouched < PollCondition | |
attr_accessor :path | |
def initialize | |
super | |
self.path = nil | |
end |
email = ARGV[0] | |
password = ARGV[1] | |
uri = URI.parse("https://google.com/accounts/ClientLogin") | |
request = Net::HTTP::Post.new(uri.path) | |
request.set_form_data({'Email'=> email, 'Passwd' => password,'accountType' | |
=> 'GOOGLE', 'service' => 'ac2dm', 'source' => 'myexample'}) | |
Net::HTTP.new(uri.host, url.port).request(request) |
require 'net/https' | |
require 'uri' | |
email = ARGV[0] | |
password = ARGV[1] | |
uri = URI.parse("https://google.com/accounts/ClientLogin") | |
req = Net::HTTP::Post.new(uri.path) | |
req.set_form_data({'Email'=> email, 'Passwd' => password,'accountType' => 'GOOGLE', 'service' => 'ac2dm', 'source' => 'myexample'}) |
Some exercises from the Falsy Values workshops.
The good parts:
(function() { | |
/* First try to handle pages which are actually raw text of the email. | |
Extract the HTML part and replace page with it */ | |
var orig_html = document.getElementsByTagName('html')[0].textContent; | |
var extracted_html = orig_html; | |
/* Try splitting it up if it's actually the multipart email. Otherwise, work | |
on the document itself, leaving the orig_html in place */ | |
var boundary_pattern = '--==============='; | |
while (extracted_html.indexOf(boundary_pattern) != -1) { | |
var next_boundary = extracted_html.indexOf(boundary_pattern); |
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
func main() { | |
// Create our stream of ints up to the threshold | |
// This channel is closed by the generate goroutine |