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
path_to_log = File.join(File.dirname(__FILE__),'cron_output.log') | |
File.open(path_to_log, 'w'){ |file| file << "I was last run at #{Time.now}" } |
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
<state name="Alabama"> | |
<city name="Abbeville" number="1"/> | |
<city name="Adamsville" number="1"/> | |
<city name="Addison" number="1"/> | |
<city name="Akron" number="2"/> | |
</state> |
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
module Sullivans | |
class UserActor | |
include Celluloid | |
include Celluloid::Notifications | |
include Celluloid::Logger | |
def initialize(socket) | |
# Subscribe to conversations | |
info "Started a client" |
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 'open-uri' | |
require 'nokogiri' | |
require 'csv' | |
####################################### | |
# | |
# PHASE ONE: PAGE FETCHING | |
# | |
####################################### |
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
// Fetch and append the current temperature | |
function fetchAndAppendWeather() { | |
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); | |
var sheet = spreadsheet.getActiveSheet(); | |
// All the actual work is done in the top row. | |
// We get the link stored in cell A1 | |
var weatherLink = sheet.getRange("A1").getValue(); | |
// we set a formula importing a targeted portion of the web page |
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
# <= this hash sign. Hash signs are used to start comments. | |
# Anything that starts with a hash will be instructions or descriptions. | |
# Different programming languages/environments will use different | |
# characters to start comments. | |
# Bash (what your shell uses, happens to use the hash mark) | |
# comments run from the hash mark to the end of the line. | |
# So, one can issue a command, and add a comment after it like so: | |
ls # this is a command we will explain below |
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
n = 50000; | |
Benchmark.bm(15) do |x| | |
x.report("Array Include:"){ n.times{ foo = 5; arr = [1,2,3,4,5]; arr.include? foo }} | |
x.report("Array access:"){ n.times{ foo = 5; arr = [1,2,3,4,5]; foo == arr[0] || foo == arr[1] || foo == arr[2] || foo == arr[3] || foo == arr[4] } } | |
x.report("Array Alloc:"){ n.times{ foo = 5; arr = [1,2,3,4,5]; foo == 1 || foo == 2 || foo == 3 || foo == 4 || foo == 5 } } | |
x.report("Just Ors:"){ n.times{foo = 5; foo == 1 || foo == 2 || foo == 3 || foo == 4 || foo == 5 }} | |
end | |
n = 50000; | |
foo = 1 |
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
# Usage: | |
# The following will create 5 randomized cards from the lines of gawkerbingo.txt: | |
# ruby bingorunner.rb 5 | |
require './gawkerbingo.rb' | |
number_of_cards = ARGV.first.to_i | |
CreateCards.new(number_of_cards) |
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
# Sensitive API keys and other secret strings. | |
defaults : &defaults | |
aws_access_key: string_goes_here | |
aws_secret_key: string_goes_here | |
calais_license: string_goes_here | |
smtp_password: string_goes_here | |
pixel_ping: string_goes_here | |
guest_username: string_goes_here | |
guest_password: string_goes_here |
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
var test = Backbone.Model.extend({ | |
var1 : [], | |
initialize : function(obj) { | |
this.var1.push("1") | |
console.log(this.var1.length, this.cid) | |
} | |
}); | |
var x = (new test); |