Skip to content

Instantly share code, notes, and snippets.

@alkema
alkema / superfeedr.log
Created August 23, 2011 20:54
Superfeedr sequential update success
opening connection to superfeedr.com...
opened
opening connection to superfeedr.com...
opened
<- "POST /hubbub HTTP/1.1\r\nContent-Type: application/x-www-form-urlencoded\r\nConnection: close\r\nAuthorization: Basic c3VwZXJmZWVkckBub25maWN0aW9uLmNhOnN1cGVyZmVlZHI=\r\nContent-Length: 236\r\nHost: superfeedr.com\r\n\r\n"
<- "hub.topic=http%3A%2F%2Fsearch.twitter.com%2Fsearch.atom%3Fq%3D%2522Capilano%2520Suspension%2520Bridge%2520%26%2520Park%2522&hub.verify=sync&hub.callback=http%3A%2F%2Fbackend.overherd.at%2Fsubscriptions%2F625%2Fentries&hub.mode=subscribe"
-> "HTTP/1.1 204 No Content\r\n"
-> "Server: nginx/0.8.52\r\n"
-> "Date: Tue, 23 Aug 2011 20:53:51 GMT\r\n"
-> "Connection: close\r\n"
index :: ~ » curl -XGET 'http://127.0.0.1:9200/_cluster/health?pretty=true'
{
"status" : "yellow",
"timed_out" : false,
"active_primary_shards" : 12,
"active_shards" : 12,
"relocating_shards" : 0
}%
index :: ~ » curl http://localhost:9200/entries/_search\?q\=\*\&sort\=updated_at:desc\&size\=5\&pretty\=true
<html>
<head><title>Harbour-Link</title></head>
<frameset cols='*' rows='*'>
<frame src='http://www.hlcsi.com/' frameborder='0' scrolling='Auto' noresize marginwidth='0' marginheight='0'>
</frameset>
<!--
<noframes><body>Frame required.</body></noframes>
-->
</html>
Started POST "/incoming_mails" for 75.101.174.33 at 2011-09-16 11:44:50 -0700
Processing by IncomingMailsController#create as HTML
Parameters: {"to"=>"<[email protected]>", "disposable"=>"", "from"=>"[email protected]", "subject"=>"test", "message"=>"Received: by wyh11 with SMTP id 11so4116107wyh.36\r\n for <[email protected]>; Fri, 16 Sep 2011 11:44:46 -0700 (PDT)\r\nReceived: by 10.227.200.147 with SMTP id ew19mr1896356wbb.38.1316198686329;\r\n Fri, 16 Sep 2011 11:44:46 -0700 (PDT)\r\nReturn-Path: <[email protected]>\r\nReceived: from Steve-Smiths-MacBook-Pro.local ([46.208.75.144])\r\n by mx.google.com with ESMTPS id p8sm10467322wbo.20.2011.09.16.11.44.44\r\n (version=SSLv3 cipher=OTHER);\r\n Fri, 16 Sep 2011 11:44:45 -0700 (PDT)\r\nMessage-ID: <[email protected]>\r\nDate: Fri, 16 Sep 2011 19:44:42 +0100\r\nFrom: Steve Smith <[email protected]>\r\nUser-Agent: Postbox 2.5.2 (Macintosh/20110802)\r\nMIM
@alkema
alkema / simple_form_twitter_bootstrap
Created September 29, 2011 22:03
Generate form markup that twitter bootstrap uses with simple_form for Rails 3.1
Relevant Gemfile:
gem 'rails', '3.1.0'
group :assets do
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
gem 'twitter-bootstrap-rails', :git => 'http://github.com/seyhunak/twitter-bootstrap-rails.git'
end
gem 'simple_form', :git => 'git://github.com/plataformatec/simple_form.git'
@alkema
alkema / gist:1367717
Created November 15, 2011 17:32
Nokogiri print xml
Nokogiri::XML(link_entry.atom,&:noblanks).to_xhtml( indent:3, indent_text:"." )
@alkema
alkema / gist:1367728
Created November 15, 2011 17:36
rexml xml print
require "rexml/document"
doc = REXML::Document.new(link_entry.atom)
doc.write($stdout, 2)
ruby-1.9.2-p180 :007 > AdminUser.where(:id => 1).class
=> ActiveRecord::Relation
ruby-1.9.2-p180 :008 > AdminUser.where(:id => 1).first.class
AdminUser Load (0.2ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = 1 LIMIT 1
=> AdminUser(id: integer, email: string, encrypted_password: string, reset_password_token: string, reset_password_sent_at: datetime, remember_created_at: datetime, sign_in_count: integer, current_sign_in_at: datetime, last_sign_in_at: datetime, current_sign_in_ip: string, last_sign_in_ip: string, created_at: datetime, updated_at: datetime)
ruby-1.9.2-p180 :009 > AdminUser.limit(1).class
=> ActiveRecord::Relation
railsonfire new
Creating new Railsonfire Project
/Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:150:in `readline': end of file reached (EOFError)
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:150:in `block in get_railsonfire_credentials'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:150:in `open'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:150:in `get_railsonfire_credentials'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:45:in `create_new'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/lib/railsonfire-gem.rb:24:in `run'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/gems/railsonfire-0.1.4/bin/railsonfire:16:in `<top (required)>'
from /Users/jody/.rvm/gems/ruby-1.9.2-p180/bin/railsonfire:19:in `load'
@alkema
alkema / widget.rb
Created November 25, 2011 18:11
testing ruby object for attribute presence/absence
class Widget
attr_accessor :circumference
attr_accessor :colour
attr_accessor :mass
def initialize(attributes)
attributes.each do |key, value|
m = "#{key}=".to_sym
self.send(m, value) if self.respond_to?(m)
end