Skip to content

Instantly share code, notes, and snippets.

View bcherny's full-sized avatar

Boris Cherny bcherny

View GitHub Profile
@bcherny
bcherny / gist:8405113
Created January 13, 2014 18:09
Sublime user settings
{
"color_scheme": "Packages/Dayle Rees Color Schemes/Github.tmTheme",
"font_size": 12.0,
"ignored_packages":
[
"Vintage"
],
"theme": "Soda Light.sublime-theme"
}
@bcherny
bcherny / gist:8790541
Last active August 29, 2015 13:56
useful git combinators
# rebase from master, deferring to master
git rebase master -s recursive -X theirs
# see diff between 2 branches
git diff --name.status master..branch
# .. or alternatively,
git diff --stat --color master..branch
# merge into a branch from another one, squashing all commits into one
@bcherny
bcherny / angular-style.md
Last active August 29, 2015 13:56
Front End Style Guide - Angular

This is a work in progress - please modify and comment!

Coding Style

  • Any HTML templates should live in separate files in the "/template" directory, rather than as inline strings
    • PREREQUISITE: [ ] pre-compile and bundle templates with grunt to avoid proliferation of XHR requests
  • Use minimal plugin configs (eg. gridOptions for ng-grid): defer to defaults where possible. Same goes for other plugins - avoid lengthy configs where possible
  • Use extend, in order to add structure to property declarations:

// before

@bcherny
bcherny / ng-grid-gotchas.md
Last active August 29, 2015 13:56
ng-grid gotchas

1. To set minWidth or maxWidth, you need to set width to auto as well

good:

...
columnDefs: [
   { field: 'foo', width: 100 },
   { field: 'bar', width: 'auto', minWidth: 100 },  
 { field: 'baz', width: 'auto', maxWidth: 100 },
@bcherny
bcherny / why_ng-grid_sucks.md
Last active November 29, 2016 23:46
Why ng-grid sucks

ng-grid 2.0.7

  • 359 open issues, 688 closed issues
  • 147 unit tests total (3 failed)
  • Code coverage (after updating outdated karma and karma.conf.js):
    • Statements: 4.23% (80 / 1892)
    • Branches: 0.31% (3 / 970)
    • Functions: 0.32% (1 / 308)
    • Lines: 4.23% (80 / 1890)
@bcherny
bcherny / gist:11231643
Last active August 29, 2015 14:00
Extract version from package.json
egrep '"version":' ./package.json | cut -d '"' -f4
/////////// option 1 //////////////////
// both turntable and the consumer can mutate this object, potentially breaking functionality:
$scope.params = {
limit: 100,
offset: 0,
searchString: '',
sortCriteria: 'country',
sortDirection: 'DESC'
};
function fetch (id) { ... }
var ids = [1,2,3,4];
$q
.all(ids.map(fetch))
.then( ... );