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
# | |
# Zipper has @left and @right. | |
# When a zipper represents [1, 2, 3, <cursor>, 4, 5], | |
# @left == [3, [2, [1, []]]], @right == [4, [5, []]] | |
# Note that @left is in reverse order. | |
# | |
class Zipper | |
include Enumerable | |
def self.make(*vals) |
#!/bin/sh | |
tmux start-server | |
if ! $(tmux has-session -t grow); then | |
tmux new-session -d -s grow -n foreground | |
tmux send-keys 'cd .' C-m C-l | |
tmux send-keys 'AUTOFEATURE=true autotest --quiet' C-m | |
tmux split-window -h | |
tmux send-keys 'cd .' C-m C-l |
Some exercises from the Falsy Values workshops.
The good parts:
/*! | |
* quantize.js Copyright 2008 Nick Rabinowitz. | |
* Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php | |
*/ | |
// fill out a couple protovis dependencies | |
/*! | |
* Block below copied from Protovis: http://mbostock.github.com/protovis/ | |
* Copyright 2010 Stanford Visualization Group | |
* Licensed under the BSD License: http://www.opensource.org/licenses/bsd-license.php |
require 'aws/s3' | |
require 'digest/md5' | |
require 'mime/types' | |
## These are some constants to keep track of my S3 credentials and | |
## bucket name. Nothing fancy here. | |
AWS_ACCESS_KEY_ID = ENV['S3_KEY'] | |
AWS_SECRET_ACCESS_KEY = ENV['S3_SECRET'] | |
AWS_BUCKET = ENV['S3_BUCKET'] |
require 'rubygems' | |
require 'matrix' | |
require 'lingua/stemmer' | |
require 'csv' | |
require 'erb' | |
require 'iconv' | |
require 'sanitize' | |
require './cleaner.rb' | |
STEMMER = Lingua::Stemmer.new |
<script> | |
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful | |
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it. | |
// The following will allow remote autocompletes *without* modifying any officially released core code. | |
// If others find ways to improve this, please share. | |
var autocomplete = $('#searchinput').typeahead() | |
.on('keyup', function(ev){ | |
ev.stopPropagation(); |
// Charles Lawrence - Feb 16, 2012. Free to use and modify. Please attribute back to @geuis if you find this useful | |
// Twitter Bootstrap Typeahead doesn't support remote data querying. This is an expected feature in the future. In the meantime, others have submitted patches to the core bootstrap component that allow it. | |
// The following will allow remote autocompletes *without* modifying any officially released core code. | |
// If others find ways to improve this, please share. | |
var autocomplete = $('#searchinput').typeahead() | |
.on('keyup', function(ev){ | |
ev.stopPropagation(); | |
ev.preventDefault(); |
class ErbEngine < Haml::Engine | |
def push_script(text, preserve_script, in_tag = false, preserve_tag = false, | |
escape_html = false, nuke_inner_whitespace = false) | |
push_text "<%= #{text.strip} %>" | |
end | |
def push_silent(text, can_suppress = false) | |
push_text "<% #{text.strip} %>" | |
end |
brew install rbenv | |
brew install ruby-build | |
brew install rbenv-vars | |
brew install readline | |
brew install ctags | |
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile | |
exec $SHELL -i # reload the shell | |
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" | |
rbenv install 1.9.3-p194 | |
rbenv global 1.9.3-p194 |