Skip to content

Instantly share code, notes, and snippets.

View tsmango's full-sized avatar

Tom Mango tsmango

View GitHub Profile
class Util::Slug
def self.generate(string)
trim(string.gsub(/[^a-z0-9]+/i, '-').downcase)
end
def self.trim(string)
# Trim trailing hyphen from string
while string[string.length - 1, string.length] == '-'
string = string.chop
end
<!-- Put the following at /Library/LaunchDaemons/com.mysql.mysqld.plist (owned by root:wheel) -->
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.mysql.mysqld</string>
class Util::GeoAPI
API_VERSION = "v1"
API_URL = "http://api.geoapi.com/#{API_VERSION}/"
API_KEY = ""
# Wraps GeoAPI's Simple Search API method.
#
# @param [Hash] accepts all parameters accepted by the Simple Search.
# GoeAPI Documentation: http://docs.geoapi.com/Simple-Search
#
A simple wrapper for unauthenticated, json, GET requests to the Twitter API.
Required:
* rest-client gem (version 1.3.1)
Example:
> Twitter.get('geo/reverse_geocode', :lat => 40.8557, :long => -73.1915)
class ApplicationController < ActionController::Base
filter_parameter_logging :password
helper :all
protect_from_forgery
rescue_from Exception, :with => :exception_handler
protected
# 1.8.6
>> "hello".chars
=> #<ActiveSupport::Multibyte::Chars:0xb7678a88 @wrapped_string="hello">
# 1.8.7
>> "hello".chars
=> #<Enumerable::Enumerator:0x10343fb58>
#! /bin/sh
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $local_fs
# Should-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: redis-server - Persistent key-value db

IPN: Possible Pending Reasons

Note: The variable pending_reason is only set if payment_status = Pending.

address:

The payment is pending because your customer did not include a confirmed shipping address and your Payment Receiving Preferences is set yo allow you to manually accept or deny each of these payments. To change your preference, go to the Preferences section of your Profile.

authorization:

# Apache
%w{80}.each do |port|
God.watch do |w|
w.name = "apache"
w.interval = 30.seconds
w.start = "/etc/init.d/apache2 start"
w.stop = "/etc/init.d/apache2 stop"
w.restart = "/etc/init.d/apache2 restart"
w.start_grace = 10.seconds
w.restart_grace = 10.seconds
<VirtualHost *:80>
ServerName limitedpressing.com
ServerAlias www.limitedpressing.com
DocumentRoot /var/www/apps/limitedpressing/current/public
<Directory /var/www/apps/limitedpressing/current/public>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all