If you'd like a full description, read at the very least the "Understanding Bundler" section of http://gembundler.com
bundle install
- This command is your meat-and-potatoes-everyday command, use
# Setup QEMU for x86-64 Docker images on Raspberry Pi 4 | |
# Install Python3 and Docker first: https://dev.to/rohansawant/installing-docker-and-docker-compose-on-the-raspberry-pi-in-5-simple-steps-3mgl | |
# Install QUEMU (https://www.qemu.org/) | |
sudo apt-get install qemu binfmt-support qemu-user-static | |
# Use QUS in Docker (https://github.com/dbhi/qus) to configure x86_64 architecture | |
docker run --rm --privileged aptman/qus -s -- -p x86_64 | |
# Test x86-64 image: |
# spec/routes/example_spec.rb | |
require 'spec_helper' | |
describe "routing for tab separation of example slug routed pages" do | |
it "routes to known tab names" do | |
expect( :get => "/example/far-out-man/reviews" ).to route_to( | |
:controller => "directory", | |
:action =>"show_tab", | |
:slug => "far-out-man", | |
:tab => "reviews" |
# requires the bash_completion packages installed via homebrew | |
if [ -f /usr/local/etc/bash_completion ]; then | |
. /usr/local/etc/bash_completion | |
fi | |
function __git_dirty { | |
git diff --quiet HEAD &>/dev/null | |
[ $? == 1 ] && echo "!" | |
} |
If you'd like a full description, read at the very least the "Understanding Bundler" section of http://gembundler.com
bundle install
- This command is your meat-and-potatoes-everyday command, use
# Get your spec rake tasks working in RSpec 2.0 | |
require 'rspec/core/rake_task' | |
desc 'Default: run specs.' | |
task :default => :spec | |
desc "Run specs" | |
RSpec::Core::RakeTask.new do |t| | |
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default. |
require 'sinatra' | |
get '/process' do | |
erb :process | |
end |
require 'rfile' | |
f = RFile.new('path/to/some/file') | |
f.line(6) #=> "the 6th line in the file" | |
f.each do |l| | |
# ordered iteration of each line in the file (IO intensive) | |
end | |
# db/migrate/01_add_custom_admin_roles.rb | |
class AddCustomAdminRoles < ActiveRecord::Migration | |
@roles = %w[extra] | |
def self.up | |
@roles.each do |r| | |
Role.create(:name => r) | |
end | |
end |
<!-- app/views/orders/_add_dialog.html.erb --> | |
<div id="add_to_cart_dialog"> | |
Your item(s) have been added. You now have <%= order.item_count %> | |
items valued at <%= number_to_currency order.item_total %> in your cart.<br/> | |
<div id="buttons" style="margin-top: 10px; width: 100%;"> | |
<button id="continue_shopping_button" style="float: left;" type="button">Continue Shopping (10)</button> | |
<button id="view_cart_button" style="margin-left: 10px; float: left;clear: right;" type="button">Checkout Now</button> | |
</div> | |
</div> |
function dotimes(amount) { | |
$('button#continue_shopping_button').html("Continue Shopping (" + amount + ")"); | |
if (amount == 0 ) { | |
$('button#continue_shopping_button').trigger('click'); | |
return; | |
} else { | |
amount = amount - 1; | |
setTimeout("dotimes(" + amount + ")", 1000); | |
} | |