Skip to content

Instantly share code, notes, and snippets.

View pushcx's full-sized avatar

Peter Bhat Harkins pushcx

View GitHub Profile
{
:error => {
:code => "missing",
:message => "Cannot charge a customer that has no active card",
:param => "card",
:type => "card_error"
}
}
location ~ ^/(wp-admin|wp-login\.php|priv\.dog|companies\/sidekick) {
deny all;
break;
}
# file extensions that should never be served, this prevents
# potential malicious downloads in case someone manages to manipulate
# a Rails URL or write a file that can be served
# (~* matches case-insensitive)
location ~* \.(?:git|svn|DS_Store|asp|aspx|cgi|pt|pl|idx|php|exe|scpt|AppleScript|dll|dmg|pif|msi|application|msp|com|scr|hta|cpl|gadget|msc|jar|bat|vb|vbs|vbe|ws|wsh|inf|lnk|reg|scf|wsc|wsh|ps1|ps1xml|ps2|ps2xml|psc1|psc2|msh|msh1|msh2|mshxml|msh1xml|msh2xml)$ {
deny all;
entity = Node.new(id: id)
case
when not enity.exists? then fail("Entity doesn't exist")
when not entity.file? then fail("Entity wasn't a file")
when not entity.writable? then fail("Entity wasn't writable")
else entity.write(data)
end
@pushcx
pushcx / Gemfile
Last active August 29, 2015 14:25 — forked from solnic/anima_vs_virtus.rb
source 'https://rubygems.org'
gem 'activerecord'
gem 'anima'
gem 'sqlite3'
gem 'transproc'
gem 'virtus'
gem 'benchmark-ips'
@pushcx
pushcx / t.rb
Created February 13, 2016 14:48
Transaction = Struct.new(:amount, :parent)
t1 = Transaction.new 1, nil
t2 = Transaction.new 2, t1
t3 = Transaction.new 4, t2
t4 = Transaction.new 8, nil
TransactionEnumerator = Struct.new(:ary) do
include Enumerable
@pushcx
pushcx / .vimrc
Created June 1, 2016 13:00
highlight where wrapping will occur, but only in insert mode when wrapping is on
" highlight textwidth column in insert mode
highlight ColorColumn ctermbg=0*
function! HighlightOn()
if &textwidth > 0
" the +1 feature in the 'colorcolumn' docs doesn't work for me
let &colorcolumn=&textwidth + 1
else
let &colorcolumn=""
endif
endfunction
require 'binding_of_caller'
# https://twitter.com/garybernhardt/status/875037876215357440
class ReallyParticularInsantiation
def initialize
b = binding.of_caller(1)
# could also b.eval to get at __FILE__ and __LINENO__
if b.eval('self.class') != Foo or b.eval('__method__') != :try
raise RuntimeError, "I don't even know what to call this coupling"
@pushcx
pushcx / message.md
Last active August 16, 2017 12:41
polite "please stop spamming lobsters" message

I've had a 100% positive response rate sending this to people who see Lobsters as a good place to dump content marketing. Please feel free to take it and use it to help guide people to good behavior.

--

Hey folks,

I’ve liked the articles you’ve written and submitted to Lobsters, thanks for sharing good posts.

A good rule of thumb is that at most half of your submissions and comments should be on your own stuff. Otherwise folks will take your participation as one-way exploitation and start flagging all your stories as spam. Hope this helps, and I look forward to seeing you around the site.

@pushcx
pushcx / migration.md
Last active October 25, 2017 13:25
Lobsters migration checklist

2017-10-25: this few open items of this checklist has been migrated to issues on the ansible repo for better visibility and tracking. This gist is left up in the hopes it's useful for anyone setting up their own site using the lobsters codebase.

Prep

  • announce migration + privacy on twitter
  • Lobsters post: this checklist, privacy deadline, migration date
  • post this plan to lobsters
  • transfer lobste.rs registration to pushcx
  • transfer @lobsters twitter account to pushcx
@pushcx
pushcx / gist:c48f1527f23f46c2bee76e79844c53eb
Last active May 23, 2018 15:43
Lobsters stats on story hiding
+-----------+-----------+
| n_hidings | n_stories |
+-----------+-----------+
| 0 | 19866 |
| 1 | 13070 |
| 2 | 5728 |
| 3 | 1992 |
| 4 | 797 |
| 5 | 384 |
| 6 | 205 |