Skip to content

Instantly share code, notes, and snippets.

View pi0's full-sized avatar
๐Ÿ‘€

Pooya Parsa pi0

๐Ÿ‘€
View GitHub Profile
Verifying my Blockstack ID is secured with the address 1BCMkyjVYDgmUXFGBmFQm683LNiGqaD6jU https://explorer.blockstack.org/address/1BCMkyjVYDgmUXFGBmFQm683LNiGqaD6jU
@pi0
pi0 / lodash.get.js
Last active February 1, 2018 23:30 — forked from harish2704/lodash.get.js
Simple lodash.get function in javascript
/**
* getProp - Simple lodash.get implementation
* @author @harish2704, @muffypl, @pi0
* @param {Object} object
* @param {String|Array} path
* @param {*} defaultVal
*/
function getProp (object, path, defaultVal) {
const _path = Array.isArray(path)
? path
{
// Editor
"editor.fontFamily": "Menlo, Monaco, 'Courier New', monospace",
"diffEditor.renderSideBySide": true,
"editor.find.autoFindInSelection": true,
"editor.fontLigatures": true,
"editor.formatOnSave": false,
"editor.formatOnType": true,
"editor.formatOnPaste": true,
"editor.smoothScrolling": true,
@pi0
pi0 / moss.bash
Last active January 24, 2018 16:38
x all.zip
mkdir extracted && cd extracted
x ../all/*
for f in * ; do mv -v $f `echo $f | grep -oE "\d{6,}"` ; done
rm -rf `find . | grep -iE "jquery|owl|bootstrap|node_modules|bower|vendor|slick"`
moss -l javascript **/*.js
@pi0
pi0 / crawl.sh
Last active October 2, 2017 22:15
Fully working crawler using wget
wget -nv -t3 -c -nH -r -l0 -k -p -np -e robots=off --reject-regex "\/\?(.*)" [url]
@pi0
pi0 / get_locales.js
Last active September 30, 2017 07:47
// https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry
function get_locales() {
let all = document.getElementsByTagName('pre')[0].innerText
let regex = /Subtag: (.*)/
let match
let matches = []
while(match = regex.exec(all)) {
matches.push(match[1])
}
  • The benchmarks used by Marko, with one benchmark containing only a single component with ~50 lines of code, and the other 3 components with one of them fully static markup, are typical micro-benchmarks created to the advantage of certain implementation details. They are too isolated and too trivial to justify across-the-board performance claims.

  • For client-side performance I recommend using the 3rd party js-framework-benchmark as a more neutral reference; the benchmark tests a much bigger workload and covering a much more comprehensive performance scenarios. According to the data from the latest round Vue actually outperforms Marko. That said, even this benchmark doesn't reflect real world performance where much more overhead comes from big component trees.

  • Vue has significantly improved SSR performance for

@pi0
pi0 / .dockerignore
Last active August 29, 2018 21:04
Multi Stage Docker Builds for Node.js
node_modules
html {
direction: rtl;
}
body {
direction: rtl;
}
.text-left {
text-align: right;
@pi0
pi0 / plugin.js
Last active August 25, 2017 22:59
Nuxt Middleware Using Modules
import middleware from '~/.nuxt/middleware'
middleware.auth = function ({ store }) {
console.log('Auth middleware!')
}
/*
Notes:
- Nuxt modules can provide plugins: https://nuxtjs.org/guide/modules#provide-plugins
- Do not write stateful code that relies on global context or you will get into trouble with SSR