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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
background: #f06; | |
background: linear-gradient(45deg, #f06, yellow); | |
min-height: 100%; |
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
"" Install a new plugin | |
Plugin 'itchyny/lightline.vim' | |
Bundle 'zhaocai/GoldenView.Vim' |
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
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 |
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 require = patchRequire(require); | |
var casper = require('casper').create({ | |
verbose: true, | |
logLevel: "debug", | |
waitTimeout: 25000 | |
}); | |
var fs = require('fs'); | |
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 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 || |
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
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: |
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
to kill any process running on 8000 port | |
sudo fuser -k 8000/tcp |
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
@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 |
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
// 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: { |
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
// 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'; |
OlderNewer