Skip to content

Instantly share code, notes, and snippets.

@zubairalam
zubairalam / dabblet.css
Created December 30, 2012 08:00
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
"" Install a new plugin
Plugin 'itchyny/lightline.vim'
Bundle 'zhaocai/GoldenView.Vim'
https://github.com/kriskowal/q
http://stackoverflow.com/questions/4296505/understanding-promises-in-node-js
https://blog.domenic.me/youre-missing-the-point-of-promises/
http://strongloop.com/strongblog/promises-in-node-js-with-q-an-alternative-to-callbacks/
http://stackoverflow.com/questions/23667086/why-is-my-variable-unaltered-after-i-modify-it-inside-of-a-function-asynchron
http://www.html5rocks.com/en/tutorials/es6/promises/
https://www.youtube.com/watch?v=wc72cyYt8-c
https://www.youtube.com/watch?v=K6pihiILxrc
var require = patchRequire(require);
var casper = require('casper').create({
verbose: true,
logLevel: "debug",
waitTimeout: 25000
});
var fs = require('fs');
var app = angular.module('mainApp', []);
app.directive("myScroller", function ($parse, $document) {
var _levelReached = function(){
// is it low enough to add elements to bottom?
var pageHeight = Math.max(document.body.scrollHeight ||
document.body.offsetHeight);
var viewportHeight = window.innerHeight ||
document.documentElement.clientHeight ||
from collections import OrderedDict as _OrderedDict
try:
from thread import get_ident as _get_ident
except ImportError:
from dummy_thread import get_ident as _get_ident
class ListDict(_OrderedDict):
def __init__(self, *args, **kwds):
try:
to kill any process running on 8000 port
sudo fuser -k 8000/tcp
@csrf_exempt
def upload_video_file(request):
folder = 'tmp_dir2/' #request.path.replace("/", "_")
uploaded_filename = request.FILES['file'].name
BASE_PATH = '/home/'
# create the folder if it doesn't exist.
try:
os.mkdir(os.path.join(BASE_PATH, folder))
except:
pass
// Desired unique index:
// db.collection.ensureIndex({ firstField: 1, secondField: 1 }, { unique: true})
db.collection.aggregate([
{ $group: {
_id: { firstField: "$firstField", secondField: "$secondField" },
uniqueIds: { $addToSet: "$_id" },
count: { $sum: 1 }
}},
{ $match: {
// requires
var utils = require('utils');
var casper = require('casper').create()
var casper = require('casper').create({
verbose: true,
logLevel: "debug"
});
// setup globals
var email = casper.cli.options['email'] || 'REPLACE THIS EMAIL';