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
Rails.application.routes.draw do | |
get '/(:locale)/products/(:category)/(page/:page).:extension', | |
:to => 'products#index', | |
:as => :products, | |
:constraints => { | |
:locale => /[a-z]{2}/, | |
:category => /.+?/, | |
:page => /\d+/ | |
}, |
This is just an exercise to measure the performance between Sinatra-like libraries in:
-
Elixir v0.4.dev (running on top of the Erlang VM R14B03) with Dynamo;
-
Ruby 1.9.2 with [Sinatra Synchrony] v0.0.3 (https://github.com/kyledrake/sinatra-synchrony) + Thin;
-
node.js 0.4.7 with [express] v2.3.10(https://github.com/visionmedia/express)
This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.
You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf
using homebrew.
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 'csv' | |
class Exporter | |
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ] | |
DESTINATION_FOLDER = "tmp/" | |
def self.export_tables_to_csv(tables = DEFAULT_EXPORT_TABLES) | |
tables.each { |klass| export_table_to_csv(klass) } | |
end |
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
class PostsController < ActionController::Base | |
def create | |
Post.create(post_params) | |
end | |
def update | |
Post.find(params[:id]).update_attributes!(post_params) | |
end | |
private |
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
class ApplicationController < ActionController::Base | |
extend AttributeViewable | |
end |
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://raw.github.com/gist/2108403/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
<!-- path: app/views/refinery/admin/pages/_actions.html.erb --> | |
<!-- | |
You could override this view, if you want to add links to each page type via the admin UI. If you don't you'll have to add a param the the URL. | |
WARNING: You most probably want to do it cleaner than that and find a way to hook to this view instead of overriding it if at all possible. | |
--> | |
<ul> | |
<li> | |
<%= render '/refinery/admin/search', :url => refinery.admin_pages_path %> | |
</li> |
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 rev-parse HEAD | tr -d '\n' | pbcopy |
OlderNewer