This file contains hidden or 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
conn = ... | |
broadcastAddr *net.UDPAddr, request *http.Request = makeSearchRequest(st, mx) | |
err = request.Write(func Write(p []byte) (n int, err error) { | |
return conn.WriteTo(p, broadcastAddr) | |
}) |
This file contains hidden or 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
# Author: Pieter Noordhuis | |
# Description: Simple demo to showcase Redis PubSub with EventMachine | |
# | |
# Update 7 Oct 2010: | |
# - This example does *not* appear to work with Chrome >=6.0. Apparently, | |
# the WebSocket protocol implementation in the cramp gem does not work | |
# well with Chrome's (newer) WebSocket implementation. | |
# | |
# Requirements: | |
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby |
This file contains hidden or 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 Model < ActiveRecord::Base | |
default_scope order("title desc") | |
scope :with_city, lambda { |city| where("city = ?", city) } | |
def self.search | |
# How do I do this? Need to remove a relation | |
self.scoped.remove(self.default_scoping).all | |
end | |
end | |
Model.with_city('San Francisco').search # What I want -> select * from models where city = 'San Francisco' |
This file contains hidden or 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
maintainer "Outright, Inc" | |
maintainer_email "[email protected]" | |
license "Apache 2.0" | |
description "Installs/Configures metrics" | |
long_description IO.read(File.join(File.dirname(__FILE__), 'README.rdoc')) | |
version "0.1" | |
%w{nodejs mongodb god}.each do |d| | |
depends d | |
end |
This file contains hidden or 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
server { | |
location / { | |
if (-f $document_root/system/maintenance.html) { | |
return 503; | |
} | |
try_files $uri $uri/index.html @proxy; | |
} |
This file contains hidden or 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
Todos.tasksController = SC.ArrayController.create( | |
SC.CollectionViewDelegate, | |
/** @scope Todos.tasksController.prototype */ { | |
summary: function() { | |
var len = this.get("length"), ret; | |
if (len && len > 0) { | |
ret = len === 1 ? "1 tasks" : "%@ tasks".fmt(len); | |
} else { |
This file contains hidden or 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
test | |
upstream app_server { | |
# fail_timeout=0 means we always retry an upstream even if it failed | |
# to return a good HTTP response (in case the Unicorn master nukes a | |
# single worker for timing out). | |
server unix:<%= @code_root %>/current/tmp/sockets/unicorn.sock fail_timeout=0; | |
} | |
server { |
This file contains hidden or 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
root@domU-12-31-39-0B-15-84:/usr/local/lib/ruby/gems/1.8/gems/chef-0.9.8/lib/chef# chef-server --log-level debug -N -p 4000 -e production | |
Merb root at: /usr/local/lib/ruby/gems/1.8/gems/chef-server-api-0.9.8 | |
~ No Gemfile found! If you're generating new app with merb-gen this is fine, otherwise run: bundle init to create Gemfile | |
Loading init file from ./config/init.rb | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/_all_dbs | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/chef/_design/id_map | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/_all_dbs | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/chef/_design/nodes | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/_all_dbs | |
[Thu, 12 Aug 2010 18:46:27 +0000] DEBUG: Sending HTTP Request via GET to localhost:5984/chef/_design/roles |
This file contains hidden or 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
ben:outright_chef bcurren$ knife cookbook download nginx | |
WARN: HTTP Request Returned 404 Not Found: Cannot find a cookbook named nginx | |
ERROR: Cannot find a cookbook named nginx | |
/Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife/cookbook_download.rb:102:in `available_versions': undefined method `map' for nil:NilClass (NoMethodError) | |
from /Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife/cookbook_download.rb:91:in `determine_version' | |
from /Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife/cookbook_download.rb:56:in `run' | |
from /Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/knife.rb:127:in `run' | |
from /Library/Ruby/Gems/1.8/gems/chef-0.9.8/lib/chef/application/knife.rb:118:in `run' | |
from /Library/Ruby/Gems/1.8/gems/chef-0.9.8/bin/knife:25 | |
from /usr/bin/knife:19:in `load' |
This file contains hidden or 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
filter({:name => "company_importer_created", :name => "manual_txn_created"}.sql_or). | |
filter("day_num >= ?", day_num). | |
filter("year_num >= ?", year_num). | |
filter(:engagement_type_str => "Initial"). |
NewerOlder