Skip to content

Instantly share code, notes, and snippets.

💭
Getting things done.

Jogis yesvods

Block or report user

Report or block yesvods

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@yesvods
yesvods / index.js
Created Feb 6, 2017 — forked from edokeh/index.js
佛祖保佑,永无 BUG
View index.js
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \
@yesvods
yesvods / source.list
Last active Feb 6, 2018
ubuntu 16.04
View source.list
# Intel
deb http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ xenial-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ xenial-proposed main restricted universe multiverse
@yesvods
yesvods / checkDirectorySync.js
Created Apr 19, 2016
check if directory exist, if not, create one.
View checkDirectorySync.js
function checkDirectorySync(directory) {
try {
fs.statSync(directory);
} catch(e) {
fs.mkdirSync(directory);
}
}
@yesvods
yesvods / template.js
Created Apr 4, 2016
Javascript template engine
View template.js
function template(html, data){
//process html template
html = html.replace(/>/g, ">")
.replace(/&lt;/g, "<")
.replace(/[\r\t\n]\s+/g, '')
.trim();
var re = /<%([^>]+)?%>/g,
reExp = /(^( )?(if|for|else|switch|case|break|{|}|var|let|const))(.*)?/g,
code = 'var r=[];\n',
@yesvods
yesvods / save.js
Created Jan 22, 2016
Save variable string to file in browser
View save.js
(function(console){
console.save = function(data, filename){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
@yesvods
yesvods / ls.js
Created Jan 21, 2016
LocalStorage MaxSzie
View ls.js
if (localStorage && !localStorage.getItem('size')) {
var i = 0;
try {
// Test up to 10 MB
for (i = 250; i <= 10000; i += 250) {
localStorage.setItem('test', new Array((i * 1024) + 1).join('a'));
}
} catch (e) {
localStorage.removeItem('test');
localStorage.setItem('size', i - 250);
View express-lite.js
function server(req, res){
let next = () => {
//deal with ending job
}
middlewares.reduceRight((next, middleware) => {
return () => {
middleware(req, res, next)
}
}, next)();
}
@yesvods
yesvods / gist:51af798dd1e7058625f4
Created Aug 15, 2015
Merge Arrays in one with ES6 Array spread
View gist:51af798dd1e7058625f4
const arr1 = [1,2,3]
const arr2 = [4,5,6]
const arr3 = [...arr1, ...arr2] //arr3 ==> [1,2,3,4,5,6]
@yesvods
yesvods / gist:4c7251f060029c8a5b07
Last active Oct 1, 2018
Merge Object with ES7 object spread
View gist:4c7251f060029c8a5b07
const obj1 = {name:"xiaoming", age: 23}
const obj2 = {age: 33}
const obj3 = {...obj1, ...obj2}
//obj3 ==> {"name":"xiaoming","age":33}
@yesvods
yesvods / node-folder-structure-options.md
Last active Apr 2, 2018 — forked from lancejpollard/node-folder-structure-options.md
What is your folder-structure preference for a large-scale Node.js project?
View node-folder-structure-options.md

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
You can’t perform that action at this time.