Test
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
| def doRummbleMethod(method, queryString) | |
| consumer = OAuth::Consumer.new(API_KEY, API_SECRET, { :site => "http://api.rummble.com", :request_token_url => "http://www.rummble.com/oauth/request_token", :access_token_url => "http://www.rummble.com/oauth/access_token", :authorize_url => "http://www.rummble.com/oauth/authorize" }) | |
| paramsString = "" | |
| if queryString.size > 0 | |
| queryString.to_a.collect {|key, value| paramsString << "#{key}=#{value}&"} | |
| paramsString[paramsString.length - 1] = '' #remove last & | |
| end | |
| returnObj = consumer.request(:get, "/?method=#{method}&#{paramsString}", nil, {:scheme => :query_string}) | |
| returnObj.body | |
| end |
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
| file='/Users/callumj/Desktop/test.txt' | |
| f = File.open(file, "r") | |
| f.each_line { |line| | |
| if !line.downcase.include?("total") | |
| randomval = rand(500) | |
| print "#{line[0,line.rindex(',')]},#{randomval}\r\n" | |
| end | |
| } | |
| f.close |
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
| def generate_store_data | |
| results = {} | |
| results[:combo_meal_exclusions] = {} | |
| results[:combo_meal_promotion] = {} | |
| for year in 2005..2010 do | |
| results[:combo_meal_exclusions][year.to_s] = {} | |
| results[:combo_meal_promotion][year.to_s] = {} | |
| for store_num in 1..22 do | |
| results[:combo_meal_exclusions][year.to_s]["Store #{store_num}"] = [] | |
| for num_exclusions in 0..rand(3) do |
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
| class String | |
| def is_header?() | |
| return self.strip.match(/(===)(.+)(===)/) | |
| end | |
| def header() | |
| match_data = self.strip.match(/(===)(.+)(===)/) | |
| return match_data[2].strip | |
| end | |
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
| require 'nokogiri' | |
| require 'open-uri' | |
| root_path = "http://undergraduate.csse.uwa.edu.au/units/CITS3230" | |
| Nokogiri::HTML(open("#{root_path}/schedule.html")).css('a').each { |link| File.open("#{Dir.home}/#{File.basename(link['href'])}", 'wb') {|f| f.write(open("#{root_path}/#{link['href']}").read()) } if link['href'] =~ /\b.+.pdf/ } |
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
| file_p = File.open(ARGV[0]) | |
| lines = file_p.readlines | |
| file_p.close | |
| lines.each do |line| | |
| match_data = line.strip.match(/".+(n[0-9]+)_(.+)[.]log",(.+)/) | |
| if match_data != nil | |
| puts "#{match_data[2]}_#{match_data[1]},#{match_data[3]}" | |
| else |
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
| datevar=$(date +%s) | |
| echo $datevar | |
| mkdir -p ~/Builds/$datevar | |
| cp -R $CODESIGNING_FOLDER_PATH/.. ~/Builds/$datevar | |
| ################ | |
| #Place this into your Run Script phase in your Project Settings > Target > Build Phases > Add Build Phases |
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
| require 'uri' | |
| require 'net/http' | |
| require 'fileutils' | |
| BASE = "http://openclassroom.stanford.edu/MainFolder/courses/HCI/videos/" | |
| for l in 1..42 do | |
| for p in 1..20 do | |
| uri = "CS147L" + l.to_s + "P" + p.to_s + ".flv" |
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
| require 'net/http' | |
| require 'json' | |
| require 'sqlite3' | |
| DB_LOC = "#{File.dirname(__FILE__)}/data.db" | |
| URL_PARSE = "http://www.is.uwa.edu.au/site_elements/labstats-remote.json/_nocache" | |
| SUCCESS_SLEEP = 30 # 30 min | |
| FAIL_SLEEP = 1 # 1 min | |
OlderNewer