Skip to content

Instantly share code, notes, and snippets.

View dezull's full-sized avatar
🏠
Working from home

Dzul Nizam dezull

🏠
Working from home
View GitHub Profile
@dezull
dezull / cloudSettings
Created December 4, 2018 04:54
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-12-04T04:54:52.615Z","extensionVersion":"v3.2.2"}
// Stub Implementation
// ===================
function notify (msg) { console.log(msg) }
function renderListItem () { /* UI update goes here */ }
var movieApi = {
titles: [
'IV – A New Hope (1977)',
'V – The Empire Strikes Back (1980)',
'use strict';
let http = require('http');
// Generator function, wrapper for http.get.
function *get(url) {
// Each generator function should call yield initially,
// to get the caller object, which contains done(result)
// and fail(error) functions. Pass the argument when
// done/failed doing asynchronous stuff appropriately.
public class DebugApplication extends Application {
private static final String TAG = DebugApplication.class.getSimpleName();
private static ActivityLifecycleCallbacks activityCallbacks = new ActivityLifecycleCallbacks() {
@Override
public void onActivityCreated(Activity activity, Bundle bundle) { /* Don't care */ }
@Override
@dezull
dezull / scrape-archive-webpage.js
Created February 29, 2016 06:47
Scrape & archive webpage
var fs = require('fs-extra'),
_ = require('lodash'),
Promise = require('bluebird'),
archiver = require('archiver'),
scraper = require('website-scraper');
var defaultOptions = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.2.1; en-us; Nexus 4 Build/JOP40D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Mobile Safari/535.19'
};
@dezull
dezull / hash-password.js
Created February 9, 2014 04:19
node bcrypt example
// npm install bcrypt
var bcrypt = require('bcrypt');
var password = process.argv[2];
bcrypt.genSalt(function(err, salt) {
if (err) {
console.log(err);
}
console.log('salt: ' + salt + ' (length: ' + salt.length + ')');
@dezull
dezull / mirror.sh
Last active December 22, 2015 08:39
Backup Git repos from GitLab/GitHab/Bitbucket.
#!/bin/bash
# Should work with GitLab/GitHub/Bitbucket
username="your-username"
host="your-host.com" # eg: github.com
clone_dir="`pwd`/repos"
repos=(
"repo-abc"
"repo-def"
@dezull
dezull / jquery-extend.js
Created November 19, 2012 04:04
jquery.extend
jQuery.extend = jQuery.fn.extend = function() {
var options, name, src, copy, copyIsArray, clone,
target = arguments[0] || {},
i = 1,
length = arguments.length,
deep = false;
// Handle a deep copy situation
if ( typeof target === "boolean" ) {
deep = target;
@dezull
dezull / install-sqlite3-pcre.sh
Created October 19, 2012 07:35
sqlite3-pcre
#!/bin/bash
# with macports installed
sudo port install sqlite3 &&
git clone https://github.com/oojah/sqlite3-pcre.git sqlite3-pcre &&
cd sqlite3-pcre &&
gcc -shared -o pcre.so -L/opt/local/lib -lsqlite3 -lpcre -Werror pcre.c -I/opt/local/include &&
sudo cp pcre.so /opt/local/lib/sqlite3 &&
echo ".load /opt/local/lib/sqlite3/pcre.so" > ~/.sqliterc