This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Use instanceof for custom types: | |
``` | |
var ClassFirst = function () {}; | |
var ClassSecond = function () {}; | |
var instance = new ClassFirst(); | |
typeof instance; // object | |
typeof instance == 'ClassFirst'; // false | |
instance instanceof Object; // true | |
instance instanceof ClassFirst; // true | |
instance instanceof ClassSecond; // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
{ | |
"presets": [ | |
["env", { | |
"targets": { | |
"node": "current", | |
"browsers": ["last 2 versions", "safari >= 11.1","ie 8"] | |
} | |
}] | |
], | |
"plugins": [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import express from 'express'; | |
import http from 'http' | |
/** | |
* Express Set Up | |
*/ | |
const app = express() | |
app.set('view engine', 'pug') | |
app.use('/assets', express.static('assets')); | |
const server = http.createServer(app); | |
const io = require('socket.io').listen(server); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://url/?timestamp=&UID=&secretKey= | |
const express = require('express'); | |
const crypto = require('crypto'); | |
const app = express() | |
const signature = (timestamp, uid, secretKey) => { | |
const buf = Buffer.from(secretKey, 'base64'); | |
const baseString = timestamp + "_" + uid | |
const binaryBaseString = baseString.toString('binary') | |
const sig = crypto.createHmac('sha1', buf).update(binaryBaseString).digest() | |
console.log(sig.toString('base64')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Spread operators baby | |
var Array = [[1, 2],[3, 4, 5], [6, 7, 8, 9]]; | |
var result = [].concat(...Array); | |
console.log(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo spctl --master-disable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable no-console */ | |
import raven from 'raven'; | |
/* | |
To Use | |
import logger from './logger'; | |
logger.error('test error'); | |
logger.debug('test debug'); | |
logger.warning('test warning'); | |
logger.fatal('test fatal'); | |
> This example uses global environment configurations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
"extends": "standard", | |
"plugins": [ | |
"standard", | |
"promise" | |
], | |
"rules": { | |
// i know... i'm happy to omit them | |
// but mi dios, its like walking down the street wearing real fur | |
"semi": ["error", "always"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root = true | |
[*] | |
charset = utf-8 | |
indent_style = space | |
indent_size = 2 | |
end_of_line = lf | |
insert_final_newline = true | |
trim_trailing_whitespace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stages: | |
- deploy | |
deploy to development: | |
stage: deploy | |
script: | |
- apt-get update -qy | |
- apt-get install -y ruby-dev | |
- gem install dpl | |
- dpl --provider=heroku --strategy=api --app=example-dev --api-key=$HEROKU_API_KEY |