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 Numeric | |
def multiple_of?(*numbers) | |
zero? || numbers.all? { |n| n.nonzero? && modulo(n).zero? } | |
end | |
end | |
if $0 == __FILE__ | |
require 'test/unit' | |
class MultipleOfTest < Test::Unit::TestCase |
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
Process: VLC [15477] | |
Path: /Applications/VLC.app/Contents/MacOS/VLC | |
Identifier: org.videolan.vlc | |
Version: 1.3.0-git (1.3.0-git) | |
Code Type: X86-64 (Native) | |
Parent Process: launchd [108] | |
Date/Time: 2011-12-23 01:11:11.538 +0100 | |
OS Version: Mac OS X 10.7.2 (11C74) | |
Report Version: 9 |
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
#!/bin/bash | |
file=$1 | |
filename=$(basename "$file") | |
tmp_filename=${filename%.coffee}.$RANDOM.js | |
out="/tmp/$tmp_filename" | |
coffee -s -c < "$file" > "$out" || exit 1 | |
"$EDITOR" "$out" && rm -f "$out" |
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
const crypto = require('crypto'); | |
const PASSWORD = "098f6bcd4621d373cade4e832627b4f6" | |
, MESSAGE = 'test'; | |
function InvalidSignatureError() { | |
Error.captureStackTrace(this, this.constructor); | |
} | |
function encipher(message, password, callback) { |
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
Misplaced "ensures" in sample code from: | |
http://railsware.com/blog/2012/11/20/yield-gotcha-in-ruby-blocks/ | |
Always be careful when adding "ensure" statements. Variables used within its | |
block may not have been assigned if an exception is raised within the "begin" | |
block. In fact, this mistake is often the result of not bothering with a "begin" | |
statement altogether |
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 onOpen() { | |
SpreadsheetApp.getActiveSpreadsheet().addMenu("Update", [ | |
{name: "Prices", functionName: "updatePrices"} | |
]); | |
} | |
function updatePrices() { | |
var sheet = SpreadsheetApp.getActiveSheet(); | |
var cell = sheet.getRange('D2'); | |
while (/^...\/...$/.test(cell.getValue())) { |
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 bash | |
guard_pids() { | |
ps ax | egrep ' guard (master|worker)' | while read pid _; do | |
echo $pid | |
done | |
} | |
kill_guard() { | |
pids=$(guard_pids) |
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 bash | |
exec coffee -cs < "$1" > /dev/null |
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 url = 'http://www.unicreditbank.si/tecajna_lista/?t=1&id_menu=&language=ENG'; | |
var rate = UrlFetchApp.fetch(url).getContentText().replace(/\s+/g, '').match(/>USD<\/td.*?>1,.*?>(1,\d+)/)[1]; |