Skip to content

Instantly share code, notes, and snippets.

View glaszig's full-sized avatar

glaszig

  • available for hire. contact me.
  • remote
View GitHub Profile
@dnagir
dnagir / async_smtp_delivery_method.rb
Created February 10, 2012 03:38
Threaded mail delivery in rails
# lib/async_smtp_delivery_method.rb
require 'mail'
class AsyncSmtpDeliveryMethod
def initialize(settings)
@settings = settings
end
def deliver!(mail)
@NewAlexandria
NewAlexandria / rbenv_ree_install.sh
Created February 13, 2012 21:11
Installing Ruby Enterprise Edition into rbenv
########
# This file script wil show you how to install Ruby Enterprise Edition (REE) 1.8.7-2011-12 with
# rbenv, rails 3 and homebrew. Bundler is also used.
########
#setup the installer environment
brew install wget
wget -q http://rubyenterpriseedition.googlecode.com/files/ruby-enterprise-1.8.7-2011.12.tar.gz
tar xzf ruby-enterprise-1.8.7-2011.12.tar.gz
@jugyo
jugyo / gist:1869594
Created February 20, 2012 15:06
webmock + sinatra
require 'webmock'
require 'sinatra/base'
WebMock::API.stub_request(:any, /www\.example\.com/).to_rack(Class.new(Sinatra::Base) {
post "/foo" do
"FOO"
end
})
require 'httpclient'
@finack
finack / application.rb
Created March 17, 2012 06:18
Example Chef Deploy Revision for Rails 3+
app = node[:rails][:app]
rails_base app[:name] do
ruby_ver app[:ruby_ver]
gemset app[:gemset]
end
%w{config log pids cached-copy bundle system}.each do |dir|
directory "#{app[:app_root]}/shared/#{dir}" do
owner app[:deploy_user]
@rapidrapids
rapidrapids / 4095.css
Created March 28, 2012 12:09
IE CSS Selector test (4095)
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
#test2 { background-color: red ;}
@myronmarston
myronmarston / ways_to_use_vcr.rb
Created April 13, 2012 15:00
Ways to use VCR for a request made by a let block
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.
@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

@bradleyayers
bradleyayers / load-user-jobs.conf
Created April 26, 2012 21:26
Load user jobs at boot.
author 'Bradley Ayers'
description 'Enables user job "start on" stanzas to be honored at boot'
task
start on starting rc-sysinit
script
cat /etc/passwd | while read line
do
user=`echo $line | cut -d: -f1`
@TonnyXu
TonnyXu / UITableView_SeparatorLine.md
Created May 10, 2012 13:21
set UITableView.separatorLine to 2px and with different colors each pixel

Question

How to implement a UITableView with a separator line like this:

doubly separator line

Usually, you can only set the separatorLine property of a UITableView with to single line or single line etched. Sometimes, it is not enough. So, how to implement a separator line like this?

Answer

@orta
orta / ARSearchBar.h
Created May 12, 2012 17:25
Custom Search Bar
//
// ARSearchBar.h
// Artsy Folio
//
// Created by orta therox on 18/04/2012.
// Released under The MIT License
// http://www.opensource.org/licenses/mit-license.php
//
// Copyright (c) 2012 http://art.sy. All rights reserved.
//