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 user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.20 (KHTML, like Gecko) Chrome/19.0.1036.7 Safari/535.20'; | |
var Browser = require("zombie"); | |
var browser = new Browser({userAgent: user_agent, debug: true, waitFor: 10000}); | |
var url = 'https://accounts.google.com/ServiceLoginAuth'; | |
var login = 'foo@gmail.com'; | |
var password = 'foo'; | |
browser.visit(url, function() { |
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
class @PollingQueue | |
constructor: (opts) -> | |
opts || (opts = {}) | |
@queue = {} | |
@frequency = opts.frequency || 3000 # 3 seconds | |
@interval = undefined | |
add: (url, options = {}) -> | |
return unless url |
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
class @StatusPollingQueue | |
constructor: () -> | |
@queue = [] | |
@frequency = 3 * 1000 # 3 seconds | |
@interval = undefined | |
@failureLimit = 50 | |
add: (url, options = {}) -> | |
return unless url |
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
class @PollingQueue | |
constructor: () -> | |
@queue = [] | |
@frequency = 3000 # 3 seconds | |
@interval = undefined | |
@failureLimit = 50 | |
add: (url, options = {}) -> | |
return unless url |
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
bucket = 'intergi-phoenix' | |
files = S3Util.storage.directories.get(bucket, prefix: '12917/videos/').files | |
files.each do |file| | |
path = file.key | |
video_id = path[/videos\/(\d+)\//, 1].to_i | |
if video_id < 3270839 | |
puts "skip #{video_id}" | |
next |
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
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1/" | |
} | |
export BRANCH_INFO='$(parse_git_branch)' | |
export CURRENT_BRANCH='$BRANCH_INFO' | |
export PS1="\[\033[00;32m\]\u\[\033[01m\]@\[\033[00;36m\]\h\[\033[01m\] \! \[\033[00;35m\]\w\[\033[00m\]\[\033[00m\] ($BRANCH_INFO)\$ " |
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
use CGI; | |
my $q = CGI->new; | |
$to_host = 'https://www1.udel.edu'; | |
$url = $ENV{'REDIRECT_URL'}; | |
$url =~ s/^https?:\/\/[^\/]+//g; | |
print $q->redirect($to_host . $url); |
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 'minitest/autorun' | |
class BerlinClock | |
def self.seconds(seconds) | |
seconds.even? ? 'Y' : 'O' | |
end | |
def self.minutes(minutes) | |
row1 = Array.new(11, 'O').unshift(['Y'] * (minutes / 5)).flatten.first(11) |
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 'minitest/autorun' | |
class Integer | |
# rules: | |
# - Si a la derecha de una cifra romana de escribe otra igual o menor, el valor de ésta se suma a la anterior. | |
# - La cifra "I" colocada delante de la "V" o la "X", les resta una unidad; la "X", precediendo a la "L" o a la "C", les resta diez unidades y la "C", delante de la "D" o la "M", les resta cien unidades. | |
# - En ningún número se puede poner una misma letra más de tres veces seguidas. En la antigüedad se ve a veces la "I" o la "X" hasta cuatro veces seguidas. | |
# - La "V", la "L" y la "D" no pueden duplicarse porque otras letras ("X", "C", "M") representan su valor duplicado. | |
# - Si entre dos cifras cualesquiera existe otra menor, ésta restará su valor a la siguiente. |
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 'minitest/autorun' | |
def primes(input) | |
out, curr_div = [], 2 | |
begin | |
div, mod = input.divmod(curr_div) | |
if mod.zero? | |
out << curr_div | |
input = div | |
else |
NewerOlder