Skip to content

Instantly share code, notes, and snippets.

View rjungemann's full-sized avatar

Roger Jungemann rjungemann

View GitHub Profile
@antirez
antirez / sinatra_redis_cache.rb
Created March 22, 2011 21:06
the simplest Redis caching for Sinatra -- not even tested... consider this code just an hint
# This is just an hint for a simple Redis caching "framework" using Sinatra
# A friend of mine asked for something like that, after checking the first two gems realized there was
# a lot of useless complexity (IMHO). That's the result.
#
# The use_cache parameter is useful if you want to cache only if the user is authenticated or
# something like that, so you can do cache_url(ttl,User.logged_in?, ...)
require 'rubygems'
require 'sinatra'
require 'redis'
@nzakas
nzakas / DownloadYourEmail.sh
Created April 7, 2011 05:12
You can download your Google Apps email from a shell script
#Download your Google Apps-hosted email
wget --secure-protocol=TLSv1 --no-check-certificate [email protected] --password=your_password https://mail.google.com/a/yourdomain.com/feed/atom
#old style
a={}
a[:test] = {}
a[:test][:second_test] = 'Hello hash!'
# new style
# emulates working with directories
b = {}
b/:test = {}
b/:test/:second_test = 'Hello hash!'
@eric1234
eric1234 / 0_instructions.txt
Created April 9, 2011 01:12
Using Sprockets 2 in Rails 3.0.x with CoffeeScript & SASS
UPDATE: Please see some of the forks for an updated version of this guide. I
myself have moved onto the Rails 3.1 betas to get the asset pipeline. But if
you want to stay on stable there are other folks who are keeping this guide
relevant despite the changes constantly occurring on Sprockets 2. The comments
on this gist will lead you to the right forks. :)
Some brief instructions on how to use Sprocket 2 in Rails to get CoffeeScript
powered JS and SASS powered CSS with YUI compression all via the magic of rack.
This stuff will be native in Rails 3.1 and the layout of the files on the
@topfunky
topfunky / Cakefile
Created April 14, 2011 22:18
Watch both Sass and Coffee files and compile on change (for Node.js)
###
Modified from https://github.com/jashkenas/coffee-script/blob/master/Cakefile
Part of an upcoming PeepCode screencast. This snippet is MIT Licensed.
###
{spawn, exec} = require 'child_process'
task 'assets:watch', 'Watch source files and build JS & CSS', (options) ->
runCommand = (name, args) ->
require 'sinatra/base'
class MyApp < Sinatra::Base
@@my_app = {}
def self.new(*) self < MyApp ? super : Rack::URLMap.new(@@my_app) end
def self.map(url) @@my_app[url] = self end
class FooController < MyApp
map '/foo'
HAI
BTW Cheater's quine
I HAS A quine
GIMMEH LINEZ quine OUTTA "quine.lol"
I HAS A loop_max ITZ ALL quine
I HAS A loop_index ITZ 0
IM IN YR loop
IZ loop_index LIEK loop_max O RLY?
YA RLY
@tmpvar
tmpvar / LICENSE.txt
Created May 20, 2011 02:51 — forked from 140bytes/LICENSE.txt
hatch - the smallest hash based router you've ever seen
Copyright (c) 2011 Elijah Insua, http://tmpvar.com
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@tmpvar
tmpvar / .gitignore
Created July 12, 2011 07:19
A console.log implementation that plays "nice" with large amounts of data. It Keeps node alive until the output has flushed to the screen.
gmon.out
v8.log
> svn checkout http://v8.googlecode.com/svn/trunk/ v8
> cd v8
> svn co http://gyp.googlecode.com/svn/trunk build/gyp
> ./build/gyp_v8 -f make
Updating projects from gyp files...
> make All
ACTION js2c_js2c out/Debug/obj/gen/libraries.cc
ACTION js2c_js2c_experimental out/Debug/obj/gen/experimental-libraries.cc
TOUCH out/Debug/obj.host/tools/gyp/js2c.stamp
CXX(host) out/Debug/obj.host/v8_nosnapshot/gen/libraries.o