Skip to content

Instantly share code, notes, and snippets.

View kenkouot's full-sized avatar

Ken kenkouot

  • San Francisco, CA
View GitHub Profile
@kenkouot
kenkouot / gist:4696826
Last active December 12, 2015 02:09
angular & require shim config
require.config({
shim: {
'lib/angular/angular': { deps: ['lib/jquery-1.9.0'], exports: 'angular' }
, 'lib/angular/angular-resource': { deps: ['lib/angular/angular'], exports: 'ngResource' }
, 'lib/jquery-1.9.0': { deps: [], exports: 'jQuery, $' }
, 'lib/d3': { deps: ['lib/jquery-1.9.0'] }
, 'bootstrap': { deps: ['lib/angular/angular', 'app'] }
, 'directives/d3.donutCharts': { deps: ['d3', 'app' ] }
, 'controllers/socialFeed': { deps: ['lib/angular/angular','app' ] }
, 'controllers/keywordsCtrl': { deps: ['app'] }
@kenkouot
kenkouot / gist:8941869
Last active August 29, 2015 13:56
Examples of different whitespace styles. I argue that the first style needlessly adds whitespace between symbols that don't improve readability and might even be confusing do to no precedent for such aggressive whitespace being present in C-like languages. An example of this can be seen on `ln 15`.
// Aggressive Whitespace - Cannot find industry precedent for this style
// Invocations
foo( 'bar' );
foo( { key: 'prop' } );
foo( { key: getValue( 'foo' ) } );
// Examples of operator precedence clarification wrapping
if ( ( x * y ) + 1 > ( z / 2 ) ) { /* ... */ }
@kenkouot
kenkouot / pre-commit
Last active August 29, 2015 13:59
Run JS code quality tools as precommit hook. Add in your repos ".git/hooks/" directory. Make sure file is named "precommit" (with no extension). After to add this into your hooks folder, make sure that the file has executable permissions.
#!/usr/bin/env python
import subprocess
import sys
import os.path, time
def get_modified_time(file):
return time.ctime(os.path.getmtime(file))
def run_js_tools(files_str):
"""Iterate though list and run code quality tools"""
<polymer-element name="t-bar" attributes="logoSrc logoHref">
<template>
<div class="row">
<div class="large-12 columns">
<a href="{{logoHref}}"><img src="{{logoSrc}}" class="logo left"></a>
<content></content>
</div>
</div>
</template>
<script>