Skip to content

Instantly share code, notes, and snippets.

Avatar

Allan Philip Barku allanphilipbarku

View GitHub Profile
@allanphilipbarku
allanphilipbarku / apache2_vhost_config_vuejs_dist
Last active Jun 30, 2020 — forked from 7rin0/apache2_vhost_config_vuejs_dist
VueJS: Apache with forced https and http2 / Nginx vhost config examples
View apache2_vhost_config_vuejs_dist
<VirtualHost *:80>
Protocols h2 h2c http/1.1
ServerName vuejs.project-url.com
ServerAdmin webmaster@vuejs.project-url.com
DocumentRoot /var/www/html/projec-root-directory/dist/
<Directory "/var/www/html/projec-root-directory/dist/">
AllowOverride All
Options FollowSymLinks Multiviews Indexes
Require all granted
View final.js
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
const functionC = ()=>{/*send log*/}
return new Map([
[/^guest_[1-4]$/,functionA],
[/^guest_5$/,functionB],
[/^guest_.*$/,functionC],
//...
])
View regcache.js
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
return new Map([
[/^guest_[1-4]$/,functionA],
[/^guest_5$/,functionB],
//...
])
}
View cache.js
const actions = ()=>{
const functionA = ()=>{/*do sth*/}
const functionB = ()=>{/*do sth*/}
return new Map([
[{identity:'guest',status:1},functionA],
[{identity:'guest',status:2},functionA],
[{identity:'guest',status:3},functionA],
[{identity:'guest',status:4},functionA],
[{identity:'guest',status:5},functionB],
//...
View obj.js
const actions = new Map([
[{identity:'guest',status:1},()=>{/*do sth*/}],
[{identity:'guest',status:2},()=>{/*do sth*/}],
//...
])
const onButtonClick = (identity,status)=>{
let action = [...actions].filter(([key,value])=>(key.identity == identity && key.status == status))
action.forEach(([key,value])=>value.call(this))
}
View complex2.js
const actions = new Map([
['guest_1', ()=>{/*do sth*/}],
['guest_2', ()=>{/*do sth*/}],
['guest_3', ()=>{/*do sth*/}],
['guest_4', ()=>{/*do sth*/}],
['guest_5', ()=>{/*do sth*/}],
['master_1', ()=>{/*do sth*/}],
['master_2', ()=>{/*do sth*/}],
['master_3', ()=>{/*do sth*/}],
['master_4', ()=>{/*do sth*/}],
View map.js
const actions = new Map([
[1, ['processing','IndexPage']],
[2, ['fail','FailPage']],
[3, ['fail','FailPage']],
[4, ['success','SuccessPage']],
[5, ['cancel','CancelPage']],
['default', ['other','Index']]
])
const onButtonClick = (status)=>{
@allanphilipbarku
allanphilipbarku / Car.js
Created Jan 16, 2020 — forked from r3dm1ke/Car.js
Car class in ES5
View Car.js
// "class" declaration
function Car(make, model) {
this.make = make;
this.model = model;
}
// the start method
Car.prototype.start = function() {
console.log('vroom');
}
@allanphilipbarku
allanphilipbarku / Car.js
Created Jan 16, 2020 — forked from r3dm1ke/Car.js
Car class in ES6
View Car.js
class Car {
constructor(make, model) {
this.make = make;
this.model = model;
}
start() {
console.log('vroom');
}