Skip to content

Instantly share code, notes, and snippets.

Avatar

Evan Light elight

  • Heroku
  • Washington, DC
View GitHub Profile
View *.txt
app/controllers/barcodes_controller.rb:10:16: img_data = Rails.cache.fetch("barcode-#{code.gsub(/\W/,'_')}.png") do
app/controllers/picklist/recently_picked_controller.rb:5:15: items = Rails.cache.read('recently_picked') || []
app/controllers/picklist/to_ship_controller.rb:9:15: items = Rails.cache.read('recently_picked') || []
app/controllers/picklist/to_ship_controller.rb:14:7: Rails.cache.write('recently_picked', items)
app/controllers/pricing_engine/driver_controller.rb:10:15: running = Rails.cache.read('pricing_engine_worker_running') ? true : false
app/interactors/unit_interactor/change_storage_location.rb:66:15: items = Rails.cache.read('recently_picked') || []
app/interactors/unit_interactor/change_storage_location.rb:68:7: Rails.cache.write('recently_picked', items)
app/models/load.rb:239:8: #Rails.cache.fetch("load-#{proxy_association.owner.id}-manifest_entries-interesting_columns") do
app/models/load.rb:713:5: Rails.cache.write("load-#{self.id}-processing-mani
View app.rb
log = File.new(AppConfig.log_filepath, "a+")
$stdout.reopen(log)
$stderr.reopen(log)
View jed.cnf
[mysqld]
# Slow Log
#slow_query_log = 1
#log_queries_not_using_indexes = 1
#long_query_time = 1
# Disable DNS lookups for performance
skip_name_resolve
# MySQL >= 5.5.5 uses InnoDB by default, but set it just in case
View dabbling_with_statelessness.rb
cf = Redrax::CloudFiles.new
cf.configure!(
user: ENV['RAX_USERNAME'],
api_key: ENV['RAX_API_KEY'],
region: :iad
)
cf.authenticate!
container_name = "test_container"
file_name = "test_file"
View gist:026e203471adcd403237
require 'aviator'
configuration = {
:provider => 'openstack',
:auth_service => {
:name => 'identity',
:host_uri => 'http://devstack:5000/v2.0',
:request => 'create_token',
:validator => 'list_tenants'
},
View cloud_files_sdk_brainstorming.rb
# containers
cf.containers.create("new_container")
cf.containers.create("new_container", metadata: { "you're on your own here bud": "because you wanted all of the power" }) # Should we even offer metadata mutation at create time????
container = cf.containers["my-test-dir"]
container.delete
# metadata (Hash-like protocol)
container.metadata # Return a Hash of the metadata less the X-Container-Meta- prefixes
container.metadata["price"] = "4.20"
container.metadata.delete("price")
View rax_auth.txt
export body="{\"auth\":{\"RAX-KSKEY\":\"apiKeyCredentials\":{\"username\":\"$RAX_USERNAME\", \"apiKey\":\"$RAX_API_KEY\"}}}"
echo $body
echo
curl -v -s https://identity.api.rackspacecloud.com/v2.0/tokens -X 'POST' \
-d $body \
-H 'Content-Type: application/json' | python -m json.tool
View create_access_rule.rb
module Fog
module Rackspace
class LoadBalancers
class Real
def create_access_rule(load_balancer_id, address, type)
#TODO - This can actually support adding multiple access rules.
data = {
'accessList' => [
{
'address' => address,
View bob.rb
class Bob
def hey(what)
what = forget_that_noise(what)
if saying_a_whole_lotta_nothing?(what)
"Fine. Be that way!"
elsif shouting_at_me?(what)
"Woah, chill out!"
elsif asking_me_something?(what)
"Sure."
View raindrops.go
package raindrops
import (
"bytes"
"fmt"
)
func Convert(v int) string {
fs := findRelevantFactorsFor(v)
return formatFactorsOf(v, fs)