Skip to content

Instantly share code, notes, and snippets.

package main
import "fmt"
func sum(a []int, c chan int) {
sum := 0
for _, v := range a {
sum += v
}
c <- sum // send sum to c
module RequestRouter
ADMIN_REQUESTS = %w[
names
of_admin_methods
go_here
this_is_an_admin_method
]
def request(params)
// illegal
grid := [][]int{
{1, 0, 1},
{0, 1, 0},
{1, 0, 1}
}
// legal
grid := [][]int{

When not polishing his bio for conferences, Evan works as a Developer Advocate from the comfort of his apartment near Washington, D.C., organizes, if it can be called organized, the annual Ruby DCamp unconference that has never, in fact, been run within the borders of Washington, D.C., and attends entirely too many meetups.

require 'rubygems'
require 'bundler/setup'
require 'fog/rackspace'
require 'pry'
provider_config = {
:provider => 'rackspace',
:rackspace_username => ENV['RACKSPACE_USERNAME'],
def new(config = {})
if config.respond_to?(:config_service?) && config.config_service?
cleaned_settings = config
else
cleaned_settings = handle_settings(config)
end
setup_requirements
svc = service
if Fog.mocking?
@elight
elight / Gemfile
Last active August 29, 2015 13:59
source 'https://rubygems.org'
gem 'fog', '~> 1.20.0'
gem 'pry'
# IDENTITY
require 'fog/openstackcommon/identity'
require 'fog/openstackcommon/services/identity_v1'
require 'fog/openstackcommon/services/identity_v2'
def request(params)
begin
response = @connection.request(params.merge({
:headers => {
'Content-Type' => 'application/json',
'Accept' => 'application/json',
'X-Auth-Token' => @auth_token
}.merge!(params[:headers] || {}),
:path => "#{@path}/#{@tenant_id}/#{params[:path]}",
:query => params[:query]
module Fog
module Rackspace
class Monitoring
class Real
def list_entities(options={})
request(
:expects => [200, 203],
:method => 'GET',
:path => 'entities',