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
<h1>New phrase</h1> | |
<% form_for(@phrase) do |f| %> | |
<%= f.error_messages %> | |
<p> | |
<%= f.label :content %><br /> | |
<%= f.text_field :content %> | |
</p> | |
<p> |
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
require 'rubygems' | |
require 'mongo_mapper' | |
require 'pp' | |
class Person | |
include MongoMapper::Document | |
key :name, String, :default => 'John Doe' | |
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
require 'RNotify' | |
notify_status = Notify.init('rstakeout') | |
raise 'Failed to initialize libnotify' unless notify_status | |
notification = Notify::Notification.new 'rstakeout', nil, nil, nil | |
# many times | |
notification.update "test", "message", nil | |
notification.timeout = 1 | |
notification.urgency = 0 | |
notification.show |
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
class User | |
attr_accessor :first_name, :last_name | |
def full_name | |
"#{@first_name} #{@last_name}" | |
end | |
def full_name=(full_name) | |
@first_name, @last_name = full_name.split(' ') | |
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
uri = URI::HTTP.build :host => 'www.google.com', | |
:path => '/ig/calculator', | |
:query => "q=1#{from.iso_code}%3D%3F#{to.iso_code}" | |
data = uri.read |
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
def parse(name) | |
pattern = / | |
(?:\[(\w+)\])? | |
(\w+) | |
(?:\[(\w+)\])? | |
/x | |
words = pattern.match(name).captures | |
combinations = [words[1]] | |
if words[0] | |
combinations << words[0] + words[1] |
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
$ python buildscripts/smoke.py --mode=files jstests/drop2.js | |
['jstests/drop2.js'] | |
cwd [/home/wojtek/hdd_home/projects/mgr/mongo_db/src] | |
num procs:217 | |
removing: /data/db/sconsTests//mongod.lock | |
removing: /data/db/sconsTests//test.0 | |
removing: /data/db/sconsTests//test.ns | |
removing: /data/db/sconsTests//test.1 | |
running /home/wojtek/hdd_home/projects/mgr/mongo_db/src/mongod --port 32000 --dbpath /data/db/sconsTests/ | |
Mon May 16 13:05:30 [initandlisten] MongoDB starting : pid=9575 port=32000 dbpath=/data/db/sconsTests/ 64-bit |
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
Device: sat16:/dev/sda | |
Type: 16 Byte SCSI ATA SAT Passthru | |
Size: 114473 MiB | |
Model: [INTEL SSDSA2CW120G3] | |
Firmware: [4PC10302] | |
SMART Available: yes | |
Quirks: 232_AVAILABLERESERVEDSPACE 233_MEDIAWEAROUTINDICATOR 225_TOTALLBASWRITTEN 4_UNUSED 226_TIMEWORKLOADMEDIAWEAR 227_TIMEWORKLOADHOSTREADS 228_WORKLOADTIMER 3_UNUSED | |
Awake: yes | |
SMART Disk Health Good: yes | |
Off-line Data Collection Status: [Off-line data collection activity was never started.] |
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
# ~/.synergy.conf | |
# http://synergy2.sourceforge.net/configuration.html | |
# run with synergy -f | |
section: screens | |
morpork: | |
mac-mini: | |
alt = super | |
# Mac -> Mac | |
# ctrl = ctrl | |
# super = alt |
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
require 'kleisli' | |
result = Maybe(something) | |
case result | |
when None() | |
raise 'operation failed' | |
else | |
puts result.value | |
end |
OlderNewer