Skip to content

Instantly share code, notes, and snippets.

@twinsdbv
twinsdbv / instagram.js
Created March 7, 2017 18:03
Instagram download
(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:
// 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);
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;
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;
@twinsdbv
twinsdbv / MyObjectProrotype
Created April 20, 2015 20:44
Javascript OOP - prototype in IIF
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 () {
@twinsdbv
twinsdbv / gist:f1c76580377171fcf514
Last active May 26, 2022 08:43
Immediately Invoked Function
var Module = (function () {
// Private Scope
var privateVar;
function firstMethod () {
}
function secondMethod () {
@twinsdbv
twinsdbv / gist:4cfbd08b1ff3b76deb92
Last active December 1, 2016 07:49
jQuery plugin skeleton
(function( $ ){
var pluginName = 'pluginName';
var self;
// list of methods in your plugin
var methods = {
init : function( options ) {
return self.each(function () {