gem install rails
rails new my_app -T
| require "statistics" | |
| require "ishi" | |
| require "tablo" | |
| include Statistics::Distributions | |
| # Turns a named tuple into tabular representation | |
| def table(data : NamedTuple) | |
| Tablo::Table.new(data.map { |k, v| [k, v] }, header_frequency: nil) { |t| | |
| t.add_column("coefficient") { |n| n[0] } |
| Assume X-Y bounding box: [-1, 1]*[-1, 1] -> 2*2 size | |
| Orthographic camera scale: 2*sqrt(2)=2.82843 | |
| Camera X, Y: (1, 1) | |
| Camera Z: 2*sqrt(2)*tan(30deg)=1.63299 (<- looking at (-1, -1, 0) from (1, 1, Z)) | |
| Camera Rot: (60deg, 0deg, 135deg) |
| # Adapted from http://pfertyk.me/2016/11/crystal-in-real-life/ | |
| require "stumpy_png" | |
| canvas = StumpyPNG.read("image.png") | |
| canvas.width.times do |x| | |
| canvas.height.times do |y| | |
| color = canvas[x, y] | |
| class KittenMailer < ActionMailer::Base | |
| def mail *args | |
| attachments['cat.jpeg'] = open("http://placekitten.com/#{rand(300)+300}/#{rand(300)+300}").read | |
| super | |
| end | |
| end |
| This is what worked for me to install it on Squeeze 64-bit: | |
| $ sudo aptitude install libqt4-dev g++ libgpgme11-dev libgpg-error-dev libupnp-dev libssl-dev libgnome-keyring-dev libxss-dev gnupg-agent | |
| If this asks you to remove packages, DO NOT CONTINUE. The above line should only INSTALL packages. Fix your system first. | |
| $ wget http://sourceforge.net/projects/retroshare/files/RetroShare/0.5.3c/RetroShare-v0.5.3c.tar.gz/download | |
| $ tar xzvf RetroShare-v0.5.3c.tar.gz | |
| $ cd trunk/libbitdht/src | |
| $ qmake && make |
| #!/bin/bash | |
| # Change those for valid ones | |
| HOMEDIR=/home/yourlogin | |
| RUBYVER="1.9.2-p318" | |
| # Adding to $PATH paths for rvm and ruby executables | |
| PATH=$PATH:$HOMEDIR/.rvm/bin:$HOMEDIR/.rvm/rubies/ruby-$RUBYVER/bin/ | |
| # Creating variable containing path to installed gems | |
| RUBYLIB=$HOMEDIR/.rvm/gems/ruby-$RUBYVER/gems/:$HOMEDIR/.rvm/gems/ruby-$RUBYVER@global/gems/ |
| // FFmpeg settings for vimeo.com | |
| // ============================= | |
| // Trying to find the best settings for encoding videos as described here: http://vimeo.com/help/compression | |
| // | |
| // Input file: MTS | |
| // Video: H264, 1920x1080, 50fps | |
| // Audio: A52 Audio (aka AC3), Stereo, 48kHz, 256kbps | |
| ffmpeg -i input.mts -vcodec libx264 -acodec aac -strict experimental -vpre hq -s hd720 -b 5000k -ab 320k -r 25 -g 25 -threads 0 output.mp4 |
| Spork.prefork do | |
| require "rails/application" | |
| # Prevent Devise from loading the User model super early with it's route hacks for Rails 3.1 rc4 | |
| # see also: https://github.com/timcharper/spork/wiki/Spork.trap_method-Jujutsu | |
| Spork.trap_method(Rails::Application, :reload_routes!) | |
| Spork.trap_method(Rails::Application::RoutesReloader, :reload!) | |
| # rest of your prefork here... | |
| end |
| =Navigating= | |
| visit('/projects') | |
| visit(post_comments_path(post)) | |
| =Clicking links and buttons= | |
| click_link('id-of-link') | |
| click_link('Link Text') | |
| click_button('Save') | |
| click('Link Text') # Click either a link or a button | |
| click('Button Value') |