Skip to content

Instantly share code, notes, and snippets.

View Burgestrand's full-sized avatar
🙃
(:

Kim Burgestrand Burgestrand

🙃
(:
View GitHub Profile
/*!
* jQuery TextChange Plugin
* http://www.zurb.com/playground/jquery-text-change-custom-event
*
* Copyright 2010, ZURB
* Released under the MIT License
*/
(function ($) {
$.event.special.textchange = {
@Burgestrand
Burgestrand / assets.rake
Created October 6, 2010 10:02
Asset packaging rake task
# Rake task for compiling CoffeeScript and SASS (Compass).
#
# Author: Kim Burgestrand <http://burgestrand.se/>
# Date: 6th October 2010
# License: X11 License (MIT License)
# URL: http://gist.github.com/gists/613114
desc "Compiles CoffeeScript using Barrista (but only if they changed)"
task 'coffee:compile' => :environment do
require 'barista'
abort "'#{Barista::Compiler.bin_path}' is unavailable." unless Barista::Compiler.available?
@igrigorik
igrigorik / webapp.rb
Created November 13, 2010 21:28
Inspired by @JEG2's talk at Rubyconf... Any ruby object, as a webapp! 'Cause we can. :-)
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
@Burgestrand
Burgestrand / webapp.rb
Created January 25, 2011 03:06 — forked from igrigorik/webapp.rb
Turn any ruby Object into a web application!
require 'rack'
class Object
def to_webapp
def self.call(env)
func, *attrs = env['PATH_INFO'].split('/').reject(&:empty?)
[200, {}, send(func || :inspect, *attrs)]
end
self
end
@Burgestrand
Burgestrand / em-fiber.rb
Created March 6, 2011 18:54
An experiment using Fibers together with EventMachine
# coding: utf-8
require 'eventmachine'
module EM
module Strand
extend self
# Fires up EventMachine in a fiber, ready to take orders.
#
# @return EM::Strand
@Gregg
Gregg / gist:968534
Created May 12, 2011 13:54
Code School Screencasting Framework

Screencasting Framework

The following document is a written account of the Code School screencasting framework. It should be used as a reference of the accompanying screencast on the topic.

Why you should care about screencasting?

You're probably aren't going to take the time to read this document if you're not interested, but there are a lot of nice side effects caused by learning how to create quality screencasts.

  1. Communicating more effectively - At Envy Labs we produce screencasts for our clients all the time. Whether it's demoing a new feature or for a presentation for an invester, they're often much more effective and pleasent than a phone call or screen sharing.
class Proc
def merge_binding!(other_binding)
other_binding.eval("local_variables").each do |var|
var_id = other_binding.eval(var.to_s).object_id
binding.eval("#{var} = ObjectSpace._id2ref(#{var_id})")
end
end
end
x = 3
@jasonrudolph
jasonrudolph / about.md
Last active January 6, 2024 07:40
Programming Achievements: How to Level Up as a Developer
@unders
unders / ruby-self-and-default-definee.rb
Created September 14, 2011 07:21
self is the self which you know. It is the default receiver of method invocation. There is always a self.
class Object
def singleton_class
class << self
self
end
end
end
# X.singleton_class
# - > X
@Burgestrand
Burgestrand / hallon_enumerator.rb
Created September 26, 2011 21:40
Proof of concept for a lazy Enumerator
require 'ostruct'
require 'delegate'
module Hallon
class Enumerator < SimpleDelegator
attr_reader :size
def initialize(size, pointer, &block)
@pointer = pointer
@items = Array(0...size)