Skip to content

Instantly share code, notes, and snippets.

module.exports = function(grunt){
require("matchdep").filter("grunt-*").forEach(grunt.loadNpmTasks);
grunt.initConfig({
wiredep: {
target: {
src:'index.html'
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Untitled</title>
<!-- bower:css -->
<!-- endbower -->
@colintoh
colintoh / bs_bower.json
Created November 13, 2014 10:01
Simplified Bootstrap's bower
{
"name": "bootstrap",
"description": "The most popular front-end framework for developing responsive, mobile first projects on the web.",
"version": "3.3.1",
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js",
"dist/fonts/glyphicons-halflings-regular.eot",
"dist/fonts/glyphicons-halflings-regular.svg",
@colintoh
colintoh / douchebag-vertical-align.css
Created October 27, 2014 07:08
douchebag way of vertical alignment
.element {
position: relative;
top: 50%;
transform: translateY(-50%);
}
@colintoh
colintoh / table.css
Created October 27, 2014 05:42
Table CSS
table { display: table }
tr { display: table-row }
thead { display: table-header-group }
tbody { display: table-row-group }
tfoot { display: table-footer-group }
col { display: table-column }
colgroup { display: table-column-group }
td, th { display: table-cell }
caption { display: table-caption }
var arr = [2,3,4,5,2,4];
//Without Set
var tempArr = arr.filter(function(item,index){
return arr.indexOf(item) == index;
});
console.log(tempArr.length); //4
var alphabet = ["a","d","e","h","i"],
firstSet = ["b","c"],
secondSet = ["f","g"];
//Without Spread operator
Array.prototype.splice.apply(alphabet,[1,0].concat(firstSet)); //[a,b,c,d,e,h,i]
Array.prototype.splice.apply(alphabet,[4,0].concat(secondSet)); //[a,b,c,d,e,f,g,h,i]
console.log("Without Spread Operator: ",alphabet); //[a,b,c,d,e,f,g,h,i]
var register = function(name,age,gender){
console.log([name,age,gender].join(" "));
}
var arr = ["Mary","22","F"];
//Without Spread Operator
register.apply(null,arr); // "Mary 22 F"
//With Spread Operator
//Without Rest Parameters
function rollCall(){
var names = Array.prototype.slice.call(arguments);
names.forEach(function(name){
console.log(name);
});
}
//With Rest Parameters
//Without Default Parameters
function sell(seller, price){
price = price || 2;
seller = seller || "John";
console.log(seller + " is selling at $"+price);
}
//With Default Parameters
function sellWithDefault(seller = "John", price = 2){