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($) { | |
$.fn.highlight = function(options) { | |
var $el = $("<div></div>"), | |
delay = (options && options["delay"]) || 0; | |
var container = $(this)[0]; | |
if ($(this).parents("table").length) { | |
container = $(this).parents("table")[0]; | |
} |
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
namespace :i18n do | |
task en_bork: :environment do | |
I18n.locale = :en | |
en = I18n.t(".").except(:faker) | |
chef = replace_values!(en) do |val| | |
`echo #{val.inspect} | chef`.chomp.sub(/\s*Bork Bork Bork!/m, "") | |
end | |
File.open(Rails.root + "config/locales/en-bork.yml", "w") do |fd| |
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 ruby | |
require 'base64' | |
require 'tempfile' | |
min, max = ARGV.map{|v| v.to_i} | |
raise "#{__FILE__} MIN MAX" unless min && max && min > 0 && min < max | |
MESSAGES = ["rechtop zitten!", "schouders naar achteren!", "stapelen!", "water drinken!"] |
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
(defn detect-keyboard-on-screen! | |
"Try to detect keyboard going on and off screen and toggle class on | |
the element when applicable." | |
[el class] | |
(let [former-height (atom (.-innerHeight js/window))] | |
(.addEventListener | |
js/window "resize" | |
#(let [focus (.-activeElement js/document) | |
height (.-innerHeight js/window)] | |
(gclasses/enable el class |
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
(defn draw-image [canvas img orientation] | |
(let [ctx (.getContext canvas "2d") | |
[width height] (.-width img) (.-height img)] | |
(case orientation | |
(1 nil) ; left top | |
(do | |
(set! (.-width canvas) width) | |
(set! (.-height canvas) height) | |
(.drawImage ctx img 0 0 width height)) |
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
;;; Twit.el --- interface with twitter.com | |
;; Copyright (c) 2007 Theron Tlax | |
;; (c) 2008 Jonathan Arkell | |
;; Time-stamp: <2007-03-19 18:33:17 thorne> | |
;; Author: thorne <thorne@timbral.net>, jonnay <jonnay@jonnay.net> | |
;; Created: 2007.3.16 | |
;; Keywords: comm | |
;; Favorite Poet: E. E. Cummings |
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
javascript:(function(){var%20d=document;t=d.createElement(%22style%22);t.appendChild(d.createTextNode(%22*{line-height:2}%22));d.getElementsByTagName(%22head%22)[0].appendChild(t)})(); |
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
;; Font zooming with Hyper--/=/0 for Mac | |
;; Inspired by: http://www.emacswiki.org/cgi-bin/wiki/CycleFontSizes | |
(defconst font-zoom-list | |
(mapcar (lambda (n) (format "-*-monaco-*-*-*-*-%d-*-*-*-*-*-*-*" n)) '(6 8 10 13 17 18 24 36 48))) | |
(defconst default-font-zoom-index 3) | |
(defvar font-zoom-index default-font-zoom-index) | |
(defun font-zoom-increase-font-size () |
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
--- a/app/controllers/security.rb | |
+++ b/app/controllers/security.rb | |
@@ -10,7 +10,7 @@ module Security | |
# Ensure somebody is logged in. Takes the same options as | |
# +before_filter+. | |
def authenticate(options = {}) | |
- before_filter options.dup { |controller| controller.send(:authenticate) } | |
+ before_filter(options.dup) { |controller| controller.send(:authenticate) } | |
end |
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
# Methods to validate dutch social security numbers | |
# (burgerservicenummer) and back account numbers | |
# (bankrekeningnummers) using the "elf proef". | |
module ElfProef | |
def valid_burgerservicenummer?(val) | |
num = val.to_s.scan(/\d/).join.to_i | |
return false if num == 0 | |
digits = ("%09d" % num).split(//).map(&:to_i).reverse | |
return false unless digits.size == 9 |
OlderNewer