Skip to content

Instantly share code, notes, and snippets.

View pi0's full-sized avatar

Pooya Parsa pi0

View GitHub Profile
@pi0
pi0 / ResumeCreator.js
Last active June 28, 2018 08:23 — forked from farzadso/No mutations at all
This is what I call clean coding
import assert from 'assert';
updateStepFourProps(type, operation, id) {
assert(Array.isArray(this.state[type]), `Cannot do operation on type '${type}'`)
switch (operation) {
case 'add':
this.setState({
[type]: this.state[type].concat(id)
})
#include <util/delay.h>
void SevenSegment(unit8_t count) {
switch (count) {
case 0: PORT_7_SEGMENT=0b10001000; break;
case 1: PORT_7_SEGMENT=0b10111110; break;
case 2: PORT_7_SEGMENT=0b00011001; break;
case 3: PORT_7_SEGMENT=0b00011100; break;
case 4: PORT_7_SEGMENT=0b00101110; break;
case 5: PORT_7_SEGMENT=0b01001100; break;
import idMixin from '../../mixins/id'
import formMixin from '../../mixins/form'
import formSizeMixin from '../../mixins/form-size'
import formStateMixin from '../../mixins/form-state'
import { arrayIncludes } from '../../utils/array'
// Import styles
import './form-input.css'
// Valid supported input types
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