Skip to content

Instantly share code, notes, and snippets.

@frankfenghua
frankfenghua / gist:c4d8de92c1ee7b0d4b7a
Created March 23, 2016 15:27 — forked from Steven-Rose/gist:3943830
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
Follow below instructions to install svn 1.8 on OSX Yosemite 10.10/xcode6 install which comes with svn 1.7.17
Open Terminal:
sudo -s
#
# create link to toolchain
#
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain
@frankfenghua
frankfenghua / chrome-web-security.sh
Created December 19, 2016 03:00 — forked from ricca509/chrome-web-security.sh
Chrome: Disable web security [OSX]
// OSX
open -na Google\ Chrome --args --disable-web-security --user-data-dir="/tmp/chrome_dev"
@frankfenghua
frankfenghua / gitflow-breakdown.md
Created June 8, 2017 21:20 — forked from Leland/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
git commit --allow-empty -m "Initial commit"
git checkout -b develop master

Connect to the remote repository

gitflow | git

JSX Spread Attributes

If you know all the properties that you want to place on a component a head of time, it is easy to use JSX:

  var component = <Component foo={x} bar={y} />;

Mutating Props is Bad, mkay

@frankfenghua
frankfenghua / WSL-ssh-server.md
Created June 11, 2018 10:52 — forked from dentechy/WSL-ssh-server.md
A step by step tutorial on how to automatically start ssh server on boot on the Windows Subsystem for Linux

How to automatically start ssh server on boot on Windows Subsystem for Linux

Microsoft partnered with Canonical to create Bash on Ubuntu on Windows, running through a technology called the Windows Subsystem for Linux. Below are instructions on how to set up the ssh server to run automatically at boot.

  1. Uninstall and reinstall the ssh server using the following commands:
    1. sudo apt remove openssh-server
    2. sudo apt install openssh-server
  2. Edit the /etc/ssh/sshd_config file by running the command sudo vi /etc/ssh/sshd_config and do the following
    1. Change Port to 2222 (or any other port above 1000)
  3. Change UsePrivilegeSeparation to no
@frankfenghua
frankfenghua / CustomRules.js
Created September 26, 2018 14:46 — forked from fhfaa/CustomRules.js
CORS ALL the things in Fiddler2
import System;
import System.Windows.Forms;
import Fiddler;
// INTRODUCTION
//
// Well, hello there!
//
// Don't be scared! :-)
//
@frankfenghua
frankfenghua / walksync.js
Created March 25, 2019 07:03 — forked from kethinov/walksync.js
List all files in a directory in Node.js recursively in a synchronous fashion
// List all files in a directory in Node.js recursively in a synchronous fashion
var walkSync = function(dir, filelist) {
var fs = fs || require('fs'),
files = fs.readdirSync(dir);
filelist = filelist || [];
files.forEach(function(file) {
if (fs.statSync(dir + file).isDirectory()) {
filelist = walkSync(dir + file + '/', filelist);
}
else {
@frankfenghua
frankfenghua / lodashify.js
Created October 9, 2019 21:30 — forked from prashantpalikhe/lodashify.js
Lodashify chrome devtools snippet
(function () {
'use strict';
var element = document.createElement('script');
element.src = "https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.15.0/lodash.min.js";
element.type = "text/javascript";
document.head.appendChild(element);
})();
@frankfenghua
frankfenghua / traceProperty.js
Created October 9, 2019 21:34 — forked from prashantpalikhe/traceProperty.js
Devtools snippet to trace property access
const traceProperty = (object, property) => {
let value = object[property];
Object.defineProperty(object, property, {
get () {
console.trace(`${property} requested`);
return value;
},
set (newValue) {
console.trace(`setting ${property} to `, newValue);
value = newValue;