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
people = [ | |
{name: 'Mary', gender: 'girl'}, | |
{name: 'Paul', gender: 'boy'}, | |
{name: 'John', gender: 'boy'}, | |
{name: 'Lisa', gender: 'girl'}, | |
{name: 'Bill', gender: 'boy'}, | |
{name: 'Maklatura', gender: 'girl'} | |
] | |
var numBoys = people.reduce(function (n, person) { |
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
@Component({ | |
selector: 'app-actions', | |
templateUrl: './actions.component.html', | |
styleUrls: ['./actions.component.scss'], | |
animations: [ | |
trigger('slideInOut', [ | |
state('in', style({ | |
'max-height': '500px', 'opacity': '1', 'visibility': 'visible' | |
})), | |
state('out', style({ |
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 uniqueArray = function(arrArg) { | |
return arrArg.filter(function(elem, pos,arr) { | |
return arr.indexOf(elem) == pos; | |
}); | |
}; | |
var uniqEs6 = (arrArg) => { | |
return arrArg.filter((elem, pos, arr) => { | |
return arr.indexOf(elem) == pos; | |
}); |
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
#!/bin/bash | |
if [ "$GIT_SSH_KEY" != "" ]; then | |
echo "Cleaning up SSH config" >&1 | |
echo "" >&1 | |
# Now that npm has finished running, | |
# we shouldn't need the ssh key/config anymore. | |
# Remove the files that we created. | |
rm -f ~/.ssh/config | |
rm -f ~/.ssh/deploy_key |
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
import {Injectable, provide} from 'angular2/core'; | |
import {Observable} from 'rxjs'; | |
const GEOLOCATION_ERRORS = { | |
'errors.location.unsupportedBrowser': 'Browser does not support location services', | |
'errors.location.permissionDenied': 'You have rejected access to your location', | |
'errors.location.positionUnavailable': 'Unable to determine your location', | |
'errors.location.timeout': 'Service timeout has been reached' | |
}; |
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
/** | |
* Sort JavaScript Object | |
* CF Webtools : Chris Tierney | |
* obj = object to sort | |
* order = 'asc' or 'desc' | |
*/ | |
function sortObj( obj, order ) { | |
"use strict"; | |
var key, |
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
angular.module('restangularDemoApp', [ | |
'restangular', | |
'ngCookies' | |
]) | |
.constant('apiKey', 'YOUR_Mongolab_API_KEY') | |
.config(function(RestangularProvider, apiKey) { | |
RestangularProvider.setBaseUrl('https://api.mongolab.com/api/1/databases/YOURDATABASE/collections'); | |
RestangularProvider.setDefaultRequestParams({ | |
apiKey: apiKey | |
}) |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>AngularJS Sorting & Filtering Example</title> | |
<style type="text/css"> | |
body{ font:12px arial, sans-serif; line-height:1.6em; margin:0 auto; max-width:960px; } |
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 http = require("http"), | |
url = require("url"), | |
path = require("path"), | |
fs = require("fs") | |
port = process.argv[2] || 8888; | |
http.createServer(function(request, response) { | |
var uri = url.parse(request.url).pathname | |
, filename = path.join(process.cwd(), uri); |
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
angular.module('testApp', []). | |
directive('lazyLoad', ['$window', '$q', function ($window, $q) { | |
function load_script() { | |
var s = document.createElement('script'); // use global document since Angular's $document is weak | |
s.src = 'https://maps.googleapis.com/maps/api/js?sensor=false&callback=initialize'; | |
document.body.appendChild(s); | |
} | |
function lazyLoadApi(key) { | |
var deferred = $q.defer(); | |
$window.initialize = function () { |