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"
define(['underscore'
], function (_) {
'use strict';
describe('a spy', function () {
console.log('settings check in <<<');
var foo, bar = null;
beforeEach(function () {
var mock = function (constr, name) {
var HelperConstr = function(){};
HelperConstr.prototype = constr.prototype;
var result = new HelperConstr();
for (var key in constr.prototype) {
try {
if (constr.prototype[ key ] instanceof Function) {
result[ key ] = jasmine.createSpy(( name || 'mock' ) + '.' + key);
}
} catch (ex) {
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