Skip to content

Instantly share code, notes, and snippets.

View JacobWay's full-sized avatar

Jacob Way JacobWay

View GitHub Profile
@JacobWay
JacobWay / .gitignore
Last active August 29, 2015 14:15 — forked from octocat/.gitignore
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
function Foo(){
return this;
}
var fooThis = Foo(); // ? fooThis =
var fooThat = new Foo(); // ? fooThat =
@JacobWay
JacobWay / custom_js_event.js
Last active April 11, 2016 08:30
The older approach to creating events uses APIs inspired by JAVA
// create event
var evt = document.createEvent("Event");
// initializing the event
evt.initEvent("anyName", true, true);
// add event handler
document.addEventListener("anyName", function(e){
// your handler logic
console.log("e.target: ", e.target);
@JacobWay
JacobWay / about_this.js
Created December 27, 2016 08:09
JavaScript code example of this in anonymous, callback, arrow function, es6, es5
{
class Message {
doCallback(cb){
cb("!!");
}
doAnother(){
console.log("??", this); // Message
}
doSomething() {
this.doCallback(function(message){
@JacobWay
JacobWay / PostgreSQL knowledge base.txt
Last active March 9, 2017 09:26
PostgreSQL knowledge base
Install PostgreSQL:
Install PostgreSQL 9.6 via homebrew.
Before installation:
Uninstall PostgreSQL if you have installed it by homebrew with command: brew uninstall postgres.
Delete the database cluster, usually locates on /usr/local/var/postgres, or /usr/local/pgsql/data.
The command is: rm -rf /usr/local/var/postgres, or rm -rf /usr/local/pgsql/data.
@JacobWay
JacobWay / hub.md
Created March 11, 2017 04:35
hub notes from github

hub is command line wrapper for git that makes you better at github.

create a github repo from command line

  • git create -d "This is your project discription"
  • git push origin master
@JacobWay
JacobWay / express.md
Last active March 12, 2017 08:33
node.js express.js notes

Guide

Routing

Routing resfers to the definition of application end points (URIs) and how they response to client requests.

Routing methods

  • express class -> routing methods -> http methods

Routing paths

  • route path based on strings
@JacobWay
JacobWay / Strong Loop Process Manager.md
Created March 13, 2017 03:22
Strong Loop Process Manager

StrongLoop Process Manager

StrongLoop PM is a production process manager for Node.js application with built-in load balancing,
monitoring, multi-host deployment, and a graphical console

Commands

  • To confirm it is started: slc ctl status smileyouexpress
  • To view the last logs: slc ctl log-dump smileyouexpress
  • To see more options: slc ctl -h
  • To see metrics, the profilers and other diagnostic features run: slc arc
@JacobWay
JacobWay / Software programming glossary.md
Last active March 13, 2017 04:55
software programming glossary

Glossary

Signature

In computer science, a type signature or type annotation defines the inputs and outputs for a function, subroutine, or method.

Service

In window operating system, a window service is a computer program that operates in the background.
It is similar in concept to a Unix daemon.

Daemon

@JacobWay
JacobWay / Deploy node.js app.md
Last active March 13, 2017 04:58
deploy node.js application

Process manager

Programming language related process manager

  • pm2

os related process manager

  • linux systemd