This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function compareBy(a, b) { | |
return (a || b) ? (!a ? -1 : !b ? 1 : a.localeCompare(b)) : 0; | |
} | |
array.sort((a, b) => compareBy(a.prop1, b.prop1) || compareBy(a.prop2, b.prop2) || etc...); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Default stylesheet. Taken from https://gist.github.com/elgervb/00359968425a6eecdd1d1c80d87d3886 */ | |
html { | |
box-sizing: border-box; | |
font-size: 16px; | |
-ms-text-size-adjust: 100%; | |
-webkit-text-size-adjust: 100%; | |
} | |
*, *:before, *:after { | |
box-sizing: inherit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default class PromiseRequest { | |
get(url, data) { | |
return this.request('GET', url, data); | |
} | |
post(url, data) { | |
return this.request('POST', url, data); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var resizeTimer; | |
$(window).on('resize', function(e) { | |
clearTimeout(resizeTimer); | |
resizeTimer = setTimeout(function() { | |
// Run code here, resizing has "stopped" | |
}, 250); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loaders: [ | |
{ | |
test: /worker\.js$/, | |
exclude: [/node_modules/], | |
loaders: ['babel', 'worker?name=js/[name].js'], // same as output.filename | |
}, | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hack for equal column height, together with parent display: table; | |
.row-eq-height { | |
display: table; | |
margin-left: 0; | |
margin-right: 0; | |
width: 100%; | |
> [class*="col-"] { | |
float: none; | |
display: table-cell; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Truncate the current element with a ellipsis over a fixed number of lines when it does not fit | |
* | |
* @param {strimg} $lineHeight The line height with unit (1em, 1.785rem, 25px) | |
* @param {number} $lineCount The number of lines to show | |
* @param { | |
* | |
* @see http://hackingui.com/front-end/a-pure-css-solution-for-multiline-text-truncation/ | |
*/ | |
@mixin wrap-ellipsis-multiline($lineHeight: 1.2em, $lineCount: 1, $bgColor: #ffffff){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Register a debug helper for Handlebars to be able to log data or inspect data in the browser console | |
* | |
* Usage: | |
* {{debug someObj.data}} => logs someObj.data to the console | |
* {{debug someObj.data true}} => logs someObj.data to the console and stops at a debugger point | |
* | |
* https://gist.github.com/elgervb/5c38c8d70870f92ef6338a291edf88e9 | |
* | |
* @param {any} the data to log to console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phantomjs = require('phantomjs-prebuilt/bin/phantomjs'); | |
var page = require('webpage').create(); | |
page.open('http://github.com/', function() { | |
page.render('github.png'); | |
phantom.exit(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Wraps a match inside a string between <b>...</b> tags | |
* | |
* Example: | |
* $filter('filtername').('match'); | |
* | |
* Note: make sure you'll render this using ng-bind-html (in a repeater you'll probably must use ng-if as well, or otherwise all nodes will be rendered (empty when no match)) | |
*/ | |
class MarkSelectedFilter { | |