How to run examples:
- Run $ createdb nplusonedb to create DB
- Run specs $ rspec demo.rb
How to run examples:
func main() { | |
s := time.Now() | |
args := os.Args[1:] | |
if len(args) != 6 { // for format LogExtractor.exe -f "From Time" -t "To Time" -i "Log file directory location" | |
fmt.Println("Please give proper command line arguments") | |
return | |
} | |
startTimeArg := args[1] | |
finishTimeArg := args[3] |
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789@#$%^&*()"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}' | |
# Binary version | |
echo -e "\e[1;40m" ; clear ; while :; do echo $LINES $COLUMNS $(( $RANDOM % $COLUMNS)) $(( $RANDOM % 72 )) ;sleep 0.05; done|awk '{ letters="00100001100100011101011111101110110010110110011000011000011110010101000"; c=$4; letter=substr(letters,c,1);a[$3]=0;for (x in a) {o=a[x];a[x]=a[x]+1; printf "\033[%s;%sH\033[2;32m%s",o,x,letter; printf "\033[%s;%sH\033[1;37m%s\033[0;0H",a[x],x,letter;if (a[x] >= $1) { a[x]=0; } }}' |
Picking the right architecture = Picking the right battles + Managing trade-offs
# taken from https://mrbrdo.wordpress.com/2013/09/25/manually-preloading-associations-in-rails-using-custom-scopessql/ | |
# collection association e.g. has_many | |
owners = People.all | |
association_name = :photos | |
owners.each do |owner| | |
records = Array(whatever_you_want) | |
rvm --create ree@benchmarks |
require 'bundler/setup' | |
require 'active_record' | |
include ActiveRecord::Tasks | |
db_dir = File.expand_path('../db', __FILE__) | |
config_dir = File.expand_path('../config', __FILE__) | |
DatabaseTasks.env = ENV['ENV'] || 'development' |
# Activate the gem you are reporting the issue against. | |
gem 'activerecord' | |
require 'active_record' | |
require 'minitest/autorun' | |
require 'logger' | |
# Ensure backward compatibility with Minitest 4 | |
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test) | |
# This connection will do for database-independent bug reports. |
This runs a build for a small elixir (phoenix) project in about 40 seconds by caching as much of the compiled files as possible.
We've been using this for months in multiple projects without any issues. Please ping be if there is any issues with this script and I'll update it.
It should be generic enough to work on any elixir app using mix.
If you have a elixir_buildpack.config
, then enable that section in the build script to keep versions in sync!
2016-08-09: Updated to newer Erlang and Elixir and fixed curl command.