Skip to content

Instantly share code, notes, and snippets.

View resistorsoftware's full-sized avatar

David Lazar resistorsoftware

View GitHub Profile
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static targets = ['launcher']
initialize () {
this.launchModal = this.launchModal.bind(this)
}
connect () {
@resistorsoftware
resistorsoftware / export_import_heroku_database.md
Created May 6, 2021 14:28 — forked from zulhfreelancer/export_import_heroku_database.md
How to export Heroku Postgres Database to Localhost Database (Rails)?

How to export Heroku Postgres Database to Localhost Database (Rails)?

Step 1

$ cd /path/to/your/rails/app
$ heroku pg:backups capture
$ curl -o latest.dump `heroku pg:backups public-url`

OR
@resistorsoftware
resistorsoftware / gist:b974409af75703542bf3
Created July 3, 2015 14:50
Problems with Shopify Discount Reporting
Raw Data From a Sale
[{
"gift_card"=>false,
"id"=>1646486209,
"price"=>"439.00",
"product_id"=>417517185,
"quantity"=>1,
"taxable"=>true,
"title"=>"something",
@resistorsoftware
resistorsoftware / gist:ac4351616b729dcc224c
Last active August 29, 2015 14:15
Problem with DJ and ActiveModel
app error: undefined method `bytesize' for #<DelayedJob:0x007f063c9a0dc8> (NoMethodError)
/app/vendor/bundle/ruby/2.1.0/gems/activemodel-4.2.0/lib/active_model/attribute_methods.rb:433:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/rack-1.6.0/lib/rack/utils.rb:361:in `bytesize'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:152:in `block in finish'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:152:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:152:in `inject'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:152:in `finish'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:909:in `call!'
/app/vendor/bundle/ruby/2.1.0/gems/sinatra-1.4.5/lib/sinatra/base.rb:886:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/newrelic_rpm-3.9.9.275/lib/new_relic/rack/browser_monitoring.rb:23:in `traced_call'
COST for border-trim-shirt = 22.34
Before: {}
Existing price object so merge... 22.34
After: {"S4221-XS"=>"22.34", "1082756904"=>"22.34"}
COST for border-trim-shirt = 22.34
Before: {"S4221-XS"=>"22.34", "1082756904"=>"22.34"}
Existing price object so merge... 22.34
After: {"S4221-XS"=>"22.34", "1082756904"=>"22.34", "S4221-S"=>"22.34", "1126176744"=>"22.34"}
COST for border-trim-shirt = 22.34
Before: {"S4221-S"=>"22.34", "S4221-XS"=>"22.34", "1082756904"=>"22.34", "1126176744"=>"22.34"}
@resistorsoftware
resistorsoftware / Gemfile
Created July 28, 2014 15:26
Unicorn setup
source 'https://rubygems.org'
ruby '2.1.2'
gem "sinatra", :require => 'sinatra/base'
gem "sinatra-flash", :require => "sinatra/flash"
gem "haml"
gem "warden"
gem "unicorn"
gem 'activerecord', "~> 4.0", :require => 'active_record'
gem 'actionmailer', "~> 4.0", :require => 'action_mailer'
@resistorsoftware
resistorsoftware / gist:6353325
Created August 27, 2013 13:11
Some simple Ajax cart
<h1>Product.Liquid crap goes here... lalalalala whatever... </h1>
<script type="text/javascript">
// I hacked the Ajax API to add line item properties for a product too.
function addToCart() {
var item = DaveWuzHere.utils.popQueue();
if(item) {
if(item.properties) {
Shopify.api.addItemWithProperties(item.id, item.quantity, item.properties, addToCart);
<li class="cart-overview"><a href="/cart">MY BAG (2)</a>
<div class="arrow-down-cart"></div>
<div id="crt" style="overflow: hidden; display: none;">
<form action="/cart" method="post" id="cartform">
<div id="cart-item">
<div class="quick-cart-image">
<a href="/products/paint-it-red-animal-instinct-tunic-top-black-blue" title="paint it red animal instinct tunic/top - black/blue">
<img src="http://cdn.shopify.com/s/files/1/0071/3552/products/21MARCH-731_small.jpg?12137" alt="paint it red animal instinct tunic/top - black/blue">
</a>
</div>
@resistorsoftware
resistorsoftware / RamJet
Created February 19, 2013 14:24
What's the difference between these rows?
2/16/13 15:13 Mark Schuldt 11836 S 47th Street Papillion NE 68133 US (402) 391-6668 Mark Schuldt 11836 S 47th Street Papillion NE 68133 US (402) 391-6668 mschuldt3@cox.net 53J315654H276600V AVS: Y CVV2: M Visa uspsd 2.99 0 162.97 MBSB8G 8GB DDR3-1333 Kit for MacBook Pro 1 79.99 MBP8G 8GB DDR3-1066 Kit for MacBook Pro 1 79.99
2/16/13 15:13 Mark Schuldt 11836 S 47th Street Papillion NE 68133 US (402) 391-6668 Mark Schuldt 11836 S 47th Street Papillion NE 68133 US (402) 391-6668 mschuldt3@cox.net 8EY04456F2208274D AVS: Y CVV2: M Visa uspsd 2.99 0 162.97 MBSB8G 8GB DDR3-1333 Kit for MacBook Pro 1 79.99 MBP8G 8GB DDR3-1066 Kit for MacBook Pro 1 79.99
@resistorsoftware
resistorsoftware / gist:3927575
Created October 21, 2012 16:53
rvm pkg install openssl
rvm pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/dlazar/.rvm/archives
Extracting openssl-1.0.1c.tar.gz to /Users/dlazar/.rvm/src
Configuring openssl in /Users/dlazar/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/dlazar/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/dlazar/.rvm/usr
Please note that it's required to reinstall all rubies:
rvm reinstall all --force