This file contains 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
select * from information_schema.tables where table_schema='public' and table_type='BASE TABLE'; |
This file contains 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
# helper method to paginate a non ActiveRecord collection like a Array | |
def paginate_collection(collection, opts = {}) | |
opts[:per_page] ||= 20 | |
opts[:page] ||= 1 | |
opts[:page] = opts[:page].to_i | |
opts[:per_page] = opts[:per_page].to_i | |
returning WillPaginate::Collection.new( opts[:page], opts[:per_page], collection.size ) do |pager| | |
start = (opts[:page]-1) * opts[:per_page] | |
finish = start + opts[:per_page] | |
pager.replace collection[ start...finish ] |
This file contains 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
def disable_geocoding | |
GeoKit::Geocoders::Geocoder.instance_eval do | |
def geocode(a) | |
res = GeoKit::GeoLoc.new | |
res.lat = 13.423007 | |
res.lng = 52.534194 | |
res.success = true | |
res | |
end | |
end |
This file contains 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
require 'rubygems' | |
require 'hpricot' | |
require 'net/http' | |
HOST = "gdata.youtube.com" | |
SITE = "/feeds/api" | |
def parse_duration(xml) | |
result = 0 | |
(xml/'entry').each do |entry| |
This file contains 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
require 'rubygems' | |
require 'hpricot' | |
require 'net/http' | |
HOST = "gdata.youtube.com" | |
SITE = "/feeds/api" | |
def tags(youtubeid) | |
request = Net::HTTP::Get.new("#{SITE}/videos?q=#{youtubeid}&safeSearch=none") | |
request.add_field 'GData-Version', '2' |
This file contains 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
require 'rubygems' | |
require 'hpricot' | |
require 'net/http' | |
HOST = "gdata.youtube.com" | |
SITE = "/feeds/api" | |
def upload_time(youtubeid) | |
request = Net::HTTP::Get.new("#{SITE}/videos?q=#{youtubeid}&safeSearch=none") | |
request.add_field 'GData-Version', '2' |
This file contains 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
#http://ws.audioscrobbler.com/2.0/?method=artist.getsimilar&artist=cher&api_key=b25b959554ed76058ac220b7b2e0a026 | |
require 'rubygems' | |
require 'hpricot' | |
require 'net/http' | |
HOST = "ws.audioscrobbler.com" | |
SITE = "/2.0" | |
def get_similar_artists(artist) |
This file contains 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
#!/usr/bin/env ruby | |
#TODO | |
# find all files not in project file | |
# => list these files | |
globalsfile = "Classes/Globals.h" | |
allfiles = `git ls-files`.split(/\n/) | |
#allfiles.each{|f| f.gsub!(/\"/, "")} #not needed when files have no unicode chars inf filenames |
This file contains 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de"> | |
<head> | |
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> | |
<title>test_change_link</title> | |
<script type="text/javascript" language="javascript"> | |
// <![CDATA[ |
OlderNewer