This file contains hidden or 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 strict' | |
const timeout = ms => new Promise(res => setTimeout(res, ms)) | |
function convinceMe (convince) { | |
let unixTime = Math.round(+new Date() / 1000) | |
console.log(`Delay ${convince} at ${unixTime}`) | |
} | |
async function delay () { |
This file contains hidden or 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 | |
> http.STATUS_CODE | |
{ | |
'100': 'Continue', | |
'101': 'Switching Protocols', | |
'102': 'Processing', | |
'200': 'OK', | |
'201': 'Created', | |
'202': 'Accepted', | |
'203': 'Non-Authoritative Information', |
This file contains hidden or 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 = function (req, res, next) { | |
var render = res.render; | |
res.render = function () { | |
var viewName = arguments[0], | |
withoutExtension = viewName.replace(/\.[a-z]+$/i, ""), | |
bodyClass = withoutExtension.replace(/\//g, "-"); | |
res.locals.bodyClass = bodyClass; | |
render.apply(this, arguments); |
This file contains hidden or 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
FROM node:alpine | |
RUN apk add --no-cache --virtual .gyp \ | |
python \ | |
make \ | |
g++ \ | |
&& npm install \ | |
[ your npm dependencies here ] \ | |
&& apk del .gyp |
This file contains hidden or 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
// https://packagecontrol.io/packages/Terminal | |
{ | |
"terminal": "/opt/Hyper/hyper", | |
"parameters": ["%CWD%"] | |
} |
This file contains hidden or 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://search.google.com/structured-data/testing-tool#url=daliborgogic.com | |
//- https://cards-dev.twitter.com/validator | |
//- https://developers.facebook.com/tools/debug/ | |
html(itemscope itemtype="http://schema.org/Product") | |
title Page Title. Maximum length 60-70 characters | |
meta(name="description" content="Page description. No longer than 155 characters.") | |
//- Schema.org markup for Google+ |
This file contains hidden or 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://w3c.github.io/pointerevents/ | |
foo.addEventListener('pointerdown', e => { | |
switch (e.pointerType) { | |
case 'mouse': | |
// mouse detected | |
break | |
case 'pen': | |
// pen / stylus detected | |
break; |
This file contains hidden or 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 | |
cd /tmp || exit | |
echo "Downloading Postman ..." | |
wget -q https://dl.pstmn.io/download/latest/linux?arch=64 -O postman.tar.gz | |
tar -xzf postman.tar.gz | |
rm postman.tar.gz | |
echo "Installing to opt..." | |
if [ -d "/opt/Postman" ];then | |
sudo rm -rf /opt/Postman |
This file contains hidden or 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://chromium.googlesource.com/chromium/src/+/lkgr/headless/README.md | |
# --disable-gpu currently required, see link above | |
google-chrome --headless --screenshot --disable-gpu --window-size=1440,900 https://daliborgogic.com/ |
This file contains hidden or 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 -v | |
> v8.0.0 | |
$ node | |
> let codeName = 'carbon' | |
undefined | |
> codeName.padStart(10) | |
' carbon' | |
> codeName.padEnd(10) | |
'carbon ' |