% /path/to/reia/bin/leex calc_scan.xrl
% /path/to/reia/bin/yecc calc_parse.yrl
% erlc calc_scan.erl
% erlc calc_parse.erl
% erlc calc_eval.erl
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
myfun() -> | |
receive | |
{ello} -> | |
here I am... |
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
myfun() -> | |
receive | |
{ello} -> | |
here I am... |
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
# autoload concerns | |
module YourApp | |
class Application < Rails::Application | |
config.autoload_paths += %W( | |
#{config.root}/app/controllers/concerns | |
#{config.root}/app/models/concerns | |
) | |
end | |
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
# | |
# ActiveRecord SQL Logging on the Rails Console | |
# --------------------------------------------- | |
# | |
# Various blog posts out there show you how to log all SQL statements | |
# executed by ActiveRecord to STDOUT when you're in a Rails console: | |
# | |
# * http://robots.thoughtbot.com/post/159806033/irb-script-console-tips | |
# * http://weblog.jamisbuck.org/2007/1/8/watching-activerecord-do-it-s-thing | |
# * http://toolmantim.com/thoughts/system_wide_script_console_logging |
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
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com | |
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below) | |
module Player | |
describe MovieList, "with optional description" do | |
it "is pending example, so that you can write ones quickly" | |
it "is already working example that we want to suspend from failing temporarily" do | |
pending("working on another feature that temporarily breaks this one") |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 Jed Schmidt <http://jed.is> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
task 'run' => :environment do | |
RubyProf.start | |
Bullet.enable=true | |
Bullet.start_request | |
20.times do | |
r = Rating.limit(20).includes(:comment => :post).to_a | |
end | |
Bullet.end_request | |
results = RubyProf.stop |
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
-module(lists_vs_func_vs_comp). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0]). | |
test() -> | |
Seqs = lists:seq(0, 500000), | |
lists:foreach( | |
fun | |
({F, TargetName}) -> |
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
-module(keep_state). | |
-author('cooldaemon@gmail.com'). | |
-export([test/0]). | |
test() -> | |
keep_state_sup:start_link(), | |
{} = keep_state_server:get_state(), | |
keep_state_server:put_state(foo), | |
foo = keep_state_server:get_state(), |