Skip to content

Instantly share code, notes, and snippets.

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)
})
@bcurren
bcurren / redis_pubsub_demo.rb
Created May 3, 2011 21:19 — forked from pietern/redis_pubsub_demo.rb
Updated redis pubsub with cramp
# 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
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'
maintainer "Outright, Inc"
maintainer_email "ops@outright.com"
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
server {
location / {
if (-f $document_root/system/maintenance.html) {
return 503;
}
try_files $uri $uri/index.html @proxy;
}
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 {
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 {
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
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'
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").