Skip to content

Instantly share code, notes, and snippets.

package main
import (
"bytes"
"fmt"
"github.com/PuerkitoBio/goquery"
"io/ioutil"
"os"
"regexp"
"strings"
require 'json'
require 'active_support/inflector'
require 'digest'
require 'fileutils'
PACKAGE_PATH = "com.mbildner.domain"
class JavaClass
attr_accessor :name, :body
require 'pry'
all_output = `ag -G ".jsx" "//= require"`
calls = all_output.lines.map do |line|
path = line.split(':').last
.gsub('//= ', '')
.gsub('require_tree ', '')
.gsub('require ', '')
.gsub(/\r/, '')
<div ng-app="myApp">
<div ng-controller="MyCtrl">
<div ng-repeat="n in names track by n[$index]">
{{n}} {{$index}} {{$even}} {{$first}} {{$last}}
</div>
</div>
</div>
'use strict';
module.exports = function(global){
function set (key, val) {
var valFunc = (typeof val === 'function' ? val : function () { return val; }).bind(global);
global.__defineGetter__(key, valFunc);
}
function SET (key, val) {
global[key] = val;
@mbildner
mbildner / super_simple_parser.js
Last active August 29, 2015 14:25
a super simple parser
'use strict';
var ACCESS_REGEX = /[\[\]\.]/;
var BOOLEAN_REGEX = /^(true|false)$/;
var NUMBER_REGEX = /^[+-]?(\d*\.)?\d+$/;
var DOUBLE_QUOTE_REGEX = /^".*"$/;
var SINGLE_QUOTE_REGEX = /^'.*'$/;
var NULL_REGEX = /^null$/;
function getType (str) {
@mbildner
mbildner / sayit.sh
Created July 21, 2015 18:08
speak previous commit message
git log -1 | cut -d"|" -f 2 | say
@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
@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 / 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';});})();