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
# Extract multiple rar files in subdirs from torrent files | |
# | |
# it doesn't extract files that have been previously. Always run the script file in | |
# the same dir as extrected.list, since it store path | |
# | |
# 1. ls **/*.rar - look up to any rar files in sub dirs | |
# 2. ignores all files that matches ones in the extracted.lst file | |
# 3. appends the non-extracted files to the lst file | |
# 4. for each rar file, extract them in the current directory | |
# |
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
Redis.new.tap { |redis| | |
["resque:delayed*", "resque:resque-retry*", "resque:failure_resque-retry*"].map { |rk| | |
redis.keys(rk).map { |k| redis.del(k) } | |
} | |
} |
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>YUI Snippet</title> | |
<link rel="stylesheet" href="http://rawgithub.com/necolas/normalize.css/master/normalize.css"> | |
<script src="http://rawgithub.com/LeaVerou/prefixfree/gh-pages/prefixfree.min.js"></script> | |
</head> | |
<body> | |
<div id="container"></div> |
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 'pp' | |
require 'benchmark' | |
# compute all possible expressions to the given string of digits to a given set of operations. | |
# the digits are kept in order | |
# | |
# ex. 1234 | |
# generates: 1234, 1+234, 1-234, 12+34, 123-4... | |
# | |
# but selects only expressions that evaluate to a given value |
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
;;; Replace entity with the schema | |
{:find [...] | |
:in [...] | |
:where [...]} | |
;;; eav | |
[?e ?a ?v ?tx] | |
;;; txInstant |
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
source "https://rubygems.org" | |
gem "mongo", "~> 1.8.2" | |
gem "bson_ext", "~> 1.8.2" | |
gem "actionpack", "~> 3.2.12" |
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
# Since Mongoid switched to its own driver, many of the mongo API | |
# (available in mongo-ruby-drive) are missing. This is allows you | |
# to rename a collection thru command message. | |
# | |
# Be aware that the API constantly changes in mongoid | |
# | |
# Mongoid (3.1.0), Moped (1.4.2) | |
class MyModel | |
include Mongoid::Document |
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> |
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
(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))) |