This file contains hidden or 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
//$ npm install --global gulp | |
// | |
//$ npm install | |
//$ npm install --save-dev gulp | |
//$ npm install --save-dev gulp-concat | |
//$ npm install --save-dev gulp-uglify | |
//$ npm install --save-dev gulp-cssmin | |
//$ npm install --save-dev gulp-ng-annotate | |
var gulp = require('gulp'), |
This file contains hidden or 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
//$ npm install -g grunt-cli | |
// | |
//$ npm install grunt-contrib-concat --save-dev | |
//$ npm install grunt-contrib-uglify --save-dev | |
//$ npm install grunt-contrib-cssmin --save-dev | |
module.exports = function(grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), |
This file contains hidden or 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
.vdiv | |
{ | |
display:table; | |
position:absolute; | |
width: 100%; | |
height:100%; | |
} | |
.vdiv > div | |
{ |
This file contains hidden or 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 scroll = function(){ | |
if ($(window).scrollTop() + $(window).height() > $(document).height() - 50) { | |
//Do something | |
} | |
} | |
//Add/remove function from $(window) | |
$(window).on('scroll', scroll); | |
$(window).off('scroll', scroll); |
This file contains hidden or 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
if (_button){ | |
_button.action = callback; | |
//Bind params | |
if(params) _button.action = _button.action.bind.apply(_button.action, [null].concat(params)); | |
} |
This file contains hidden or 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
angular | |
.module('myApp') | |
.run(function(){ | |
//The app is initialised. | |
}); | |
//Get Firebase auth | |
var ref = new Firebase('https://<!--FIREBASEURL-->.com'), | |
auth = ref.getAuth(); |
This file contains hidden or 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 () { | |
'use strict'; | |
function $dirtyCheck(){ | |
var watchers = [], | |
dirty = false; | |
return { | |
add: function($scope, model){ | |
if ($scope && model){ | |
var watcher = $scope.$watch(model, function(isDirty) { |
This file contains hidden or 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
//Shared scope | |
function myDirective() { | |
return { | |
restrict: 'EA', | |
templateUrl: 'my-directive.html', | |
transclude: true, | |
scope: false, | |
controllerAs: 'ctrl', | |
link: function(scope, element, attrs, ctrl, transclude) { | |
transclude(scope, function(clone, scope) { |
This file contains hidden or 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
// Here You can type your custom JavaScript... | |
jQuery.fn.highlight = function (str, className) { | |
var regex = new RegExp(str, "gi"); | |
return this.each(function () { | |
$(this).contents().filter(function() { | |
return this.nodeType == 3 && regex.test(this.nodeValue); | |
}).replaceWith(function() { | |
return (this.nodeValue || "").replace(regex, function(match) { | |
return "<span class=\"" + className + "\">" + match + "</span>"; | |
}); |
This file contains hidden or 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
import {Component, Input, ViewChild, ViewContainerRef, ComponentResolver, ComponentFactory} from '@angular/core'; | |
import {Child1Component} from './child1.component'; | |
import {Child2Component} from './child2.component'; | |
@Component({ | |
selector: 'parent', | |
template: ` | |
<div #target></div> | |
` | |
}) |