Skip to content

Instantly share code, notes, and snippets.

View chentsulin's full-sized avatar
🕶️
Keep learning

C. T. Lin chentsulin

🕶️
Keep learning
View GitHub Profile
@chentsulin
chentsulin / Dir.java
Last active August 29, 2015 14:10
Java get file directory
class Dir {
public static void main(String[] args) {
System.out.println("Directory: " + System.getProperty("user.dir"));
}
}
@chentsulin
chentsulin / app.php
Last active August 29, 2015 14:11
Specify Laravel Config
// app/config/myenv/app.php
return array(
'debug' => true,
);
@chentsulin
chentsulin / server.go
Created December 22, 2014 08:33
Simple Http Server in multi programming languages
package server
import(
"net/http"
)
func main() {
http.HandleFunc("/", SayHelloWorld)
http.ListenAndServe(":8080", nil)
}
@chentsulin
chentsulin / NoHasher.php
Created January 31, 2015 16:28
NoHasher for particular case (Don't use in production)
<?php
use Illuminate\Hashing\HasherInterface;
class NoHasher implements HasherInterface {
public function make($value, array $options = array())
{
return $value;
}
@chentsulin
chentsulin / index.js
Created March 27, 2015 07:01
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var qs = require('qs');
var obj = qs.stringify({ a: [ 'a', 'b', 'c' ] });
console.log(obj);
@chentsulin
chentsulin / log-timer.js
Last active August 29, 2015 14:21
Add Timer Spy on setTimeout and setInterval
var _setT = setTimeout;
setTimeout = function() {
console.log('setTimeout');
console.log(arguments);
_setT.apply(this, arguments);
};
var _setI = setInterval;
setInterval = function() {
console.log('setInterval');
@chentsulin
chentsulin / redux-devtools-separate-window.js
Last active September 13, 2015 13:04 — forked from tlrobinson/redux-devtools-separate-window.js
Put the awesome redux-devtools in it's own window so it doesn't obscure or be obscured by your application
import React from 'react';
import ReactDom from 'react-dom';
import { DevTools, DebugPanel, LogMonitor } from 'redux-devtools/lib/react';
export default function createDevToolsWindow(store) {
// give it a name so it reuses the same window
const win = window.open(null, 'redux-devtools', 'menubar=no,location=no,resizable=yes,scrollbars=no,status=no');
// reload in case it's reusing the same window with the old content
@chentsulin
chentsulin / slim-redux.js
Last active September 23, 2015 00:25 — forked from gaearon/slim-redux.js
Redux without the sanity checks in a single file. Don't use this, use normal Redux. :-) . Simplify for beginner
import { mapValues, pick, compose } from 'lodash';
function bindActionCreator(actionCreator, dispatch) {
return (...args) => dispatch(actionCreator(...args));
}
export function bindActionCreators(actionCreators, dispatch) {
return typeof actionCreators === 'function' ?
bindActionCreator(actionCreators, dispatch) :
mapValues(actionCreators, actionCreator =>
@chentsulin
chentsulin / week-4.md
Last active October 15, 2015 11:16
Week 4 課堂練習
@chentsulin
chentsulin / week-4.md
Last active October 15, 2015 13:13
Week 4 - After class