Skip to content

Instantly share code, notes, and snippets.

View katsos's full-sized avatar

Nikos Katsos katsos

View GitHub Profile
@katsos
katsos / install_vb_guest.sh
Created November 27, 2016 17:41
Install virtualbox guest additions via command line
sudo apt install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11
@katsos
katsos / no_js.tmpl.html
Created November 29, 2016 10:08
No javascript - html template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title> No Javascript, No fun </title>
</head>
<body>
@katsos
katsos / install_docker_ubuntu_v16.04x64.sh
Created November 30, 2016 11:49
Docker installation script for Ubuntu 16.04(Xenial) 64bit
## add docker apt-repository
sudo apt update && \
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D && \
sudo apt-add-repository 'deb https://apt.dockerproject.org/repo ubuntu-xenial main' && \
## install docker-engine package
sudo apt update && apt-cache policy docker-engine && sudo apt install docker-engine && \
## check docker status and informations
sudo systemctl status docker && sudo docker info
@katsos
katsos / install_apt_nodejs_v6-LTS.sh
Created November 30, 2016 13:45
Installation script for the latest LTS version of NodeJS via APT package manager
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - && \
sudo apt-get install -y nodejs
@katsos
katsos / promise_example.js
Created March 8, 2017 12:17
Minimal javascript promise example
let isResolved = true;
const p = new Promise( function(resolve, reject) {
if (isResolved) resolve(); else reject();
});
p.then(() => {
console.log('resolved');
}).catch(() => {
console.log('rejected');
@katsos
katsos / .yourrc
Created April 15, 2017 10:13
Mac Finder - Show/Hide hidden files
alias finder-show-all="defaults write com.apple.finder AppleShowAllFiles YES && killall Finder"
alias finder-hide="defaults write com.apple.finder AppleShowAllFiles NO && killall Finder"
@katsos
katsos / const.js
Created April 23, 2017 16:27
Use of "const" in JavaScript
"use strict";
/* const does not work as "final" in Java */
const arr = [1, 2, 3];
// you cannot assign anything on this variable again
// arr = []
// but you can modify it
arr.push(4);
@katsos
katsos / index.html
Created May 9, 2017 12:47
One-way binding - pure javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<form id="form">
<input id="input" type="text"/>
<input type="submit"/>
@katsos
katsos / one-way-realtime.html
Created May 9, 2017 12:54
One-way binding realtime - pure javascript
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<input id="input" type="text"/>
<span id="span"></span>
@katsos
katsos / this_vs_proto.js
Created August 29, 2017 08:55
This.function vs prototype.function
var x = {
dummy() { console.log('this'); }
}
var y = function() {};
y.prototype.dummy = function() { console.log('proto'); }
x.dummy();
// y.dummy(); // "TypeError: y.dummy is not a function