Skip to content

Instantly share code, notes, and snippets.

View pi0's full-sized avatar

Pooya Parsa pi0

View GitHub Profile
<?php
/**
* CakePHP Helper Code Completion
* @author junichi11
*
* install NetBeans 7.0 && cakephp-netbeans plugin
* http://netbeans.org
* https://github.com/evilbloodydemon/cakephp-netbeans/tree/autocomplete
* /path/to/yourproject/nbproject/cake_helper_code_completion.php
*
Wednesday, August 24, 2011
Configure PhpStorm to Auto-complete CakePHP Models, Views, and Controllers
After playing around a bit today I finally figured out how to get PhpStorm to auto-complete methods for models and controllers. Here's what you need to do.
Removing Multiple Definitions
First, let's tackle the multiple definitions problem that we see below.
@pi0
pi0 / GitHub protocol comparison.md
Created November 29, 2016 22:38
A comparison of protocols offered by GitHub (for #git on Freenode).

Primary differences between SSH and HTTPS. This post is specifically about accessing Git repositories on GitHub.

Protocols to choose from when cloning:

plain Git, aka git://github.com/

  • Does not add security beyond what Git itself provides. The server is not verified.

    If you clone a repository over git://, you should check if the latest commit's hash is correct.

@pi0
pi0 / README.md
Created December 18, 2016 10:32 — forked from joyrexus/README.md
Form/file uploads with hapi.js

Demo of multipart form/file uploading with hapi.js.

Usage

npm install
npm run setup
npm run server

Then ...

#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@pi0
pi0 / count.js
Created May 16, 2017 07:31 — forked from yyx990803/count.js
// $ yarn add request request-promise
// $ node count userA userB
const request = require('request-promise')
const get = resource => request({
url: /^https/.test(resource) ? resource : `https://api.github.com/${resource}`,
headers: {
'User-Agent': 'GitHub Contrib Counter',
'Authorization': 'token YOUR_PERSONAL_ACCESS_TOKEN'
@pi0
pi0 / aliasthat.sh
Created June 13, 2017 09:49 — forked from znck/aliasthat.sh
Create an alias for last command.
function aliasthat {
if [ -n ${1} ]; then
fc -e "sed -i -e \"s/^.*/echo alias $1=\\\"'\\\"\'&\'\\\"'\\\" >> ~\/.bash_alias/\""
. ~/.bash_alias
fi
}
  • 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 / 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
@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)
})