Skip to content

Instantly share code, notes, and snippets.

View PositiveControl's full-sized avatar

MSE PositiveControl

View GitHub Profile
@PositiveControl
PositiveControl / rax_user_file_set.rb
Created June 3, 2015 04:03
Stage one... get RAX file URLs
require "fog"
require "pry"
class RaxUserFileSet
def initialize(limit = nil)
conn = Fog::Storage.new({
:provider => "Rackspace",
:rackspace_username => RAX_UN,
:rackspace_api_key => RAX_API_KEY,
1 # -*- mode: ruby -*-
2 # vi: set ft=ruby :
3
4 require File.expand_path("../config.rb", __FILE__)
5
6 $username = ENV["USER"]
7
8 Vagrant.configure("2") do |config|
9 config.vm.box = "teamsnap/embryo"
10
@PositiveControl
PositiveControl / gist:020c4ceda1bf5b147010
Created May 21, 2014 15:40
JS + TurboLinks Bug Fix
/* Replaced first line with: $(document).on("page:update", function(){ */
$(document).ready(function(){
$('.filterable .btn-filter').click(function(){
var $panel = $(this).parents('.filterable'),
$filters = $panel.find('.filters input'),
$tbody = $panel.find('.table tbody');
if ($filters.prop('disabled') == true) {
$filters.prop('disabled', false);
$filters.first().focus();
# ERROR OUTPUT IN TERMINAL
#Started POST "/tickets/525204671" for 127.0.0.1 at 2014-05-03 23:17:01 -0600
#Processing by WelcomeController#update as HTML
# Parameters: {"price"=>"66.77", "event"=>"4426617", "id"=>"525204671"}
#<HTTParty::Response:0x7fd0cb6d1520 parsed_response={"error"=>{"code"=>"java.io.EOFException", "description"=>"No content to map to Object due to end of input", "requestId"=>"_76a2d494-5936-431d-9889-a71ec03b3fe8"}}, @response=#<Net::HTTPInternalServerError 500 Internal Server Error readbody=true>, @headers={"content-type"=>["application/json"], "com-stubhub-dye"=>["_76a2d494-5936-431d-9889-a71ec03b3fe8"], "com-stubhub-dye-path"=>["_76a2d494-5936-431d-9889-a71ec03b3fe8"], "server"=>["Apache"], "expires"=>["Sun, 04 May 2014 05:17:01 GMT"], "cache-control"=>["max-age=0, no-cache, no-store"], "pragma"=>["no-cache"], "date"=>["Sun, 04 May 2014 05:17:01 GMT"], "connection"=>["close"]}>
#Redirected to http://localhost:3000/events/4426617
#Completed 302 Found in 231ms (ActiveRecord: 0.0ms)
@PositiveControl
PositiveControl / dogs.rb
Last active August 29, 2015 14:00
Iterating-Arrays-of-Hashes Warmup
# About 30% through first refactoring
class Dogs
POOR = (0..5).to_a.sample
AVERAGE = (6..10).to_a.sample
EXCELLENT = (11..15).to_a.sample
def initialize
joe = {
:name => {:first => "Joe", :last => "Smith"},