Skip to content

Instantly share code, notes, and snippets.

@kurdin
kurdin / 0_reuse_code.js
Created August 26, 2014 02:44
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kurdin
kurdin / gulpfile.js
Last active August 29, 2015 14:14 — forked from Leechael/gulpfile.js
var path = require("path");
var gulp = require("gulp");
var less = require("gulp-less");
var notify = require("gulp-notify");
var rename = require("gulp-rename");
var minifyCSS = require("gulp-minify-css");
var uglify = require("gulp-uglifyjs");
var livereload = require("gulp-livereload");
var source = require("vinyl-source-stream");

###mongodb quick CLI reference

db backup and restore

from any directory on host machine, export entire db

$ mongodump -db myDatabaseName

now copy the /dump folder to destination machine. from the destination machine:

// http://docs.mongodb.org/manual/tutorial/back-up-and-restore-with-mongodb-tools/
// Backup
$ mongodump -u {username} -p {password} --db {db} --out {output}
// Restore
$ env LC_ALL=en_US.UTF-8 mongorestore --port {port number} --dbpath {db path} {path to the backup}
@kurdin
kurdin / db_backup.sh
Last active August 29, 2015 14:19 — forked from droot/db_backup.sh
#!/bin/sh
MONGODB_SHELL='/opt/mongodb/bin/mongo'
DUMP_UTILITY='/opt/mongodb/bin/mongodump'
DB_NAME='my_db'
date_now=`date +%Y_%m_%d_%H_%M_%S`
dir_name='db_backup_'${date_now}
file_name='db_backup_'${date_now}'.bz2'
@kurdin
kurdin / html5video.sh
Last active August 29, 2015 14:27 — forked from liamcurry/html5video.sh
automated conversion of a file to all three html5 compatible video formats - h.264, ogg, and webm
#!/bin/sh
# Output file for HTML5 video
# requirements: ffmpeg .6+
# usage: ./html5video.sh infile.mp4 640x360
target_directory='converted'
file=`basename $1`
filename=${file%.*}
filepath=`dirname $1`
@kurdin
kurdin / jquery_deferred_chains.js
Last active September 17, 2015 15:25 — forked from sousk/jquery_deferred_chains.js
combine multiple chains with jQuery.Deferred
$.when(
sushi_roll(),
dispatch()
).done(function() {
console.log('accepted:', arguments[0], arguments[1]);
});
var n = 0;
function dispatch() {
return $.Deferred(function(dispached) {
@kurdin
kurdin / bootstrap4-editable.js
Created July 18, 2017 19:09 — forked from EdnaldoNeimeg/bootstrap4-editable.js
Fix x-editable for Bootstrap 4 - Using Tether
/*! X-editable - v1.5.1
* In-place editing with Twitter Bootstrap, jQuery UI or pure jQuery
* http://github.com/vitalets/x-editable
* Copyright (c) 2013 Vitaliy Potapov; Licensed MIT */
/**
Form with single input element, two buttons and two states: normal/loading.
Applied as jQuery method to DIV tag (not to form tag!). This is because form can be in loading state when spinner shown.
Editableform is linked with one of input types, e.g. 'text', 'select' etc.
@class editableform
@kurdin
kurdin / GitHub-Forking.md
Created February 8, 2018 16:51 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@kurdin
kurdin / FizzBuzz.js
Created August 23, 2018 14:09 — forked from jaysonrowe/FizzBuzz.js
FizzBuzz JavaScript solution
for (var i=1; i <= 20; i++)
{
if (i % 15 == 0)
console.log("FizzBuzz");
else if (i % 3 == 0)
console.log("Fizz");
else if (i % 5 == 0)
console.log("Buzz");
else
console.log(i);