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
const winston = require('winston'); | |
require('winston-daily-rotate-file'); | |
const { format } = winston; | |
const { combine, json, timestamp } = format; | |
const logDir = process.env.LOGDIR || './logs'; | |
const transports = []; | |
if (process.env.ENVIRONMENT === 'dev') { | |
transports.push( | |
new winston.transports.Console({ |
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
./node_modules/pm2/bin/pm2 delete all; ./node_modules/pm2/bin/pm2 start ./{path to server js} --watch --node-args='--inspect' --no-daemon |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>JLT - Animated squares on top of a circle</title> | |
<style> | |
body{ | |
padding: 300px; | |
} | |
div{ | |
position: absolute; |
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
<?php | |
/** | |
* Given a decimal number and a base, convert the number to n-ary base number. Also find a way to perform arithmetic | |
* operations. The n is actually 36, however the principal is same. | |
* | |
* To perform arithmetic operations, we convert the number back to decimal, do the math, then convert back to the | |
* original base. | |
*/ | |
/** |
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
find all console.log() | |
console\.log\((.*)\); |
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
#!/bin/bash | |
PROJECT=`php -r "echo dirname(dirname(dirname(realpath('$0'))));"` | |
STAGED_PHP_FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.php` | |
STAGED_JSON_FILES=`git diff --cached --name-only --diff-filter=ACMR HEAD | grep \\\\.json$` | |
# Determine if a file list is passed | |
if [ "$#" -eq 1 ] | |
then |
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
var http = require('http'), //http server | |
urlparser = require('url'), //url parser & builder | |
host = 'sandbox', | |
port = 1337; | |
http.createServer(function (req, res) { | |
var response = 'Hello, World!\n', | |
url = urlparser.parse(req.url, true).pathname; | |
switch (url) { | |
case('/hello'): //check for path, alternatively strip the front slash | |
response = 'World!\n'; |
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
var http = require('http'), //http server | |
urlparser = require('url'), //url parser & builder | |
host = 'sandbox', | |
port = 1337; | |
http.createServer(function (req, res) { | |
var response = 'Hello, World!\n', | |
url = urlparser.parse(req.url, true).pathname; | |
switch (url) { | |
case('/hello'): //check for path, alternatively strip the front slash | |
response = 'World!\n'; |
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
server { | |
listen 80; | |
server_name helloworld; | |
location / { | |
rewrite ^/(.*)$ /$1 break; | |
proxy_set_header X-Real-IP $remote_addr; |
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
var re = /[789]\d{9}$/; | |
re.test(9876543210); | |
re.test(8765432109); | |
re.test(7654321098); | |
re.test(6543210987); | |
re.test(5432109876); |
NewerOlder