Skip to content

Instantly share code, notes, and snippets.

@mislav
mislav / gist:17371
Created October 17, 2008 07:42
haml2erb
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
end
@vangberg
vangberg / README
Created February 22, 2009 01:06
Deploying a Sinatra app to Heroku
# Deploying a Sinatra app to Heroku
## Database
The location of the database Heroku provides can be found in the environment
variable DATABASE_URL. Check the configure-block of toodeloo.rb for an example
on how to use this.
## Server
Heroku is serving your apps with thin, with means you have all your thin goodness available,
such as EventMachine.
@jch
jch / tail.rb
Created October 11, 2010 18:39
nspipe example
framework 'cocoa'
outpipe = NSPipe.pipe
task = NSTask.alloc.init
task.setLaunchPath '/usr/bin/tail'
task.setArguments %w(-f -n10 /Users/jch/projects/pharmmd/log/wendy.log)
task.setStandardOutput outpipe
file = outpipe.fileHandleForReading
@mbostock
mbostock / .block
Last active April 18, 2025 00:24
Google Maps + D3
license: gpl-3.0
@danchoi
danchoi / boston.sh
Created April 20, 2011 12:50
Weather forecast for Boston
#!/bin/bash
# Shows the weather forecast for Boston, MA
curl -s 'http://weather.noaa.gov/pub/data/forecasts/state/ma/maz007.txt' |
sed -n '/^TAB/,+11p; /BOSTON/,+3p'
@dbi
dbi / edit.html.mustache
Created May 4, 2011 09:31
Rails form helper for mustache spike/proof of concept
<!-- A scaffolded edit view converted to mustache -->
<h1>Editing post</h1>
{{#form}}
{{#errors?}}
<div id="error_explanation">
<h2>{{error_header}}</h2>
</div>
<ul>
@raimohanska
raimohanska / AesonTest.hs
Created December 2, 2011 20:53
Data.Aeson.Generic examples with Strings
{-# LANGUAGE OverloadedStrings, DeriveDataTypeable, NoMonomorphismRestriction #-}
module AesonTest where
import qualified Data.Aeson.Generic as A
import qualified Data.ByteString.Lazy as L8
import Data.Data
import Data.Typeable
import Codec.Binary.UTF8.String as U8
import Data.Maybe
@avaitla
avaitla / server.hs
Created January 31, 2012 09:07
basic snap modified from jaspervdj
{-# LANGUAGE OverloadedStrings #-}
import Data.Char (isPunctuation, isSpace)
import Data.Monoid (mappend)
import Data.Text (Text)
import Control.Exception (fromException)
import Control.Monad (forM_)
import Control.Concurrent (MVar, newMVar, modifyMVar_, readMVar)
import Control.Monad.IO.Class (liftIO)
import qualified Data.Text as T
import qualified Data.Text.IO as T
@heapwolf
heapwolf / frameworks.md
Created February 14, 2012 18:28
Be a hero fork a framework

Node.js and frameworks

Everyone has heard, “if all you have is a hammer, everything looks like a nail”. It’s an old adage that almost feels like cheap, dime store philosophy; especially in an echo chamber like Twitter where everything is a sound bite. But the cautionary tale it’s so famous for is profound and important to appreciate in the abstract world of software engineering.

Node.js by design is a very sparse platform. It’s primary purpose is to bind javascript to some parts of the operating system. It’s largely doctrine agnostic. And ultimately, users are left wondering where to start when they write a program.

Its not a nail

You first need to consider the scope of Node.js. It's much larger than that of a Web Server. Remember, it was made for easily building fast, scalable network applications. And Web Servers are a subset of network applications. Developers are coming from platforms where they spent almost 100% their time inside a Web Server. They want a nail, we can give them that. [

@MicahElliott
MicahElliott / rbenv-howto.md
Created April 17, 2012 18:11
Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

Setting up and installing rbenv, ruby-build, rubies, rbenv-gemset, and bundler

This guide enables you to install (ruby-build) and use (rbenv) multiple versions of ruby, isolate project gems (gemsets and/or bundler), and automatically use appropriate combinations of rubies and gems.

TL;DR Demo

# Ensure system is in ship-shape.

aptitude install git zsh libssl-dev zlib1g-dev libreadline-dev libyaml-dev