Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:

Ben Jacobs benmj

:shipit:
View GitHub Profile
@benmj
benmj / .gitconfig
Created Nov 30, 2015
Git configuration with useful aliases
View .gitconfig
$ cat ~/.gitconfig
[gui]
recentrepo = C:/buildium/src/buildiumcode
[user]
email = ben.jacobs@buildium.com
name = Ben Jacobs
[core]
editor = vim
autocrlf = false
[push]
@benmj
benmj / gist:bf27da8d562a13e07de1
Last active Aug 29, 2015
ES6 Angular component
View gist:bf27da8d562a13e07de1
'use strict';
class NavbarCtrl {
constructor ($log) {
$log.log('simplistic example');
}
}
NavbarCtrl.$inject = ['$log'];
View gist:35886b7a898be2af7f1f
// given the markup: <a href="#hashtag" feature-flag="phaseTwo" class="whatevs-yo">don't click</a>
// and the task to "retire" feature flag settings from the markup (ie B-03572)
// grunt feature --retire=phaseTwo
module.exports = function(grunt) {
grunt.initConfig({
dom_munger: {
feature_flags: {
src: ['path/to/views'],
options: {
callback: function($, file) {
View .jshintrc
{
// JSHint Default Configuration File (as on JSHint website)
// See http://jshint.com/docs/ for more details
"maxerr" : 50, // {int} Maximum error before stopping
// Enforcing
"bitwise" : false, // true: Prohibit bitwise operators (&, |, ^, etc.)
"camelcase" : false, // true: Identifiers must be in camelCase
"curly" : true, // true: Require {} for every new block or scope
View gist:9c8670f4819f647ae3b0
function getTemplateAsync (templateName) {
var dfd = $q.defer();
var template = $templateCache.get(templateName);
if (!template) {
$http.get(templateName).success(function (data) {
$templateCache.put(templateName);
dfd.resolve(data);
});
View eval.js
#!/usr/local/bin/node
var not = {};
function printCatch (name) {
try {
console.log(eval(name));
} catch (e) {
console.log("whoops, that isn't defined yet");
setTimeout(printCatch.bind(undefined, name), 0);
View jqueryui.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css">
<title></title>
</head>
View hello.txt
Hello, world!
View style.css
body {
color: red;
font-weight: bold;
}
@benmj
benmj / basic-style-snoop.js
Created Sep 30, 2013
from third party javascript
View basic-style-snoop.js
function getStyle (node, property, camel) {
var value;
if (window.getComputedStyle) {
value = document.defaultView.getComputedStyle(node, null)
.getPropertyValue(property);
} else if (node.currentStyle) {
// IE fallback
value = node.currentStyle[property] ?
node.currentStyle[property] :