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
| 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 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
| 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 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
| const crypto = require('crypto'); | |
| const PASSWORD = "098f6bcd4621d373cade4e832627b4f6" | |
| , MESSAGE = 'test'; | |
| function InvalidSignatureError() { | |
| Error.captureStackTrace(this, this.constructor); | |
| } | |
| function encipher(message, password, callback) { |
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
| #!/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 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
| 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 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 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 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 on_time_value | |
| attendances.inject(0) do |sum, attendance| | |
| sum + (attendance.late? ? 0 : 5) | |
| end | |
| 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
| # Minimalistic Mininova TV show browser with live search, written in Shoes. | |
| # | |
| # To run it, drop `minishoes.rb' onto `Shoes.app'. You should see something like | |
| # the screen capture at: | |
| # http://img4.imageshack.us/img4/106/minishows.png | |
| # | |
| require 'pathname' | |
| require 'hpricot' | |
| require 'open-uri' |
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
| # Portable monkey patch for reloading constants before hitting metal | |
| # applications. More details in the introduction article at: | |
| # | |
| # http://roman.flucti.com/reloading-rails-metal-applications | |
| # | |
| Rails::Rack::Metal.class_eval do | |
| # Prevent Metal from further require'ing source files, in order to let | |
| # AS::Dependencies handle constants. | |
| class << self |
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
| # This is an augmented version of the original `insert!'. In addition to the | |
| # original functionality, it allows for specifying: | |
| # | |
| # - :trigger_validation: whether to trigger validation after the record has | |
| # been instantiated. Default: false. | |
| # | |
| # - :inhibit_callbacks: whether to inhibit callbacks supposed to be triggered | |
| # after validation. Default: true. | |
| # | |
| # Also, now, any attribute can be assigned, regardless of their being declared |