This is a test
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 'timeout' | |
begin | |
timeout(1) do | |
sleep(5) | |
end | |
rescue Timeout::Error => e | |
puts e.inspect | |
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
#!/bin/bash | |
clear | |
echo -ne " \n\n\n\n" | |
echo -ne " a fantastic shrimp voyage\r" | |
sleep 2 | |
echo -ne " * ( \r" | |
sleep 1 | |
echo -ne " 9 ( \r" | |
sleep 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
#!/usr/bin/env ruby | |
num_times = (ARGV[0] || "1_000_000").gsub(/_/,'').to_i | |
seed = (ARGV[0] || Time.now).to_i | |
$stderr.puts "seed is #{seed}" | |
srand(seed) | |
time = Time.now.to_f | |
users = %w[Ace Beer Charlie Don Edward Freddie George Harry Ink Johnnie King London Monkey Nuts Orange Pip Queen Robert Sugar Toc Uncle Vic William Xray Yorker Zebra] | |
num_times.times do |user| |
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
[~]$ ruby -Ku -e 'puts "Kevin Sjöberg".bytes.to_a.inspect' [ruby-1.8.7-p358] | |
[75, 101, 118, 105, 110, 32, 83, 106, 195, 182, 98, 101, 114, 103] | |
[~]$ ruby scratch.rb "Kevin Sjöberg" [ruby-1.8.7-p358] | |
[75, 101, 118, 105, 110, 32, 83, 106, 195, 182, 98, 101, 114, 103] | |
[~]$ [ruby-1.8.7-p358] | |
[~]$ cat scratch.rb |
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
get '/trackers/tumblr', :to=>'tumblr_trackers#index', :as=>'tumblr_trackers' | |
get '/trackers/tumblr/new', :to=>'tumblr_trackers#new', :as=>'new_tumblr_tracker' | |
post '/trackers/tumblr', :to=>'tumblr_trackers#create' | |
get '/trackers/tumblr-:id', :to=>'tumblr_trackers#show', :as=>'tumblr_tracker' | |
get '/trackers/tumblr-:id/edit', :to=>'tumblr_trackers#edit', :as=>'edit_tumblr_tracker' | |
put '/trackers/tumblr-:id', :to=>'tumblr_trackers#update' | |
delete '/trackers/tumblr-:id', :to=>'tumblr_trackers#destroy' |
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
$ rails -v | |
Rails 3.2.8 | |
$ rails c | |
Loading development environment (Rails 3.2.8) | |
1.9.3-p194 :001 > Time.zone = 'Paris' | |
=> "Paris" | |
1.9.3-p194 :002 > t = Time.zone | |
=> (GMT+01:00) Paris # HUH? Paris is GMT+02:00 right now, thanks to DST | |
Now deep in the bowels of ActiveSupport::TimeZone, we have the following: |
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
[~]$ curl -XDELETE 'http://localhost:9200/tumblr' [ruby-1.9.3-p194@lab] | |
{"ok":true,"acknowledged":true}% | |
[~]$ cat mapping.json [ruby-1.9.3-p194@lab] | |
{ "mappings": { | |
"text": { | |
"properties": { | |
"blog_name": {"type": "string", "index":"not_analyzed"}, | |
"timestamp": {"type": "date"} | |
} | |
}, |
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
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
void main () | |
{ | |
int iNum, i = 0; | |
while (i < 5) | |
{ | |
cout << "Please enter a number: "; |
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
#include <iostream> | |
#include <iomanip> | |
using namespace std; | |
void main () | |
{ | |
int iNum, i = 0; | |
while (i < 5) | |
{ |