FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)| <p>First name: <strong data-bind="text: firstName">Bert</strong></p> | |
| <p>Last name: <strong data-bind="text: lastName">Bertington</strong></p> | |
| <p>First name: <input data-bind="value: firstName" /></p> | |
| <p>Last name: <input data-bind="value: lastName" /></p> | |
| <p>Full name: <strong data-bind="text: fullName"></strong></p> | |
| <button data-bind="click: capitalizeLastName">Go caps</button> |
| class ApplicationController < ActionController::Base | |
| before_filter :require_authentication | |
| private | |
| def require_authentication | |
| unless current_certificate.verify(public_key) | |
| head :forbidden | |
| end | |
| end |
FridayHug.com http://fridayhug.com
The Smallest Rails App http://thesmallestrailsapp.com
%w(action_controller/railtie coderay).each &method(:require)| require 'spec_helper' | |
| describe 'Fabricators' do | |
| Fabrication::Support.find_definitions if Fabrication.schematics.empty? | |
| Fabrication.schematics.schematics.keys.each do |fabrication| | |
| it "The #{fabrication} fabrication is valid" do | |
| f = Fabricate.build(fabrication) | |
| f.should be_valid if f.respond_to?(:valid?) | |
| end |
| source :rubygems | |
| # We are not loading Active Record, nor Active Resources etc. | |
| # We can do this in any app by simply replacing the rails gem | |
| # by the parts we want to use. | |
| gem "actionpack", "~> 3.2" | |
| gem "railties", "~> 3.2" | |
| gem "tzinfo" | |
| # Let's use thin |
| -> # iwlist wlan0 scanning | ruby -ne "readlines.each{|l| puts l if l =~ /(?:Cell|ESSID|Channel)/ }" | |
| Cell 01 - Address: 00:1A:70:9E:98:60 | |
| Channel:1 | |
| Frequency:2.412 GHz (Channel 1) | |
| ESSID:"Uncle Zhora" | |
| Cell 02 - Address: 00:22:6B:86:F6:C8 | |
| Channel:1 | |
| Frequency:2.412 GHz (Channel 1) | |
| ESSID:"sabaka2" | |
| Cell 03 - Address: 00:15:E9:62:A7:44 |
| #!/usr/bin/env ruby | |
| class A | |
| CONDITION = { | |
| nil => :a, | |
| false => :b, | |
| true => :c | |
| } | |
| def abc(val) |
| if %w(test development).include? Rails.env | |
| Qu.backend = Qu::Backend::RightNow.new | |
| else |
| echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc | |
| . ~/.bashrc | |
| mkdir ~/local | |
| mkdir ~/node-latest-install | |
| cd ~/node-latest-install | |
| curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 | |
| ./configure --prefix=~/local | |
| make install # ok, fine, this step probably takes more than 30 seconds... | |
| curl https://npmjs.org/install.sh | sh |
GeoEntity.last
SELECT geo_entities.* FROM geo_entities ORDER BY geo_entities.id DESC LIMIT 1
returns:
County id: 4, eid: nil, pid: nil, ename: nil, etype: 2, created_at: "2011-11-21 06:26:37", updated_at: "2011-11-21 06:26:37"