Skip to content

Instantly share code, notes, and snippets.

View gist:f1fb015e38f50e82d30b8c69b67faa74
# Warning: this file is kind of a mess at the moment
import json
import csv
import requests
import re
import time
import subprocess
View apple-pay-demo.js
var session
if (window.ApplePaySession) {
var merchantIdentifier = ''
.then(function (canMakePayments) {
if (canMakePayments) {
jeffcarp /
Last active Jul 25, 2016
Development Practices

Development Practices

This is currently an unstructured dump of development practices across all of the projects I maintain. I will probably link here in the of each repo.

Reporting bugs

Depending on how much time you have, in order of preferredness:

  1. Submit a PR that fixes the bug and includes tests
  2. Submit a PR with failing tests that demonstrates the bug

Keybase proof

I hereby claim:

  • I am jeffcarp on github.
  • I am gccv ( on keybase.
  • I have a public key whose fingerprint is 2A47 25AE 39FC 881D 1A29 0273 BEAB 00E2 A10B 2BAB

To claim this, I am signing this object:

View kata13.clj
(use '
(defn debug [expr str]
(println str expr)
(identity expr)))
(defn basic-comment? [str]
(not (empty? (re-seq #"^\s*\/\/" str))))
jeffcarp / gist:6959725
Last active Dec 25, 2015
Max Consecutive Sum (problem of the week on
View gist:6959725
(defun max_consecutive_sum (arr)
(let ((max_ending_here 0) (max_so_far 0))
(dotimes (x (length arr))
(setf max_ending_here (max 0 (+ (aref arr x) max_ending_here)))
(setf max_so_far (max max_so_far max_ending_here)))
(format t "~S~%" (max_consecutive_sum #(-1 5 6 -2 20 -50 4))) ; 29
(format t "~S~%" (max_consecutive_sum #(-2 1 -3 4 -1 2 1 -5 4))) ; 6
jeffcarp / gist:6618224
Last active Dec 23, 2015
Color your git branch green or red based on whether you have uncommitted changes. (Put it in your ~/.bash_profile)
View gist:6618224
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
branch_colorize () {
if [ -d .git ]
jeffcarp / generic.scss
Last active Mar 31, 2016
Idea for generating generic classes in Sass
View generic.scss
@mixin space($type, $name, $size: 1em) {
$prefix: '';
@if $type == 'padding' { $prefix: 'p'; }
@if $type == 'margin' { $prefix: 'm'; }
.#{$prefix}#{$name} { #{$type}: $size; }
.#{$prefix}#{$name}t { #{$type}-top: $size; }
.#{$prefix}#{$name}l { #{$type}-left: $size; }
jeffcarp / reset.css
Created Feb 15, 2013
My current reset.css
View reset.css
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
abbr, address, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strong, sub, sup, var,
b, i,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, figure, footer, header,
View gibberish.js
// Generate a random string of characters
function gibberish(max_length) {
var gibberish = '';
var ascii;
while (max_length > 0) {
ascii = Math.floor(Math.random()*58)+65;
if (ascii >= 91 && ascii <= 96) continue;
gibberish += String.fromCharCode(ascii);
max_length -= 1;