Skip to content

Instantly share code, notes, and snippets.

View balanza's full-sized avatar

Emanuele De Cupis balanza

View GitHub Profile
@balanza
balanza / mobile.ts
Last active January 30, 2019 16:29
type Mobile {
confirmed: boolean,
value: string
}
type User {
/* name, surname, etc */
mobile: Mobile
}
pipelines:
default:
- step:
name: Build
image: node:10
script:
- npm install
- npm run build
artifacts:
- dist/**
@balanza
balanza / bash
Last active January 20, 2019 19:18
# install dependencies the first time
npm install less http-server handlebars
# build the website
npm run build
# serve files via http
npm start
"scripts":{
"start": "http-server ./dist -p4000",
"build": "node ./bin/build.js"
}
@balanza
balanza / build.js
Created January 20, 2019 16:12
Snippet for supporting this: https://medium.com/p/36c950cd6f35
function compile() {
clean()
ensureDirectory('./dist')
compileCSS()
compileHTML()
compileAssets()
}
@balanza
balanza / mysite.conf
Last active November 8, 2018 09:05
Apache reverse proxy
<VirtualHost *:80>
ProxyPreserveHost On
ServerName mysite.com
<Location />
ProxyPass http://0.0.0.0:3000/
ProxyPassReverse http://0.0.0.0:3000/
RequestHeader set Connection ""
</Location>
//navigation.js - centralized app navigation methods
function isLoggedIn(fn){
return function() {
if( /* test if the user is logged in */ ){
/* redirect to login page */
} else {
var args = Array.prototype.slice.call(arguments);
return fn && fn.apply(this, args);
}
//navigation.js - centralized app navigation methods
exports.openHomePage = function(){ /* code for opening the Home page */ };
@isLoggedIn
exports.openProfilePage = function(){ /* code for opening the Profile page */ };
@isLoggedIn
exports.openDashboardPage = function(){ /* code for opening Dashboard page */ };
//navigation.js - centralized app navigation methods
exports.openHomePage = function(){ /* code for opening the Home page */ };
exports.openProfilePage = function(){ /* code for opening the Profile page */ };
exports.openDashboardPage = function(){ /* code for opening Dashboard page */ };
exports.openInsightsPage = function(){ /* code for opening Insights page */ };
function commonFunctionalityX(fn){
return function retX() { //function name for didactical purpose only
//
// Here you write the commonFunctionalityX-specific code
//
var args = Array.prototype.slice.call(arguments);
return fn && fn.apply(this, args);
};
}