Skip to content

Instantly share code, notes, and snippets.

View emischorr's full-sized avatar

Enrico Mischorr emischorr

View GitHub Profile
@emischorr
emischorr / app.rb
Created July 26, 2012 09:06 — forked from dunedain289/app.rb
A fast sinatra redis data viewer
require 'rubygems'
require 'haml'
require 'sinatra'
require 'redis'
helpers do
def redis
@redis ||= Redis.connect
end
end
@emischorr
emischorr / compass-retina-sprites.scss
Created April 16, 2012 08:48 — forked from thulstrup/compass-retina-sprites.scss
Using Compass to generate normal and retina sprite maps
$sprites: sprite-map("sprites/*.png");
$sprites-retina: sprite-map("sprites-retina/*.png");
@mixin sprite-background($name) {
background-image: sprite-url($sprites);
background-position: sprite-position($sprites, $name);
background-repeat: no-repeat;
display: block;
height: image-height(sprite-file($sprites, $name));
width: image-width(sprite-file($sprites, $name));
@emischorr
emischorr / campirc.rb
Created April 11, 2012 19:45 — forked from rkh/campirc.rb
IRC <-> Campfire bridge
# coding: binary
# IRC <-> Campfire bridge, set IRC password to SUBDOMAIN:TOKEN and connect to localhost:6667
# Remove special chars/spaces from channel names (ie "Foo Bar" becomes #FooBar). Only tested with LimeChat.
# gem install excon && gem install yajl-ruby -v "< 2.0"
%w[socket thread uri excon yajl yajl/http_stream].each { |lib| require lib }
Thread.abort_on_exception = true
[:INT, :TERM].each { |sig| trap(sig) { exit } }
server = TCPServer.new('127.0.0.1', 6667)
loop do
@emischorr
emischorr / gist:2361835
Created April 11, 2012 19:44 — forked from dhh/gist:1975644
Rails mass assignment protection
class PostsController < ActionController::Base
def create
Post.create(post_params)
end
def update
Post.find(params[:id]).update_attributes!(post_params)
end
private