Skip to content

Instantly share code, notes, and snippets.

View jackmakiyama's full-sized avatar

Jack Makiyama jackmakiyama

View GitHub Profile
#!/bin/bash
# install homebrew's official php tap
brew tap josegonzalez/homebrew-php
# install homebrew-dupes (required to install zlib, php54's dependency)
brew tap homebrew/dupes
# install nginx + mysql + php 5.4 + php-fpm + apc + xdebug
brew install nginx mysql
<snippet>
<content><![CDATA[public function get${1/(.*)/\u$1/}()
{
return \$this->${1:$SELECTION};
}
public function set${1/(.*)/\u$1/}(\$$1)
{
\$this->$1 = \$$1;
return \$this;
<?php
//Sample: http://localhost/controller.php?name=Fulano
include 'model.php';
$hw = new HelloWorld;
$name = $_GET['name'];
$greetings = $hw->say($name);

Basics

<?php

use Respect\Relational\Mapper;
use Respect\Data\Collections\Collection;

//Configuring
<?php
//Sample: http://localhost/controller.php?name=Fulano
include 'model.php';
$hw = new HelloWorld;
$name = $_GET['name'];
$greetings = $hw->say($name);
----- Esc -----
Quick change directory: Esc + c
Quick change directory history: Esc + c and then Esc + h
Quick change directory previous entry: Esc + c and then Esc + p
Command line history: Esc + h
Command line previous command: Esc + p
View change: Esc + t (each time you do this shortcut a new directory view will appear)
Print current working directory in command line: Esc + a
Switch between background command line and MC: Ctrl + o
Search/Go to directory in active panel: Esc + s / Ctrl + s then start typing directory name
<?php
return [
// http://www.cidades.ibge.gov.br/download/mapa_e_municipios.php?uf=ac (Thu May 14 16:30:15 BRT 2015)
'AC' => [
1200013 => 'Acrelândia',
1200054 => 'Assis Brasil',
1200104 => 'Brasiléia',
1200138 => 'Bujari',
1200179 => 'Capixaba',
@jackmakiyama
jackmakiyama / php-server
Created October 21, 2015 19:33
Run PHP built-in web server with no need of a router file.
#!/usr/bin/env php
<?php
/**
* Usage: php-server [ OPTIONS ] [ DOCUMENT_ROOT ]
*
* When not defined, DOCUMENT_ROOT is the current directory.
*
* -a, --application Defines the application file (default "index.php")
* -b, --background When defined runs server in background
* -h, --host Defines the host of the HTTP web server (default "127.0.0.1")
@jackmakiyama
jackmakiyama / User.php
Created November 5, 2015 02:15 — forked from Ocramius/User.php
Doctrine 2 @OneToMany @manytoone example
<?php
namespace HelloWorld;
use InvalidArgumentException;
/**
* This class is somewhere in your library
* @Entity
* @Table(name="users")
*/
@jackmakiyama
jackmakiyama / User.php
Created November 5, 2015 02:16 — forked from Ocramius/User.php
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User