Skip to content

Instantly share code, notes, and snippets.

View mlrawlings's full-sized avatar

Michael Rawlings mlrawlings

View GitHub Profile
@jscheel
jscheel / chrome-node-devtools-refresh.sh
Created November 18, 2016 18:35
Temporary hack to refresh the node inspector devtools without having to worry about the constantly-changing uuid. Only works in OSX. Use an iTerm2 trigger to run script automatically.
#!/bin/bash
######################################################################################
# regex for iterm2:
# chrome-devtools\:\/\/devtools\/remote\/serve\_file\/\@[a-f0-9]*\/inspector\.html\?experiments\=true\&v8only\=true\&ws\=localhost\:9229\/[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}
#
# command for iterm2:
# /path/to/script/chrome-devtools-refresh.sh "\0" [-h "example.com"]
######################################################################################
@ShirtlessKirk
ShirtlessKirk / luhn.js
Last active January 6, 2025 16:01
Luhn validation algorithm
/**
* Luhn algorithm in JavaScript: validate credit card number supplied as string of numbers
* @author ShirtlessKirk. Copyright (c) 2012.
* @license WTFPL (http://www.wtfpl.net/txt/copying)
*/
var luhnChk = (function (arr) {
return function (ccNum) {
var
len = ccNum.length,
bit = 1,