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
<script> | |
window.ondevicemotion = function(event) { | |
if (navigator.platform.indexOf("This device is an iPad") != -1) { | |
var version = 1; | |
if (event.acceleration) version += window.devicePixelRatio; | |
document.getElementById('info').innerHTML = version; | |
} | |
window.ondevicemotion = null; | |
} | |
</script> |
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
{% extends "base.html" %} | |
{% load i18n %} | |
{% block link %} | |
<script data-require="[email protected]" data-semver="1.2.0-rc3-nonmin" src="http://code.angularjs.org/1.2.0-rc.3/angular.js"></script> | |
<script src="http://code.angularjs.org/1.2.0-rc.3/angular-sanitize.min.js"></script> | |
<script src="/angular/myApp.js"></script> | |
{% endblock link %} | |
{% block content %} |
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
{% extends "base.html" %} | |
{% load i18n %} | |
{% block link %} | |
<script data-require="[email protected]" data-semver="1.2.0-rc3-nonmin" src="http://code.angularjs.org/1.2.0-rc.3/angular.js"></script> | |
<script src="http://code.angularjs.org/1.2.0-rc.3/angular-sanitize.min.js"></script> | |
<script src="/angular/myApp.js"></script> | |
{% endblock link %} | |
{% block content %} |
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
// Instructions for setting up IONIC on Ubuntu non-numbered step are needed for use of Virtual Box only! | |
// Revised: 08/22/2014 | |
// Revisor: Brad Newman | |
// To create your mounted folder: | |
sharename="whatever.you.want.to.call.it"; | |
sudo mkdir /mnt/$sharename | |
sudo chmod 777 /mnt/$sharename | |
sudo mount -t vboxsf -o uid=1000,gid=1000 $sharename /mnt/$sharename |
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 sumAll(arr) { | |
var sum = 0; | |
var maxNum = Math.max.apply(null, arr); | |
var minNum = Math.min.apply(null, arr); | |
console.log(maxNum); | |
console.log(minNum); | |
for(var i = minNum; i <= maxNum; i++){ |
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 ObservableArray(items) { | |
var _self = this, | |
_array = [], | |
_handlers = { | |
itemadded: [], | |
itemremoved: [], | |
itemset: [] | |
}; | |
function defineIndexProperty(index) { |
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
/** | |
* Example: Type Annotation | |
* | |
* Type annotations remove the need for the compiler to infer the type. | |
* | |
* Available Types: | |
* Boolean: simple true/false value | |
* Number: floating point values | |
* String: textual 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
/*** | |
* Actions Example | |
* | |
* Here you can see "addClient" method dispatching a change to the | |
* Reducers in order the record the new state change. | |
***/ | |
@Injectable() | |
export class ClientActions { | |
constructor( |
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
// Object.freeze() will not freeze nested objects. The function below | |
// will freeze all nested objects for immutability. | |
let isObject = (val) => val && typeof val === 'object'; | |
function deepFreezeObject(obj) { | |
if(isObject(obj) && !Object.isFrozen(obj)){ | |
// Recusively call until all child objects are frozen | |
Object.keys(obj).forEach(name => deepFreezeObject(obj[name])); | |
Object.freeze(obj); | |
} |
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
// Because the applyOperation function accepts a function as an argument, it is | |
// considered a higher order function. | |
function applyOperation(a, b, opt) { | |
return opt(a, b); | |
} | |
let multiplier = (a, b) => a * b; | |
applyOperation(2, 3, mulptiplier); // 6 |
OlderNewer