-
liblinear-ruby: Ruby interface to LIBLINEAR using SWIG
-
classifier-reborn: Bayesian and LSI classification
dependencies: GSL
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
# Rails.root/config.ru | |
require "./config/environment" | |
run ActionController::Dispatcher.new |
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 User Observer | |
def after_touch(user) | |
user.run_callbacks :save | |
end |
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
What's new in Ruby on Rails 4 | |
A RoR 4 press review | |
Silvio Relli @ Florence On Ruby | |
Bibliography and related resources | |
1) Rails queue | |
http://reefpoints.dockyard.com/ruby/2012/06/25/rails-4-sneak-peek-queueing.html | |
http://blog.remarkablelabs.com/2012/12/rails-queue-rails-4-countdown-to-2013 | |
https://github.com/rails/rails/commit/adff4a706a5d7ad18ef05303461e1a0d848bd662 |
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
array_and = (ary1, ary2) -> | |
result = [] | |
seen = {} | |
i = 0 | |
length = ary1.length | |
while i < length | |
item = ary1[i] | |
unless seen[item] | |
j = 0 | |
length2 = ary2.length |
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
brew install apple-gcc42 openssl libyaml libffi | |
xcode-select --install | |
export CC=/usr/local/bin/gcc-4.2 | |
export CFLAGS='-g -O2' | |
export RUBY_CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` | |
export CONFIGURE_OPTS=--with-openssl-dir=`brew --prefix openssl` | |
rbenv install 1.8.7-p375 |
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
function party_background_color() { | |
$("html, body").css("background-color", getRandomColor()); | |
var all = document.getElementsByTagName("*"); | |
for (var i = 0, max = all.length; i < max; i++) { | |
$(all[i]).css("color", getRandomColor()); | |
$(all[i]).css("background-color", getRandomColor()); | |
} | |
} | |
function getRandomColor() { |
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
#!/bin/sh | |
if [ $# -ne 2 ]; then | |
echo "Usage: $(basename $0) <heroku-app-name> <local_database_name>" | |
exit -1 | |
fi | |
if heroku pg:backups capture --app $1 ; then | |
if curl -o latest.dump `heroku pg:backups public-url --app $1` ; then | |
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $USER -d $2 latest.dump |
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
class ApplicationController < ActionController::Base | |
protect_from_forgery with: :exception | |
around_action :global_request_logging | |
def global_request_logging | |
http_request_header_keys = request.headers.env.keys.select{|header_name| header_name.match("^HTTP.*|^X-User.*")} | |
http_request_headers = request.headers.env.select{|header_name, header_value| http_request_header_keys.index(header_name)} | |
puts '*' * 40 | |
pp request.method |
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
def paginate(scope, default_per_page = 20) | |
collection = scope.page(params[:page]).per((params[:per_page] || default_per_page).to_i) | |
current, total, per_page = collection.current_page, collection.num_pages, collection.limit_value | |
return [{ | |
pagination: { | |
current: current, | |
previous: (current > 1 ? (current - 1) : nil), | |
next: (current == total ? nil : (current + 1)), |
OlderNewer