Skip to content

Instantly share code, notes, and snippets.

Brent Fitzgerald burnto

View GitHub Profile
@burnto
burnto / gist:8d2f43d4de5f8e09de16
Last active Aug 29, 2015
How to create a This. bookmarklet on mobile Safari.
View gist:8d2f43d4de5f8e09de16

It's a couple extra steps, but really not too hard.

  1. Create a bookmark for "This." and save it.

  2. Go back to your bookmarks and tap "Edit".

  3. Select your "This." bookmark.

  4. Replace the URL with the following:

    javascript:%28function %28d%2Cs%2Cp%29 %7Bd %3D document%3Bif %28typeof this_counter_8532 %21%3D%3D %27undefined%27%29 %7Bp %3D d.getElementById%28%27this-modal-%27 %2B this_counter_8532%29%3Bif %28p%29 %7Bp.parentNode.removeChild%28p%29%3Breturn%3B%7D%7Dthis_counter_8532%3DparseInt%28Math.random%28%29 %2A 100000%29 %2B 123456%3Bs %3D d.createElement%28%27script%27%29%3Bs.type %3D %27text%2Fjavascript%27%3Bs.setAttribute%28%27src%27%2C %27https%3A%2F%2Fthis.cm%2Fbookmarklet%2Fshim%2F%27 %2B this_counter_8532%29%3Bd.body.appendChild%28s%29%3B%7D%29%28%29%3B
    
View Scanner.swift
import Foundation
let ScanLines = RegExScanFn("\n|\r|\r\n")
let ScanWords = RegExScanFn("\\s")
func RegExScanFn(regex : String) -> ((String) -> (String, String?)) {
return { (s : String) -> (String, String?) in
let ns = s as NSString
let location = ns.rangeOfString(regex, options: .RegularExpressionSearch).location
if location != NSNotFound {
View gist:98f173d708d24a2b4402
+—— ——+
| |
| |
+—— ——+
+—— ——+ +————————————————+ +—— ——+ +—— ——+
| | | |
View gist:ecde72ad2219efde3ee5
### Keybase proof
I hereby claim:
* I am burnto on github.
* I am bpf (https://keybase.io/bpf) on keybase.
* I have a public key whose fingerprint is 3A07 955D 0179 6DB9 57CE 3ECA 2992 B9AD 20A5 900B
To claim this, I am signing this object:
View gist:4636823
I am a new gist.
I have very long lines.
I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines. I have very long lines.
@burnto
burnto / wordmatch.py
Created Nov 21, 2012
Get all words matching a pattern
View wordmatch.py
import re
def match(pattern):
"""
>>> match(' x ')
['axe', 'oxy']
>>> match('c m n l')
['communal', 'criminal', 'crumenal', 'culminal']
"""
r = re.compile('^' + re.sub(' ', '.', pattern) + '$', re.IGNORECASE)
@burnto
burnto / seeking_engineers.rst
Last active Aug 2, 2016 — forked from lumberlabs/seeking_engineers.rst
card.io opportunities at PayPal
View seeking_engineers.rst

Wanted: Talented engineering colleagues

We are an engineering team working on mobile payments at PayPal in San Jose. Acquired by PayPal in July 2012, card.io's founders were early employees at AdMob, and are now building software to enable simple, low-friction transactions on a mobile device.

Why you might want to work with us:
  • Tackle interesting, hard technical problems with immediate real world application.
  • Maintain a work-life balance and have fun.
  • Generous comp, benefits, and vacation.
@burnto
burnto / deep_dict_apply.py
Created Apr 6, 2012
A nasty deep dictionary apply utility
View deep_dict_apply.py
def deep_dict_apply(d, k_fn=None, v_fn=None):
"""
>>> def k_fn(key):
... return str(key) + "_k"
>>> def v_fn(value):
... return str(value) + "_v"
>>> dictionary = {1: {2: {3: 'hello'}}, 4: 'world'}
>>> deep_dict_apply(dictionary, k_fn, v_fn)
{'4_k': 'world_v', '1_k': {'2_k': {'3_k': 'hello_v'}}}
>>> deep_dict_apply(dictionary, k_fn)
@burnto
burnto / lumberlabs_cardio_engineering_jobs.md
Created Apr 6, 2012 — forked from lumberlabs/seeking_engineers.rst
Opportunities for talented engineers at Lumber Labs / card.io
View lumberlabs_cardio_engineering_jobs.md

Opportunities for talented engineers at Lumber Labs / card.io

Lumber Labs is a mobile payments start-up located in San Francisco. We create card.io – consumer apps and developer tools that enable simple, low-friction transactions on mobile devices. Company founders were early employees at AdMob. We are venture-funded, growing, and looking for exceptional colleagues.

Why Lumber Labs?

  • Tackle interesting, hard technical and design problems with immediate real world application.
  • Maintain a work-life balance. Enjoy every day, spend time with your friends and family, have fun at work.
  • Generous compensation, benefits, and vacation.
@burnto
burnto / sample_cardio_phonegap.html
Created Apr 4, 2012
Sample code using card.io PhoneGap plugin
View sample_cardio_phonegap.html
<h1>Scan Example</h1>
<p><button id='scanBtn'>Scan now</button></p>
<script type="text/javascript">
function onDeviceReady() {
var onCardIOComplete = function(response) {
console.log("card.io scan result: " + response.card_number);
// response fields include card_type, redacted_card_number,
// card_number, expiry_month, expiry_year, cvv, zip
You can’t perform that action at this time.