Skip to content

Instantly share code, notes, and snippets.

Terms of Service

Last revised on [DATE]

The Gist

Work Montage, LLC operates the Mocksup service, which we hope you use. If you use it, please use it responsibly. If you don't, we'll have to terminate your account.

For paid accounts, you'll be charged on a monthly basis. You can cancel anytime, but there are no refunds.

➜ load-server vagrant up
[INFO 04-27-2010 11:49:37] Vagrant: Provisioning enabled with Vagrant::Provisioners::ChefSolo
[INFO 04-27-2010 11:49:37] Vagrant: Importing base VM (/Users/bigfleet/.vagrant/boxes/base/box.ovf)...
[INFO 04-27-2010 11:50:27] Vagrant: Persisting the VM UUID (32623eea-5a90-4f38-8b30-9ca302654955)...
[INFO 04-27-2010 11:50:27] Vagrant: Matching MAC addresses...
[INFO 04-27-2010 11:50:27] Vagrant: Running any VM customizations...
[INFO 04-27-2010 11:50:28] Vagrant: Deleting any previously set forwarded ports...
[INFO 04-27-2010 11:50:28] Vagrant: Forwarding ports...
[INFO 04-27-2010 11:50:28] Vagrant: Forwarding "ssh": 22 => 2222
[INFO 04-27-2010 11:50:28] Vagrant: Clearing previously set shared folders...
Bluepill.define_process_condition(:running_time) do
def initialize(options = {})
@below = options[:below]
end
def run(pid)
started = `ps -p #{pid} -o command`.match(/since (\d+)/)[1].to_i
Time.now - Time.at(started)
rescue
0
nkallen_: nkallen_: anyway, i want to stress that we basically agree about things so i want to be sure that the tone of the blog post is such
[7:25pm] nkallen_: [7:17pm] nkallen_: i would argue that what you do in rails 3 (according to these tweets I've read)
[7:25pm] nkallen_: [7:17pm] nkallen_: is exactly what I propose... this is just how one might do it in Ruby
[7:25pm] nkallen_: [7:18pm] nkallen_: but my point is conceptual and not about ruby
[7:25pm] nkallen_: [7:18pm] nkallen_: it applies to every oo language and also I might argue to functional languages
[7:25pm] nkallen_: [7:18pm] nkallen_: which is to structure a program around the ability to layer on enhanced functionality and ensure that no assumptions are hardcoded by abstracting over the manufacture of objects
[7:25pm] nkallen_: [7:19pm] nkallen_: in the literature, these techniques are called DI, decorators, and factories.
[7:25pm] nkallen_: [7:20pm] nkallen_: i like these terms because they reflect the concepts that are at work. because ruby m
require 'open-uri'
require 'set'
img_urls = Set.new
[0,20,40,60,80,100,120,140,160,180,200].each do |val|
url = "http://images.google.com/images?as_st=y&hl=en&q=avatar+imagesize:150x150&sa=N&start=#{val}&ndsp=20"
results = open(url)
str = open(results).read
str.scan(/http:\/\/([^\"]*)\.(gif|jpg|png)/).collect{ |m| "http://"+m.join('.') }.each do |item|
img_urls << item
end
When /^(.*) in the "([^\"]*)" section$/ do |action, title|
within "//*[(h1|h2|h3|h4|h5|h6|legend|caption)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
end
When /^(.*) in the "([^\"]*)" row$/ do |action, title|
within "//*[(th|td)/descendant-or-self::*[contains(text(), '#{title}')]]" do
When action
end
@bigfleet
bigfleet / ruby-riak
Created January 30, 2010 19:58
Installs riak and an example Ruby client. Open jiak.rb for more details.
#!/bin/bash
# On OS X? Installed homebrew already? Interested in Riak? Get familiar!
# This command in your terminal should be a one-stop shop.
# curl http://gist.github.com/raw/290696/e8159440a9a48ac7dfe9d98bfbdac955fda79208/ruby-riak | sh
brew install erlang wget
wget http://bitbucket.org/basho/riak/get/riak-0.8.tar.gz && tar zxvf riak-0.8.tar.gz
cd riak && make all rel
cd rel/riak && bin/riak start
wget http://bitbucket.org/basho/riak/raw/67c55dfd44f5/client_lib/jiak.rb
➜ hip-hop-nerd-jokes git:(master) ✗ man epmd # Strictly Business!
epmd(1) USER COMMANDS epmd(1)
NAME
epmd - Erlang Port Mapper Daemon
DESCRIPTION
require 'rubygems'
require 'eventmachine'
require 'socket'
module RPCServer
include EM::P::ObjectProtocol
def post_init
@obj = Hash.new
end
def receive_object method
namespace(:cookbooks) do
#
# This rake script enables merging in public "cookbooks" from
# opscode into your local "chef-repo"
#
# generating per-cookbook branches takes a while. run this task on
# your opscode cookbooks git clone and you'll end up with a zillion
# branches with one cookbook per branch
#
# if you like just skip to "option #2" below to play around with this.