Skip to content

Instantly share code, notes, and snippets.

View nguyentienlong's full-sized avatar
💭
I may be slow to respond.

lk nguyentienlong

💭
I may be slow to respond.
  • Vietnam
View GitHub Profile
@nguyentienlong
nguyentienlong / 0_reuse_code.js
Last active August 29, 2015 14:12
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
@nguyentienlong
nguyentienlong / NERDTree.mkd
Created January 24, 2016 07:13 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@nguyentienlong
nguyentienlong / introrx.md
Created February 25, 2016 03:41 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@nguyentienlong
nguyentienlong / nginx
Created February 28, 2016 07:54 — forked from pzorn/nginx
php-fpm and nginx init.d script
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
@nguyentienlong
nguyentienlong / Test private, protected function
Last active May 12, 2016 05:41
PHP Test private, protected function
/**
* Helper function to call protected method
*
* @param stdObject $obj
* @param string $methodName
* @param array[] $args
*
* @return null
*/
protected function callMethod($obj, $methodName, array $args) {
@nguyentienlong
nguyentienlong / install_mysql.sh
Created May 27, 2016 00:04 — forked from rrosiek/install_mysql.sh
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Outputs nearly everything to /dev/null since "quiet" on most commands is still noisy.
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
@nguyentienlong
nguyentienlong / expand_array.php
Created September 20, 2016 13:46 — forked from adhocore/expand_array.php
A helper function expand_array for PHP
<?php
/**
* A helper function expand_array for PHP
*
* This is actually developed during the real need to develop JSON api
* I wanted to have JSON api response spitted properly expanded (with semantic nodes)
* But didnot want to do it by playing with arrays (looping, merging n' what not) time and again.
* So, After fetching single dimensional array data from database, with keys having
* some specific delimeter, this helper would do for me what i want to.
@nguyentienlong
nguyentienlong / index.html
Created October 5, 2016 16:41 — forked from mbajur/index.html
Working example of window.postMessage used for sending data from popup to parent page (works in IE)
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Index</title>
<script type="text/javascript">
window.open ("popup.html","mywindow", "width=350,height=250");
// Create IE + others compatible event handler
@nguyentienlong
nguyentienlong / cmd.txt
Created February 19, 2017 02:31
wordpress - update mysql database when changing domain
UPDATE wp_posts SET guid = replace(guid, 'http://old-domain','http://new-domain');
UPDATE wp_posts SET post_content = replace(post_content, 'http://old-domain', 'http://new-domain');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://old-domain','http://new-domain');
UPDATE wp_options set option_value='http://new-domain' where option_name in ('siteurl', 'home');