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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>postMessage</title> | |
</head> | |
<body> | |
<div id="container"> | |
iFrame | |
<button>post message</button> |
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
describe "job failures" do | |
it 'retries with limited attempts' do | |
require 'resque/failure/redis' | |
Resque.unstub(:enqueue) | |
Resque::Failure::MultipleWithRetrySuppression.classes = [Resque::Failure::Redis] | |
Resque::Failure.backend = Resque::Failure::MultipleWithRetrySuppression | |
JobWithError = Class.new do | |
@queue = "test" |
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
.inline-block { | |
background: red; | |
margin-right: -4px; | |
} | |
.with-sidenote:after { | |
white-space: pre; | |
} |
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
/** | |
* Circular Tooltip (SO) | |
* http://stackoverflow.com/q/13132864/1397351 | |
*/ | |
* { margin: 0; padding: 0; } | |
body { | |
overflow: hidden; | |
background: url(http://theearlcarlson.com/experiments/amTooltip/img/bg.jpg); | |
} | |
/* generic styles for button & circular menu */ |
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
// transliterate (Char a) :: [a] -> [a] -> [a] -> [a] | |
var transliterate = function(from, to) { | |
var approximations = {}; | |
for (var i = 0, len = from.length; i < len; ++i) { | |
approximations[from.charAt(i)] = to.charAt(i); | |
} | |
return function(input) { | |
return input.replace(/[^\x00-\x7f]/g, function(char) { |
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 person = { name: "John" }; | |
window.name = "Paul"; | |
mediator.on("call-people", function() { | |
console.log(this.name); // print "Paul" | |
}); | |
mediator.on("call-people", function() { | |
console.log(this.name); // print "John" |
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
(def check-sum | |
(fn [sequence] | |
(apply + (map (fn [position digit] | |
(* digit (if (odd? position) 1 3))) | |
(range 1 (inc (count sequence))) | |
sequence)))) | |
(defn check-sum-upc [coll] | |
(apply + (map * | |
(take (count coll) (cycle '(1 3))) |
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 add-first-uniq [target coll] | |
(cond (not (contains? target (first coll))) | |
(conj target (first coll)) | |
:else | |
(add-first-uniq target (rest coll)))) | |
(reduce add-first-uniq | |
#{} | |
'((1 2 3) (1 2) (4 5))) |
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
; might not be the proper way to do it, but it is how I was able to run repl with some libraries | |
; in this case I created a lein project, add the monad dependency to the project, and then started | |
; a repl session, and run: | |
; | |
; need to include pomegranate | |
; | |
; it seems to be the best way to deal with it | |
; | |
(use '[cemerick.pomegranate :only (add-dependencies)]) | |
(add-dependencies :coordinates '[[org.clojure/algo.monads "0.1.4"]]) |
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
<style> | |
.yui3-overlay-hidden { | |
visibility: hidden; | |
} | |
</style> | |
<input type="text" id="input-date" /> | |
<div id="calendar-overlay"> | |
<div class="yui3-widget-bd" id="calendar"></div> |