Skip to content

Instantly share code, notes, and snippets.

View vagusX's full-sized avatar
🎯
Focusing

vagusX vagusX

🎯
Focusing
View GitHub Profile
@vagusX
vagusX / sublime-command-line.md
Created January 18, 2018 08:49
Launch Sublime Text from the command line on OSX

Launch Sublime Text from the command line on OSX

Sublime Text includes a command line tool, subl, to work with files on the command line. This can be used to open files and projects in Sublime Text, as well working as an EDITOR for unix tools, such as git and subversion.

Requirements

  • Sublime text 2 or 3 installed in your system within Applications folder

Setup

@vagusX
vagusX / rm_mysql.md
Created November 26, 2017 13:06 — forked from vitorbritto/rm_mysql.md
Remove MySQL completely from Mac OSX

Remove MySQL completely

  1. Open the Terminal

  2. Use mysqldump to backup your databases

  3. Check for MySQL processes with: ps -ax | grep mysql

  4. Stop and kill any MySQL processes

  5. Analyze MySQL on HomeBrew:

brew remove mysql

@vagusX
vagusX / coordinating-async-react.md
Created September 19, 2017 01:58 — forked from acdlite/coordinating-async-react.md
Demo: Coordinating async React with non-React views

Demo: Coordinating async React with non-React views

tl;dr I built a demo illustrating what it might look like to add async rendering to Facebook's commenting interface, while ensuring it appears on the screen simultaneous to the server-rendered story.

A key benefit of async rendering is that large updates don't block the main thread; instead, the work is spread out and performed during idle periods using cooperative scheduling.

But once you make something async, you introduce the possibility that things may appear on the screen at separate times. Especially when you're dealing with multiple UI frameworks, as is often the case at Facebook.

How do we solve this with React?

@vagusX
vagusX / dfs.js
Created March 31, 2017 04:05 — forked from Dammmien/dfs.js
Depth First Search (DFS) Graph Traversal in Javascript
var nodes = [
{
links: [ 1 ], // node 0 is linked to node 1
visited: false
}, {
links: [ 0, 2 ], // node 1 is linked to node 0 and 2
visited: false
},
...
];
@vagusX
vagusX / android_instructions.md
Created March 10, 2017 05:45 — forked from patrickhammond/android_instructions.md
Easily setup an Android development environment on a Mac

Here is a high level overview for what you need to do to get most of an Android environment setup and maintained.

Prerequisites (for Homebrew at a minimum, lots of other tools need these too):

  • XCode is installed (via the App Store)
  • XCode command line tools are installed (xcode-select --install will prompt up a dialog)
  • Java

Install Homebrew:

ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@vagusX
vagusX / protips.js
Created January 4, 2017 10:04 — forked from nolanlawson/protips.js
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");
@vagusX
vagusX / Dorm-network.scpt
Created November 8, 2016 02:44 — forked from Jeff2Ma/Dorm-network.scpt
Automatic proxy configuration set pac file with applescript & shell script http://devework.com/automatic-proxy-configuration-pac-applescript.html
tell application "System Events"
tell network preferences
do shell script "scselect 'Dorm'"
do shell script "sudo networksetup -setairportpower AirPort on" user name "用户名" password "密码" with administrator privileges
do shell script "open /Applications/Shad**socksX.app" user name “用户名" password "密码" with administrator privileges
end tell
end tell
@vagusX
vagusX / flux.js
Created September 21, 2016 08:38 — forked from acdlite/flux.js
A Redux-like Flux implementation in <75 lines of code
/**
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
*/
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {
@vagusX
vagusX / flex
Created May 20, 2016 05:44 — forked from kmokidd/flex
Adapt android 2.1+ WebView, thanks https://github.com/stevenbenisek/compass-flexbox
/* display:flex; */
.flex { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; }
/* row reverse */
.flex.flex--reverse { -webkit-box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-direction: reverse; -moz-box-direction: reverse; -webkit-flex-direction: row-reverse; -ms-flex-direction: row-reverse; flex-direction: row-reverse; }
/* column */
.flex--clo { -webkit-box-orient: vertical; -moz-box-orient: vertical; -webkit-box-direction: normal; -moz-box-direction: normal; -webkit-flex-direction: column; -ms-flex-direction: column; flex-direction: column; }
/* column reverse*/
.flex--col.flex--reverse { -webkit-box-orient: vertical; -moz-box-orient: vertical; -webkit-box-direction: reverse; -moz-box-direction: reverse; -webkit-flex-direction: column-reverse; -ms-flex-direction: column-reverse; flex-direction: column-reverse; }
/* 子元素之间间距 */
.flex--justify-content--space-between { -webkit-box-pack: justify; -moz-box-pack: justify; -ms-flex-pack: justify