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 ($) { | |
function download(strData, strFileName, strMimeType) { | |
var D = document, | |
A = arguments, | |
a = D.createElement("a"), | |
d = A[0], | |
n = A[1], | |
t = A[2] || "text/plain"; | |
//build download link: |
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
// 3.2 | |
posts.insert(post, function (err, result) { | |
"use strict"; | |
if (!err) { | |
console.log("Inserted new post"); | |
return callback(null, permalink); | |
} | |
return callback(err, null); |
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 MongoClient = require('mongodb').MongoClient; | |
MongoClient.connect('mongodb://localhost:27017/school', function(err, db) { | |
if(err) throw err; | |
var cursor = db.collection('students').find().sort({'name': -1, 'scores': -1}); | |
cursor.each(function(err, doc) { | |
if(err) throw err; |
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 MongoClient = require('mongodb').MongoClient; | |
MongoClient.connect('mongodb://localhost:27017/weather', function(err, db) { | |
if(err) throw err; | |
var cursor = db.collection('data').find().sort({'State': 1, 'Temperature': -1}).batchSize(5000); | |
var prevState = ''; | |
cursor.each(function(err, doc) { | |
if(err) throw err; |
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 MyObject = (function () { | |
function extend(Child, Parent) { | |
var F = function() { } | |
F.prototype = Parent.prototype | |
Child.prototype = new F() | |
Child.prototype.constructor = Child | |
Child.superclass = Parent.prototype | |
} | |
function ParentObject () { |
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 Module = (function () { | |
// Private Scope | |
var privateVar; | |
function firstMethod () { | |
} | |
function secondMethod () { |
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( $ ){ | |
var pluginName = 'pluginName'; | |
var self; | |
// list of methods in your plugin | |
var methods = { | |
init : function( options ) { | |
return self.each(function () { |