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' | |
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | |
gem 'rails', '4.0.0' | |
# gem 'authority' | |
gem 'whenever', require: false | |
gem 'bitwise' | |
gem "aws-ses", "~> 0.5.0", :require => 'aws/ses' | |
gem 'closure_tree' | |
gem 'kaminari' |
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 sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://gist.github.com/johnrees/7581236/raw/hack.sh | sh | |
# |
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
if $('span[data-currency]').length > 0 | |
$.get '//query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.xchange%20where%20pair%20in%20(%22EURUSD%22%2C%20%22EURGBP%22%2C%20%22EURJPY%22)&format=json&diagnostics=true&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=', (result) -> | |
$('span[data-currency]').each -> | |
matches = $(this).data('currency').match(/(\d+) (.+)/) | |
amount = parseInt(matches[1]) | |
conversion = matches[2] | |
for conversions in result.query.results.rate | |
if conversion == conversions.Name | |
rate = conversions.Rate | |
return $(this).text Math.floor(amount * rate) |
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 'json' | |
require 'open-uri' | |
raw_json = open('http://api.smartcitizen.me/v0.0.1/ba997ab4b0e21eda08b3da4a7b60a628/646/posts.json?from_date=2014-02-06&to_date=2014-02-08').read | |
json = JSON.parse(raw_json) | |
File.open('posts.csv', 'w') do |file| | |
# write first line | |
file.puts json["device"]["posts"][0].keys.join(',') |
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
min = 2 | |
max = 100 | |
min.upto(max) do |count| | |
puts "k=#{count}" | |
a = (1..count).to_a | |
options = a.repeated_combination(count).to_a | |
for option in options.reverse |
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
git clone https://github.com/sstephenson/rbenv.git ~/.rbenv | |
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc | |
echo 'eval "$(rbenv init -)"' >> ~/.bashrc | |
source ~/.bashrc | |
git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build | |
rbenv install 2.1.5 | |
rbenv global 2.1.5 | |
ruby -v |
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
/coverage | |
*.todo |
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
#!/bin/bash | |
set -e | |
need_rails=1 | |
if [ $# -gt 0 ]; then # we have args | |
filename=$1 | |
# remove trailing line number from filename e.g. spec/my_spec.rb:33 | |
grep_filename=`echo $1 | sed 's/:.*$//g'` |
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
sudo apt-get update | |
mkdir -p /usr/local/java | |
cd /usr/local/java | |
wget http://www.reucon.com/cdn/java/jdk-7u76-linux-x64.tar.gz | |
tar xvzf jdk-7u76-linux-x64.tar.gz | |
vim /etc/profile | |
JAVA_HOME=/usr/local/java/jdk-7u76-linux-x64 | |
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin | |
JRE_HOME=/usr/local/java/jdk-7u76-linux-x64 | |
PATH=$PATH:$HOME/bin:$JRE_HOME/bin |
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
syntax: regexp | |
# files with special characters | |
[^\w.\-\/ ]+ | |
# banned extensions, still relatively flexible | |
(?i)^(.+)\.(db|php|php4|php5|swp|log|tmp|\d+)$ |