Skip to content

Instantly share code, notes, and snippets.

View spq24's full-sized avatar

Steve Quatrani spq24

  • Kinertia LLC
  • New York, NY
View GitHub Profile
Parameters: {"id"=>"evt_16OXgjDPqmFGZYxBdeTjKnpr", "created"=>1436896769, "livemode"=>false, "type"=>"invoice.payment_succeeded", "data"=>{"object"=>{"date"=>1436896769, "i
d"=>"in_16OXgjDPqmFGZYxBnS3fI1CQ", "period_start"=>1436896769, "period_end"=>1436896769, "lines"=>{"object"=>"list", "total_count"=>1, "has_more"=>false, "url"=>"/v1/invoices
/in_16OXgjDPqmFGZYxBnS3fI1CQ/lines", "data"=>[{"id"=>"sub_6blDm3XJI0wWaA", "object"=>"line_item", "type"=>"subscription", "livemode"=>false, "amount"=>10, "currency"=>"usd",
"proration"=>false, "period"=>{"start"=>1436896769, "end"=>1436983169}, "subscription"=>nil, "quantity"=>1, "plan"=>{"interval"=>"day", "name"=>"Daily Plan", "created"=>14364
63055, "amount"=>10, "currency"=>"usd", "id"=>"Daily Plan", "object"=>"plan", "livemode"=>false, "interval_count"=>1, "trial_period_days"=>nil, "metadata"=>{}, "statement_des
criptor"=>"Daily Plan"}, "description"=>nil, "discountable"=>true, "metadata"=>{}}]}, "subtotal"=>10, "total"=>9, "customer"=>"cus_6bNAq2czziHy2u", "o
@spq24
spq24 / gist:ac81d6de52a6c440aaff
Created March 22, 2015 03:07
Thinkful Streetfighter
CSS
body {
background-color: black;
}
.main {
background-color: white;
margin-top: 110px;
padding-left: 100px;
min-width: 1200px;
def create
@postcodes = Postcode.all
@postcodes.find_each do |p|
response = HTTParty.get("https://io.myrheem.com/v1/public/contractors/getcontractorsbyzipandradius?PostalCode=#{p.zip}&Radius=100&bHeatCool=true&bWHRes=false&bWHComm=false&bWHTankless=false&bSolarWH=false&bHomeGen=false&bPoolSpa=false&bDesignStar=false&bKwikComfort=false&bPPlus=false&bCashback=false&bTC=false&bASP=false&bRheem=true&bRuud=false&bPHCC=false").to_json
@contractors = JSON.parse(response)[ "Contractors" ]
@contractors.to_a.each do |c|
contractorname = c["OrganizationName"]
if Contractor.exists?(organizationname: contractorname)
next
else
@spq24
spq24 / gist:bd87b9d2968e6e6739ad
Last active August 29, 2015 14:05
filterrifc-ruby
Lead Model
class Lead < ActiveRecord::Base
filterrific(
default_settings: { sorted_by: 'created_at_asc' },
filter_names: [
:sorted_by,
:with_nonleadaction_id,
:with_reasoninquiry_id
]
class ChatsController < ApplicationController
def index
@chats = Chat.order("created_at DESC")
end
def new
@chat = Chat.new
end
@spq24
spq24 / gist:5000772
Created February 20, 2013 23:47
jquery-file-upload-rails not working
Model:
class Pin < ActiveRecord::Base
attr_accessible :description, :image
validates :description, presence: true, length: { :maximum => 140 }
validates :user_id, presence: true
validates_attachment :image, presence: true,
content_type: { content_type: ['image/jpeg', 'image/jpg', 'image/png', 'image/gif'] },
@spq24
spq24 / gist:3337145
Created August 13, 2012 05:19
datepicker problem
application.html.erb
<div class="modal hide fade in" id="body" >
<%= form_for(@weight) do |f| %>
<div class="modal-header">
<%= render 'shared/error_messages', object: f.object %>
<button type="button" class="close" data-dismiss="modal">×</button>
<h3>Record Body Weight</h3>
</div>
<div class="modal-body" id="datepicker">