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
<body ng-controller="DemoController as demo"> | |
<div id="directiveLife"> | |
<directive-life count="1"> | |
</directiveLife> | |
</div> | |
</body> |
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
/* | |
* safeApply | |
*/ | |
commonModule.factory('SafeApply', function ($rootScope) { | |
return function (scope, fn) { | |
var phase = scope.$root.$$phase; | |
if (phase == '$apply' || phase == '$digest') { | |
if (fn && (typeof(fn) === 'function')) { | |
fn(); | |
} |
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
// http://stackoverflow.com/a/10627148 | |
function toggleFullScreen() { | |
if ((document.fullScreenElement && document.fullScreenElement !== null) || | |
(!document.mozFullScreen && !document.webkitIsFullScreen)) { | |
if (document.documentElement.requestFullScreen) { | |
document.documentElement.requestFullScreen(); | |
} else if (document.documentElement.mozRequestFullScreen) { | |
document.documentElement.mozRequestFullScreen(); | |
} else if (document.documentElement.webkitRequestFullScreen) { | |
document.documentElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT); |
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 mongo = require('mongodb').MongoClient; | |
var url = 'mongodb://localhost:27017/learnyoumongo'; | |
var age = process.argv[2]; | |
mongo.connect(url,function(err, db){ | |
if(err) throw err; | |
var parrots = db.collection('parrots'); | |
parrots.find({ | |
age:{ | |
$gt: +age | |
} |
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 mongo = require('mongodb').MongoClient; | |
var url = 'mongodb://localhost:27017/learnyoumongo'; | |
var age = process.argv[2]; | |
mongo.connect(url,function(err, db){ | |
if(err) throw err; | |
var parrots = db.collection('parrots'); | |
parrots.find({ | |
age: { | |
$gt: +age | |
} |
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 mongo = require('mongodb').MongoClient; | |
var url = 'mongodb://localhost:27017/'+ process.argv[2]; | |
mongo.connect(url, function(err,db){ | |
if(err) throw err; | |
var col = db.collection(process.argv[3]); | |
col.remove({ | |
_id: process.argv[4] | |
},function(err,data){ | |
console.log(data.result); | |
if(err) throw err; |
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 mongo = require('mongodb').MongoClient; | |
var dbName = process.argv[2]; | |
var url = 'mongodb://localhost:27017/'+dbName; | |
mongo.connect(url, function(err, db){ | |
if(err) throw err; | |
var col = db.collection('users'); | |
col.update({ | |
username: 'tinatime' | |
},{ | |
$set: { |
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 mongo = require('mongodb').MongoClient; | |
var dbName = process.argv[2]; | |
var url = 'mongodb://localhost:27017/'+dbName; | |
mongo.connect(url, function(err, db){ | |
if(err) throw err; | |
var col = db.collection('users'); | |
col.update({ | |
username: 'tinatime' | |
},{ | |
$set: { |
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 mongo = require('mongodb').MongoClient; | |
var age = process.argv[2]; | |
var url = 'mongodb://localhost:27017/learnyoumongo'; | |
mongo.connect(url, function(err, db){ | |
if(err) throw err; | |
var parrots = db.collection('parrots'); | |
parrots.count({ | |
age: { |
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 mongo = require('mongodb').MongoClient; | |
var url = 'mongodb://localhost:27017/learnyoumongo'; | |
var size = process.argv[2]; | |
mongo.connect(url, function(err,db){ | |
if(err) throw err; | |
var prices = db.collection('prices'); | |
prices.aggregate([{ | |
$match: { | |
size: size | |
} |
OlderNewer