Skip to content

Instantly share code, notes, and snippets.

@mbildner
mbildner / json_stringify.js
Created February 14, 2015 03:38
quick and dirty implementation of JSON.stringify in JavaScript
;(function () {
'use strict';
var UNSAFE_STR_REGEX = /[\n\r]+/;
var SUPPORTED_TYPES = [
'array',
'object',
'boolean',
'string',
@mbildner
mbildner / dev.md
Created February 20, 2015 16:32
list of tools I rely on in a dev environment

[] Sublime Text 2 [] iPython [] iPython Notebook [] Node [] npm [] sublime bracket highlighter [] sublime linter [] gopath [] golang

<html>
<head>
<title>todo app</title>
</head>
<body>
<h2>Todo Items</h2>
<ul id="todo-list"></ul>
<input id="add-item-input">
<html>
<head>
<title>angular js todo</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.3.13/angular.min.js"></script>
</head>
<body ng-app="todoApp">
<div ng-controller="TodoListController">
<h2>Todo Items</h2>
<ul>
@mbildner
mbildner / freeze_not_throwing.js
Created February 25, 2015 19:44
Can't figure out why node won't throw in strict mode, when I modify a frozen data structure.
;(function (global) {
'use strict';
function getType (obj) {
if (typeof obj === 'string') {
return 'string';
}
else if (typeof obj === 'number') {
return 'number';
}
else if (Array.isArray(obj)) {
@mbildner
mbildner / react-gulpfile.js
Created March 7, 2015 18:45
starting to play with react
'use strict';
var gulp = require('gulp');
var concat = require('gulp-concat');
var react = require('gulp-react');
var DIST_DIR = 'public/dist/';
gulp.task('default', ['build-jsx', 'build-vendor']);
@mbildner
mbildner / fix-tab-order.js
Created April 26, 2015 15:17
Fix google search results tab order
;(function(document){
'use strict';
function qsArr (qsString) {
return [].slice.call(document.querySelectorAll(qsString));
}
function getSearchResults () {
return qsArr('#rso h3 a');
}
@mbildner
mbildner / comic_sans_mail.js
Created May 27, 2015 16:05
Comic Sans Bookmarklet
javascript:(function(){[].slice.call(document.querySelectorAll('*')).forEach(function(q){q.style.fontFamily='"Comic Sans MS", cursive, sans-serif';});})();
@mbildner
mbildner / ipregex
Last active August 29, 2015 14:22
regex to find broadcast ip address
/inet\s{1}(?!127\.0\.0\.1)(.*?)\s/
ifconfig | grep 'inet\s' | grep -v 127 | cut -d' ' -f 2
@mbildner
mbildner / clean_remote_branches.rb
Last active August 29, 2015 14:23
kill remote branches over N days old
require 'date'
MAX_DAYS_AGO = 8
class Branch
attr_accessor :name
def initialize(name)
@name = name
end