This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Detects what server your Rails app is running under. | |
# Either passenger, fastcgi, mongrel, webrick or thin | |
def running_under | |
# For passenger, IN_PHUSION_PASSENGER is key | |
is_passenger = (defined?(IN_PHUSION_PASSENGER) and IN_PHUSION_PASSENGER) | |
# Not sure about fastcgi, but this should do the trick | |
is_fastcgi = (Kernel.const_get('RailsFCGIHandler') if defined?(FCGI)) rescue false | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
First things first, Dreamhost can be a complete nightmare, so be prepared to loose your sanity over this. | |
1. I need gem x | |
Follow the instructions at http://wiki.dreamhost.com/index.php/RubyGems to make your own gem installation, then add the following to the top of your config/environment.rb | |
ENV['GEM_PATH'] = "/home/username/.gems:/usr/lib/ruby/gems/1.8" | |
2. Out of date RedCloth | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple script to consolidate multiple colloquy transcripts into a single HTML log | |
# | |
# Reads from logs/*.colloquyTranscript | |
# Outputs to out.html | |
# | |
# Have multiple logs of conversations with a user who uses multiple nicknames | |
# in colloquy, each in separate files? | |
# | |
# Well here is the solution. Now you'll never get confused over which important | |
# piece of information is in which transcript ever again, as it will all be |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple script to parse dates of Barcamp events from barcamp.org | |
# | |
# Outputs to barcamp.ics | |
# | |
require 'rubygems' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'date' | |
require 'time' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Calendar helper with proper events | |
# http://www.cuppadev.co.uk/webdev/making-a-real-calendar-in-rails/ | |
# | |
# (C) 2009 James S Urquhart (jamesu at gmail dot com) | |
# Derived from calendar_helper | |
# (C) Jeremy Voorhis, Geoffrey Grosenbach, Jarkko Laine, Tom Armitage, Bryan Larsen | |
# Licensed under MIT. http://www.opensource.org/licenses/mit-license.php | |
## | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# Posting stuff to EchoWaves using httparty | |
# | |
# Note: protect_from_forgery needs to be disabled | |
## | |
require 'httparty' | |
class Echowaves | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Allows embedded YouTube videos in EchoWaves. | |
# Simply replace mark_up in app/helpers/messages_helper.rb with the following | |
# NOTE: Ignores the rest of the message with the YT url in it, so ideally needs to be merged with the line splitting conversion of url's. | |
def mark_up(message) | |
return message.message if message.system_message == true # no markup for system_messages | |
content = message.message | |
# Youtube? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
REMOTE_HOST='whatever' | |
USERNAME='whatever' | |
git push origin master && ssh ${REMOTE_HOST} "cd /home/${USERNAME}/www/rails;git pull origin master;chown -R ${USERNAME}:${USERNAME} *" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// MYAnimationView.h | |
// http://www.cuppadev.co.uk/iphone/animated-images-on-the-iphone-sans-memory-leaks | |
// | |
// A UIView control which animates an image by simply transforming a slide image | |
// containing frames of the animation inside a clipped subview. | |
// (in other words, like a flip book except instead of flipping pages, | |
// you move them around in a viewport) | |
// | |
// Requirements: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Some people have been emailing me complaining that my calendar_helper code | |
# (http://gist.github.com/54116) doesn't work properly. | |
# | |
# So for all of you who can't perform a little bit of problem solving to get the code working correctly in your app, here is the code as used in a fork of RuckSack. | |
# Enjoy. | |
#== | |
# Copyright (C) 2009 James S Urquhart | |
# | |
# Permission is hereby granted, free of charge, to any person |
OlderNewer