Skip to content

Instantly share code, notes, and snippets.

wget -H -r --level=1 -k -p http://ginatrapani.googlepages.com
//requires node modules: "connect" and "serve-static"
var connect = require('connect');
var serveStatic = require('serve-static');
function printUsageAndExit() {
console.log("Usage:");
console.log("node webserver.js <port> \"<path>\"");
console.log("Examples:");
console.log("node webserver.js 8080 \"../\"");
@ayoayco
ayoayco / month dropdown
Created March 21, 2017 04:55
html dropdown templates
<div class="dropdown">
<p>Month</p>
<select name="month" id="month">
<option value=''>--Select Month--</option>
<option selected value='1'>Janaury</option>
<option value='2'>February</option>
<option value='3'>March</option>
<option value='4'>April</option>
<option value='5'>May</option>
<option value='6'>June</option>
@ayoayco
ayoayco / cmd.bat
Created March 26, 2017 16:32
convert all csv to json
for %%f in (*.csv) do (
:: requires node module csvtojson
:: npm install --global csvtojson
csvtojson "%%~nf.csv" > "%%~nf.json"
)
{
// Use IntelliSense to learn about possible Node.js debug attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [{
"type": "chrome",
"request": "launch",
"name": "Launch Chrome",
"url": "http://localhost:8080",
@ayoayco
ayoayco / dateToString.js
Last active December 1, 2017 08:17
Modern JavaScript function for formatting Date to String yyyy-MM-dd
function getFormattedDate(d) {
if(!d){
d = new Date();
}
const transactionDate = [d.getFullYear(), `0${d.getMonth() + 1}`.slice(-2), `0${d.getDate()}`.slice(-2)].join('');
return transactionDate;
}
@ayoayco
ayoayco / setup
Last active June 5, 2018 14:59
Ubuntu initial setup
# download .deb installer of nodejs 8
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
# install packages
$ sudo apt-get install -y nodejs ruby2.4 ruby2.4-dev build-essential dh-autoreconf make python3-pip libssl-dev libffi-dev python3-dev virtualenv python3-venv
# for Jekyll dev't, add two lines at end of ~/.bashrc:
export GEM_HOME=$HOME/gems
export PATH=$HOME/gems/bin:$PATH
@ayoayco
ayoayco / install-theme.sh
Created April 9, 2018 12:52
install xfce4 theme from xfce-look
wget http://xfce-look.org/CONTENT/content-files/90145-axiom.tar.gz
tar zxf 90145-axiom.tar.gz
sudo cp -pr axio* /usr/share/themes/
rm -R axio*
rm -R axio*
@ayoayco
ayoayco / Node.JS Development, The Docker Way
Last active May 26, 2018 18:05
Run a Docker image of Node.js and provide it the current working directory as data volume, then run npm start within the running Docker
docker run -p 8080:3000 -v %cd%:/var/www -w "/var/www" node npm start
# resize image to width 25, keeping aspect ratio
convert -geometry 25x src/image1.png out/image1.png
# resize image to height 25, keeping aspect ratio
convert -geometry x25 src/image1.png out/image1.png
# concatenate images horizontally
convert +append src/image1.png src/image2.png out/image12horiz.png
# concatenate images vertically