Skip to content

Instantly share code, notes, and snippets.

View ericboehs's full-sized avatar

Eric Boehs ericboehs

  • Oddball
  • Enid, OK
  • 03:49 (UTC -05:00)
View GitHub Profile
sudo su postgres
createdb template_postgis15 -U postgres
cd /usr/share/pgsql/contrib/postgis-1.5
psql -d template_postgis15 -U postgres -c "CREATE LANGUAGE plpgsql"
psql -d template_postgis15 -U postgres -f postgis.sql
psql -d template_postgis15 -U postgres -f spatial_ref_sys.sql
exit
sudo su postgres
psql -d template_postgis15
SELECT postgis_full_version();
\q
exit
POSTGIS="1.5.1" GEOS="3.2.0-CAPI-1.6.0" PROJ="Rel. 4.7.1, 23 September 2009" LIBXML="2.7.7" USE_STATS
<?php
/**
* This class calls the bitly.pro RESTful API for our short domain wim.gs. It
* provides shorten, info and stas calls.
*
* @link http://bit.ly/apidocs
* @package urlShortener
* @author Eric Boehs
**/
class Feed < ActiveRecord::Base
def self.check_livescores(interval="30", duration="60")
how_many = duration.to_i / interval.to_i
@feeds = Feed.find(:all, :conditions => ['path LIKE ? OR path LIKE ?', '%livescores%', '%in-progress-boxscores%' ])
@feeds.each do |feed|
how_many.times do |i|
Delayed::Job.enqueue(AtomChecker.new(feed.id, :priority => 3), 4, (i*interval).seconds.from_now)
end
end
end
class Sale < ActiveRecord::Base
belongs_to :user
belongs_to :deal
has_many :coupons
end
class Deal < ActiveRecord::Base
has_many :sales
@ericboehs
ericboehs / lighter
Created November 13, 2010 00:12 — forked from jnunemaker/lighter.rb
#!/usr/bin/env ruby
#############################################################
# Lighter -- Campfire from the command line #
# #
# Installation: #
# gem install tinder #
# chmod +x lighter #
# #
# Usage: #
@ericboehs
ericboehs / Xbox Live Push Notifications for Ruby
Created December 9, 2010 23:09
Sends push notifications to boxcar when an Xbox Live friend signs online.
#!/usr/bin/env ruby
require 'open-uri'
require 'nokogiri'
require 'cgi'
require 'httparty'
user_statuses = Hash.new
file = "/tmp/xbox_live_user_statuses.yml"
db = YAML::load(File.open(file)) if File::exists?(file)
@ericboehs
ericboehs / to_slug.rb
Created February 1, 2011 21:09
This extends ruby's string class and adds a to_slug method
# coding: utf-8
class String # This reopns the string class
# Define a new method to convert the string to be url friendly
def to_slug
# This is the input as there are no arguments passed.
string = self
# Define which accents map to which ascii characters
accents = {
['á','à','â','ä','ã','å'] => 'a',
@ericboehs
ericboehs / test_generator.rb
Created February 2, 2011 05:10
Created my tests for my accents to_slug gem
# Define which accents map to which ascii characters
accents = {
'A' => %w(À Á Â Ã Ā Ă Ȧ Ả Ä Å Ǎ Ȁ Ȃ Ą Ạ Ḁ Ầ Ấ Ẫ Ẩ Ằ Ắ Ẵ Ẳ Ǡ Ǟ Ǻ Ậ Ặ),
'AE' => %w(Æ Ǽ Ǣ),
'B' => %w(ḂƁ Ḅ Ḇ Ƃ Ƅ),
'C' => %w(C Ć Ĉ Ċ Č Ƈ Ç Ḉ),
'D' => %w(D Ḋ Ɗ Ḍ Ḏ Ḑ Ḓ Ď Đ Ɖ Ƌ),
'E' => %w(È É Ê Ẽ Ē Ĕ Ė Ë Ẻ Ě Ȅ Ȇ Ẹ Ȩ Ę Ḙ Ḛ Ề Ế Ễ Ể Ḕ Ḗ Ệ Ḝ Ǝ Ɛ),
'F' => %w(Ḟ Ƒ),
'G' => %w(Ǵ Ĝ Ḡ Ğ Ġ Ǧ Ɠ Ģ Ǥ),