This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Definition for singly-linked list. | |
* type ListNode struct { | |
* Val int | |
* Next *ListNode | |
* } | |
* Runtime: 8 ms, faster than 88.19% of Go online submissions for Add Two Numbers. | |
* Memory Usage: 4.3 MB, less than 100.00% of Go online submissions for Add Two Numbers. | |
*/ | |
var one = ListNode{ Val: 1 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# setup | |
RAILS_VERSION="5.1.1" | |
gem install rails -v $RAILS_VERSION && \ | |
rails _${RAILS_VERSION}_ new rails-${RAILS_VERSION}-test && \ | |
cd rails-${RAILS_VERSION}-test && \ | |
rails generate model User && \ | |
rails db:migrate && \ | |
echo 'class User < ActiveRecord::Base; FOO = where(id: [1]); end' > app/models/user.rb && \ | |
echo 'Rails.application.routes.draw { User }' > config/routes.rb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- user_workspaces_v01 | |
-- Pull Organizations and Workspaces affiliated with, | |
-- and also organizations we have projects we are collaborating on | |
-- first version :: ugly and super slow, see updated version next | |
WITH user_workspaces AS ( | |
SELECT a.user_id, | |
o.name | |
FROM user_affiliations a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ASSUMPTIONS | |
# Assumes we respond_to #fee_schedule, which has various details, | |
# like processor_rate, merchant_custom_handling_fee, or the like. | |
module CalculatorDSL | |
extend ActiveSupport::Concern | |
included do | |
singleton_class.send :alias_method, :method_missing, :define_method | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Say you want to look up the attrs of a Stripe Event for logging to your internal database. | |
attrs = begin | |
retriable(Stripe::APIConnectionError, Stripe::APIError, max: 25) do | |
# ... retrieve attrs from the Stripe event here... | |
end | |
rescue Stripe::APIConnectionError, Stripe::APIError | |
# We're inside an SQS queue block | |
throw :skip_delete # we'll just have to wait on this event, come back later | |
rescue Stripe::Error | |
notify $! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StandardError | |
# Accountant::CannotDestroyFinancialData = Class.new(Exception) | |
# before_destroy(&Accountant::CannotDestroyFinancialData) | |
def self.to_proc | |
e = self; -> { raise e } | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// multi-ticket icon | |
.fa-tickets { | |
&:after, &:before { | |
content: "\f145"; | |
} | |
&:after { | |
margin-left: -12px; | |
opacity: 0.7; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Person < ActiveRecord::Base | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
printf '\npost-checkout hook\n\n' | |
if [[ $3 == 1 ]]; then | |
echo "Creating `git name-rev --name-only $2`" | |
createdb "ticketbud_`git name-rev --name-only $2`_development" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file is used by Rack-based servers to start the application. | |
$stdout.sync = true | |
require 'unicorn/worker_killer' | |
## | |
## Maximum Requests | |
## |
NewerOlder