Skip to content

Instantly share code, notes, and snippets.

View JuoCode's full-sized avatar
🗡️
Focusing

Jian Guo JuoCode

🗡️
Focusing
View GitHub Profile
/// <reference path="../../typings/index.d.ts" />
const fs = require('fs')
const regedit = require('regedit')
const path = require('path')
const PBK_FILE = path.join(process.env.APPDATA, 'Microsoft', 'Network', 'Connections', 'pbk', 'rasphone.pbk')
const REGISTRY_PATH_LOCAL_NETWORK = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings'
const REGISTRY_PATH_CONNECTIONS = 'HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\\Connections'
const changeLocalNetwork = (value) => {
@JuoCode
JuoCode / greet.sh
Created May 4, 2016 02:45
Greet to cd
# Greet to cd
cd() {
builtin cd "$1"
DIR=`pwd`
if [ -f "${DIR}/.greet" ]; then
bash ${DIR}/.greet
fi
}
@JuoCode
JuoCode / react-loading-button.jsx
Last active April 16, 2016 18:15
Change button status when request.
var Button = React.createClass({
getInitialState: function () {
return { status: 'initial' };
},
componentWillReceiveProps: function (nextProps) {
var setState = this.setState.bind(this);
setState({ status: nextProps.status });
if (['success', 'error'].includes(nextProps.status)) {
setTimeout(function () {
@JuoCode
JuoCode / PostModal.js
Last active April 1, 2016 02:40
Redux actionCreator creator
import { createAction } from 'redux/RestModule';
import RestClient, { AccessTokenInterceptor } from './Restful';
// Create Post modal
const Post = RestClient.all('posts');
Post.addRequestInterceptor(AccessTokenInterceptor);
export const fetchPosts = createAction({
type: 'POSTS_FETCH',
request: () => Post.getAll,
const DAY = 24 * 60 * 60;
const HOUR = 60 * 60;
const MINUTES = 60;
let ds, hs, ms, ss;
// day
if (duration >= DAY) {
ds = Math.floor(duration / DAY);
}
@JuoCode
JuoCode / # Sublime Emmet JSX Reactjs.md
Created October 15, 2015 14:56 — forked from max-mykhailenko/# Sublime Emmet JSX Reactjs.md
Sublime text 3. Enable Emmet in JSX files with Sublime React plugin

Problem

  • Using emmet in jsx files
  • Emmet expands text when js autocomplete needed
  • Using className instead of class

How it works

  • Install plugin RegReplace
  • Install plugin Chain Of Command