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
// jsconfig.json | |
{ | |
"compilerOptions": { | |
"baseUrl": "./src" | |
}, | |
"include": ["src"] | |
} | |
// .eslintrc | |
{ |
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
/* http://meyerweb.com/eric/tools/css/reset/ | |
v2.0-modified | 20110126 | |
License: none (public domain) | |
*/ | |
html, body, div, span, applet, object, iframe, | |
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | |
a, abbr, acronym, address, big, cite, code, | |
del, dfn, em, img, ins, kbd, q, s, samp, | |
small, strike, strong, sub, sup, tt, var, |
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
#!/usr/bin/env python3 | |
import subprocess | |
import pyperclip | |
import os | |
import sys | |
subprocess.call(["xdotool", "key", "Control_L+c"]) | |
prefix, absPath = pyperclip.paste().split('file://') | |
#Dealing with paths containing whitespaces which are replaced with "%20" in the clipboard string value of absPath variable | |
dirPath = absPath.strip().replace("%20", " ") |
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
function createRecord(count) { | |
let records = []; | |
for (let i = 0; i < count; i++) { | |
records[i] = { | |
text: `username_${i}`, | |
}; | |
} | |
return records; | |
} |
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 responseGoogleStatus = (responseType) => { | |
return (response) => { | |
console.log(responseType, response); | |
if (responseType == "Success") { | |
loggedIn = true; | |
token = response.accessToken; | |
} | |
if (responseType == "Failed") { | |
throw new Exception("Some error from Google API response", response); |
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
function minTohhmmss(totalSeconds){ | |
var hours = Math.floor(totalSeconds / 3600); | |
totalSeconds %= 3600; | |
var minutes = Math.floor(totalSeconds / 60); | |
var seconds = Math.floor(totalSeconds % 60); | |
var ret = ""; | |
hours ? ret = hours + "h" : ""; | |
minutes ? ret += minutes + "m": ""; |
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
/* | |
* @param {String} filepath | |
* @param {function} callback function(err, data){} | |
*/ | |
function readJsonFileAsync(filepath, callback) { | |
var fs = require('fs'); | |
fs.readFile(filepath, 'utf-8', function(err, data) { | |
if (err) { callback(err, null); } | |
else { | |
result = JSON.parse(data); |
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 fs = require('fs'); | |
const file = fs.createWriteStream('./big.file'); | |
for(let i=0; i<= 500000; i++) { | |
file.write('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n'); | |
} | |
file.end(); |
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 request = require('request'); | |
var express = require('express'); | |
var app = express(); | |
app.get('/goofy', function(req, res) { | |
request('http://images1.wikia.nocookie.net/__cb20120715102950/disney/images/a/a5/Disneygoofy2012.jpeg').pipe(res); | |
}); | |
app.get('/loop', function(req, res) { | |
res.render('mypage'); |
NewerOlder