Skip to content

Instantly share code, notes, and snippets.

View fd's full-sized avatar
🏳️‍🌈
Unstoppable

Simon Menke fd

🏳️‍🌈
Unstoppable
View GitHub Profile
@fd
fd / gist:89165
Created April 2, 2009 12:28
Switch between multiple rubies
function use_ruby_186 {
export MY_RUBY_HOME=/System/Library/Frameworks/Ruby.framework/Versions/Current/usr
export GEM_HOME=~/.gem/ruby/1.8
update_path
}
function use_ruby_187 {
export MY_RUBY_HOME=/opt/local
export GEM_HOME=~/.gem/ruby/1.8
@fd
fd / step_1.bash
Created April 8, 2009 11:46
Update passenger+rails on centos5
sudo gem update rails
sudo gem update passenger
sudo passenger-install-apache2-module
@fd
fd / gist:91735
Created April 8, 2009 11:48
Install Nokogiri on centos5
# It seems you need the latest version of rubygems
sudo gem update --system
# and some RPM's
sudo yum install libxml libxml-devel libxslt libxslt-devel
# now the gem should install ok
sudo gem install nokogiri
@fd
fd / arrrr.rb
Created May 8, 2009 08:37
Part 1 in our Arrrrcamp presentation
# sudo gem source -a http://gems.github.com
# sudo gem install thoughtbot-paperclip giraffesoft-resource_controller restfulx
def mate(path='')
run "mate #{path}"
end
def step(name='')
$step_count ||= 0
$step_count += 1
sudo gem sources -a http://gems.github.com
sudo gem install mrhenry-failtale-reporter
FailtaleReporter.configure do |config|
config.base_uri 'failtale.be'
config.api_token '[[your projects api token here]]'
end
require 'rubygems'
module Rack #:nodoc:
class GemAssets
F = ::File
# :assets_dir:: the sub directory where we will look for assets. (default: <tt>public</tt>)
# :xsendfile:: use XSendfile to send files.(default: <tt>true</tt>)
def initialize(app, options={})
@fd
fd / gisty.xml
Created November 13, 2009 12:53
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="Gisty" height="120">
<Require feature="wave" />
</ModulePrefs>
<Content type="html">
<![CDATA[
<div id="form_div"><input type="text" value="" id="gist_id" /> <input type=button value="Click Me!" id="butCount" onClick="buttonClicked()" /></div>
<div id="content_div"><script src="GIST_URI"></script></div>
<script type="text/javascript">
@fd
fd / _notes.md
Created July 30, 2010 12:09
Embedding Dylan in Rails 3.x

Embedding Dylan in Rails 3.x

Embedding Dylan in Rails 3.x is easy:

  • Create file called app/dylan/blog.rb
  • Create a template app/views/blog/index.html.erb
  • Mount Blog in the router.
@fd
fd / jquery.viewport.js
Created September 30, 2010 14:55
jQuery plugin for getting elements above, in or below the viewport
(function($){
$.fn.viewportState = (function(){
var results = [];
this.each(function(){
var bounds = this.getBoundingClientRect();
if (window.viewport.height() < bounds.top) {
results.push(['below', $(this)]);
} else if (bounds.bottom <= 0) {
results.push(['above', $(this)]);
} else {