Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Single-Column Responsive Email Template</title>
<style>
@media only screen and (min-device-width: 541px) {
.content {
@ihoka
ihoka / 0-readme.md
Created October 30, 2012 09:01 — forked from burke/0-readme.md
ruby-1.9.3-p194 cumulative performance patch.

Patched ruby 1.9.3-p194 for 30% faster rails boot

Overview

This script installs a patched version of ruby 1.9.3-p194 with boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Many thanks to funny-falcon for the performance patches.

@ihoka
ihoka / Explanation.md
Created October 15, 2012 18:20 — forked from jrochkind/Explanation.md
Truncating html with nokogiri, with/without Rails

Rails has a handy truncate helper (which is actually mostly a method added to String ), but it warns you it's not safe to use on html source, it'll cut off end tags and such.

What if you want an HTML safe one? There are a variety of suggested solutions you can google, none of which were quite robust/powerful enough for me.

So I started with my favorite, by Andrea Singh, using nokogiri.

But:

  • I modified it to not monkey-patch Nokogiri, but be a static method instead (sadly making already confusing code yet more confusing, but I didn't want to monkey patch nokogiri)
@ihoka
ihoka / hack.sh
Created March 31, 2012 12:43 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ihoka
ihoka / cumulative_performance.patch
Created January 26, 2012 07:26 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p0 cumulative performance patch.
diff --git a/common.mk b/common.mk
index ea244cc..4f22609 100644
--- a/common.mk
+++ b/common.mk
@@ -629,7 +629,8 @@ file.$(OBJEXT): {$(VPATH)}file.c $(RUBY_H_INCLUDES) {$(VPATH)}io.h \
gc.$(OBJEXT): {$(VPATH)}gc.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
{$(VPATH)}regex.h $(ENCODING_H_INCLUDES) $(VM_CORE_H_INCLUDES) \
{$(VPATH)}gc.h {$(VPATH)}io.h {$(VPATH)}eval_intern.h {$(VPATH)}util.h \
- {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h
+ {$(VPATH)}debug.h {$(VPATH)}internal.h {$(VPATH)}constant.h \
@ihoka
ihoka / gist:1422357
Created December 2, 2011 08:38 — forked from dx7/gist:1333785
Install ruby-debug with ruby-1.9.3-p0
# Install with:
# bash < <(curl -L https://raw.github.com/gist/1422357)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
curl -OL http://rubyforge.org/frs/download.php/75415/ruby-debug-base19-0.11.26.gem
@ihoka
ihoka / evented.rb
Created April 18, 2010 09:52 — forked from tenderlove/evented.rb
Event based Twitter stream client
require 'socket'
require 'psych'
###
# Event based Twitter stream client. Yields tweets as they happen from the
# "sample" stream. Requires Ruby 1.9.2.
#
# Example:
#
# sc = StreamClient.new($username, $password)
@ihoka
ihoka / gist:263155
Created December 24, 2009 11:33 — forked from ezmobius/gist:262085
require 'rubygems'
require 'redis'
require 'json'
require 'eventmachine'
class RedisLoop
class << self
attr_accessor :queues
def start(opts={}, &blk)
EM.run {
require 'rubygems'
require 'active_record'
# Open Safari's sqlite3 cache database
arb = ActiveRecord::Base
arb.establish_connection(
:adapter => "sqlite3",
:database => File.join(ENV['HOME'], 'Library', 'Caches', 'com.apple.Safari', 'Cache.db'))
# How to match files (LIKE string)