Skip to content

Instantly share code, notes, and snippets.

@lijie2000
lijie2000 / uri.js
Created April 29, 2014 15:38 — forked from jlong/uri.js
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
public @interface RunInThread {
}
var gulp = require('gulp'),
del = require('del'),
plugins = require('gulp-load-plugins')(),
bower = require('main-bower-files'),
source = require('vinyl-source-stream'),
buffer = require('vinyl-buffer'),
browserify = require('browserify'),
browserSync = require('browser-sync');
var conf = {
var child_process = require('child_process');
// exec: spawns a shell.
child_process.exec('ls -lah /tmp', function(error, stdout, stderr){
console.log(stdout);
});
// execFile: executes a file with the specified arguments
child_process.execFile('ls', ['-lah', '/tmp'], function(error, stdout, stderr){
console.log(stdout);
function xhr(options) {
var deferred = Q.defer(),
req = new XMLHttpRequest();
req.open(options.method || 'GET', options.url, true);
// Set request headers if provided.
Object.keys(options.headers || {}).forEach(function (key) {
req.setRequestHeader(key, options.headers[key]);
});
@lijie2000
lijie2000 / Readme.md
Created January 6, 2016 15:08 — forked from thomasdarimont/Readme.md
Call stored procedure with ref-cursor mode as out parameter via Spring Data JPA and eclipse-link.

Run with:

-javaagent:/Users/tom/.m2/repository/org/springframework/spring-instrument/4.1.4.RELEASE/spring-instrument-4.1.4.RELEASE.jar
@lijie2000
lijie2000 / oracleJDBCSetup
Created January 19, 2016 15:27 — forked from MonicaG/oracleJDBCSetup
Using Oracle with Spring Boot
If you do not have an oracle driver do steps 1 and 2 first. Otherwise skip to step 3.
1) Download the jdbc driver from oracle.
2) Install the driver into your local maven .m2 repository. Example:
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.4 -Dpackaging=jar -Dfile=ojdbc6.jar -DgeneratePom=true
In the above example the ojdbc6.jar version 11.2.0.4 is used. Replace the -DartifactId=ojdbc6 -Dversion=11.2.0.4 and -Dfile=ojdbc6.jar with the driver name/version you downloaded.
@lijie2000
lijie2000 / tmux-cheatsheet.markdown
Created February 23, 2016 15:07 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@lijie2000
lijie2000 / parse-hash-bang-arguments-in-javascript.js
Created September 25, 2016 02:20 — forked from miohtama/parse-hash-bang-arguments-in-javascript.js
Parse hash bang HTTP GET query style arguments from an URL using Javascript
/**
* Parse hash bang parameters from a URL as key value object.
*
* For repeated parameters the last parameter is effective.
*
* If = syntax is not used the value is set to null.
*
* #x&y=3 -> { x:null, y:3 }
*
* @param aURL URL to parse or null if window.location is used
@lijie2000
lijie2000 / angularjs-providers-explained.md
Created September 28, 2016 13:13 — forked from demisx/angularjs-providers-explained.md
AngularJS Providers: Constant/Value/Service/Factory/Decorator/Provider
Provider Singleton Instantiable Configurable
Constant Yes No No
Value Yes No No
Service Yes No No
Factory Yes Yes No
Decorator Yes No? No
Provider Yes Yes Yes

Constant