Skip to content

Instantly share code, notes, and snippets.

@yob
yob / gist:10012899
Last active August 29, 2015 13:58 — forked from schacon/gist:942899
Delete remote git branches that have been merged into origin/master
$ git branch -r --merged origin/master |
grep origin |
grep -v '>' |
grep -v master |
xargs -L1 |
cut -d "/" -f 2 |
xargs git push origin --delete
@yob
yob / gist:df9e112c9bc1319d0845
Created September 18, 2014 03:04
keybase.md
### Keybase proof
I hereby claim:
* I am yob on github.
* I am jimhealy (https://keybase.io/jimhealy) on keybase.
* I have a public key whose fingerprint is CB6C A538 D085 4682 56D9 DFFA 359A 8D52 F03A D7E5
To claim this, I am signing this object:
======================
Version: Powershop (1.10.0) (Android; API Level: 19; Screen: Point(1080, 1776))
Environment: Live
User Agent: Dalvik/1.6.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P)
null
======================
[E305] PIN required
@yob
yob / log-socket-queue
Created April 15, 2015 06:43
Log the size of the unicorn socket queue
#!/usr/bin/env ruby
# Run this to log the current state of the unicorn UNIX socket to disk.
#
# USAGE:
#
# ./bin/log-socket-data
#
require File.expand_path('../../config/boot', __FILE__)
@yob
yob / rubocop.yml
Created April 20, 2015 04:21
TC rubocop config (for rubocop 0.28)
require: rubocop-rspec
# These are all the cops that are enabled in the default configuration.
AllCops:
RunRailsCops: true
AccessModifierIndentation:
Enabled: true
EnforcedStyle: indent
@yob
yob / bar.json
Created June 7, 2015 03:50
JSON data
{
"bar_title": "something else",
"bar_id": 1,
"count": 2500
}
@yob
yob / foo.go
Last active August 29, 2015 14:22
type (
record struct {
Count int64
Id int64
Title string
}
)
func (rec *record) UnmarshalJSON(b []byte) (err error) {
var obj map[string]interface{}
@yob
yob / cmds
Last active August 29, 2015 14:24
phraseapp API via curl
# list projects
curl -A "<ourdomain.com>" -u "<apikey>:" "https://api.phraseapp.com/v2/projects" | jq .
# list locales in a project
curl -A "<ourdomain.com>" -u "<apikey>:" "https://api.phraseapp.com/v2/projects/<project-id>/locales" | jq .
# untranslated keys for a given locale
curl -A "<ourdomain.com>" -u "<apikey>:" "https://api.phraseapp.com/v2/projects/<project-id>/keys?locale_id=<locale-id>&q=translated:false" | jq .
@yob
yob / paypal_controller.rb
Last active August 29, 2015 14:25
Receiving and verifying a paypal IPN in rails
class PaypalController < ApplicationController
def callback
Delayed::Job.enqueue Jobs::VerifyPaypalIpn.new(request.raw_post)
ensure
# Always respond with HTTP 200, anything else encourages the API to retry
render nothing: true, status: 200, content_type: 'text/html'
end
end
@yob
yob / sharejs.txt
Created August 11, 2015 01:42
Notes on sharejs versions
Snapshot - a specific version of a document
Operation - a diff between snapshots
The "v" property of snapshots and operations have slightly different meanings.
snapshot 0 - the initial, empty doc
snapshot 1 - the document after applying operation 0
operation 0 - applies to snapshot 0, produces snapshot 1