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
Some exercises from the Falsy Values workshops.
The good parts:
<?php | |
/** | |
* Simple excel writer class with no external dependencies, drop it in and have fun | |
* @author Matt Nowack | |
* @license Unlicensed | |
* @version 1.0 | |
*/ | |
class Excel { | |
private $col; |
javascript: (function () { | |
var n = null, | |
C = false; | |
function h(m) { | |
d(m, "jsgif_overlaid"); | |
m.removeEventListener("click", i, C) | |
} | |
function i(m) { | |
var o = this; |
javascript: (function () { | |
var n = null, | |
C = false; | |
function h(m) { | |
d(m, "jsgif_overlaid"); | |
m.removeEventListener("click", i, C) | |
} | |
function i(m) { | |
var o = this; |
if (typeof jQuery == 'undefined') { | |
var jQ = document.createElement('script'); | |
jQ.type = 'text/javascript'; | |
jQ.onload=loadDeps; | |
jQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js'; | |
document.body.appendChild(jQ); | |
} else { | |
loadDeps(); | |
} | |
function loadDeps() { |
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
require 'net/http' | |
require 'uri' | |
require 'nokogiri' | |
url = URI.parse('http://webapps.cityofchicago.org/healthinspection/inspectionresultrow.jsp') | |
request = Net::HTTP::Post.new(url.path) | |
request.set_form_data({"REST"=>" ", "STR_NBR"=>"", "STR_NBR2"=>"", "STR_DIRECTION"=>"", "STR_NM"=>"", "ZIP"=>""}) |
require 'rubygems' | |
require 'rack' | |
class Object | |
def webapp | |
class << self | |
define_method :call do |env| | |
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?) | |
[200, {}, send(func, *attrs)] | |
end |
#!/usr/bin/env bash | |
# | |
# url : https://gist.github.com/672684 | |
# version : 2.0.2 | |
# name : appify | |
# description : Create the simplest possible mac app from a shell script. | |
# usage : cat my-script.sh | appify MyApp | |
# platform : Mac OS X | |
# author : Thomas Aylott <[email protected]> |
### | |
Module dependencies | |
### | |
require.paths.unshift "#{__dirname}/lib/support/express-csrf/" | |
require.paths.unshift "#{__dirname}/lib/support/node_hash/lib/" | |
express = require 'express' | |
app = module.exports = express.createServer() | |
RedisStore = require 'connect-redis' |