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
| #inside RSpec.configure | |
| config.before :all do | |
| SunspotTest.stub | |
| end | |
| config.before(:all, search: true) do | |
| SunspotTest.setup_solr | |
| Sunspot.remove_all! | |
| Sunspot.commit |
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
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
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
| package main | |
| import ( | |
| "fmt" | |
| "io" | |
| "io/ioutil" | |
| "log" | |
| "code.google.com/p/go.crypto/ssh" | |
| "code.google.com/p/go.crypto/ssh/terminal" |
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
| CREATE OR REPLACE FUNCTION hstore_merge(left HSTORE, right HSTORE) RETURNS HSTORE AS $$ | |
| SELECT $1 || $2; | |
| $$ LANGUAGE SQL; | |
| CREATE AGGREGATE hstore_merge (HSTORE) ( | |
| SFUNC = hstore_merge, | |
| STYPE = HSTORE, | |
| INITCOND = '' | |
| ); |
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
| (defn loud-numbers | |
| [] | |
| (take 10 (iterate (fn [x] (println "I'm adding to " x) (inc x)) 0))) | |
| (defn less-lazy | |
| [coll] | |
| (lazy-seq | |
| (future (second coll)) | |
| (cons (first coll) (less-lazy (rest coll))))) |
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
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
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
| // TRY HARD SHIT. | |
| // I did and I'm learning a lot. | |
| // | |
| // 2 days ago I had no idea what I was doing but I decided I was going to create | |
| // a database. I figured this would be a great way to learn even more about the | |
| // databases I use today. I will write better software because I will know how they are | |
| // designed and the optimizations and limitations they have to work with. | |
| // | |
| // After two days I have: | |
| // - Modelled column based data model (like Cassandra) on top of a key/value store (SQLite4 does I think). |
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
| (ns katas.change-maker) | |
| (defn num-pairs | |
| "Returns all combinations of [x y] and (<= x y) where (= cents (+ x y))" | |
| [cents] | |
| (for [x (range 1 cents) | |
| :let [y (- cents x)] | |
| :when (<= x y)] | |
| [x y])) |
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
| (ns katas.change-maker) | |
| (defn num-pairs | |
| "Returns all combinations of [x y] and (<= x y) where (= cents (+ x y))" | |
| [cents] | |
| (for [x (reverse (range 1 (inc (quot cents 2)))) ;; use the range from midpoint to 1 so that we walk the | |
| ;; shortest side of the tree first | |
| :let [y (- cents x)]] | |
| [x y])) |
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
| ######################################### | |
| ### Install wget-ssl over ipkg's wget ### | |
| ######################################### | |
| $ ipkg install -verbose_wget libidn # To get ipk URL | |
| $ ipkg install -verbose_wget wget-ssl # To get ipk URL | |
| $ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/libidn_1.25-1_i686.ipk | |
| $ /usr/syno/bin/wget http://ipkg.nslu2-linux.org/feeds/optware/syno-i686/cross/unstable/wget-ssl_1.12-2_i686.ipk | |
| $ ipkg install libidn_1.25-1_i686.ipk | |
| $ ipkg install wget-ssl_1.12-2_i686.ipk |