Skip to content

Instantly share code, notes, and snippets.

@vinacode
vinacode / PhpStorm Keyboard Shortcuts.md
Created December 24, 2016 14:42 — forked from koomai/PhpStorm Keyboard Shortcuts.md
Frequently Used PhpStorm Keyboard Shortcuts

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

@vinacode
vinacode / _ide_helper.php
Created December 1, 2016 02:20 — forked from barryvdh/_ide_helper.php
Laravel IDE Helper for Netbeans / PhpStorm / Sublime Text 2 CodeIntel, generated using https://github.com/barryvdh/laravel-ide-helper
<?php
/**
* A helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.1.40 (LTS) on 2016-07-18.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@vinacode
vinacode / RESTful API with Symfony 2 + FOSRestBundle FOSUserBundle + FOSOauthServerBundle.md
Last active July 20, 2016 01:18 — forked from tjamps/README.md
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@vinacode
vinacode / GreaseMonkeyCookieInjector.user.js
Created November 27, 2015 14:47
GreaseMonkey Cookie Injector
// ==UserScript==
// @name Cookie Injector
// @namespace BearsWithWings
// @description Inject Cookie String From Wireshark Dump Into Any Webpage
// @version 2.0.1
// @include *
// @exclude https?://gmail.com/*
// @exclude https?://mail.google.com/*
// ==/UserScript==
@vinacode
vinacode / count_string_length_japanese.php
Created March 31, 2015 08:20
Check Japanese Characters string
<?php
class JapaneseCharacters {
/**
* Check character is half-width Katakana
*
* @param string $char
* @return boolean
*/
public static function checkKatakana($char) {
return (preg_match('/[\x{FF61}-\x{FF9F}]/u', $char) > 0);
/**
* Convert "Kana" one from another
* (zen-kaku, han-kaku and more)
*
* @param string str
* @param string option (optionaly)
* @return string converted string
*/
function convert_kana (str, option) {
option = option || "KV";
@vinacode
vinacode / symfony2command.txt
Created January 9, 2015 05:48
Symfony2 command line
###########################
******Symfony 2****
#Command list
php app/console list
#Clear cache
php app/console cache:clear
php app/console cache:clear --env=prod --no-debug
php app/console generate:bundle --namespace=Acme/TestBundle
php app/console assets:install web
php app/console assets:install --symlink web
@vinacode
vinacode / ContactController.php
Created January 9, 2015 04:15
CakePHP 3 contact controller
<?php
namespace App\Controller;
use App\Controller\AppController;
use App\Form\ContactForm;
class ContactController extends AppController
{
public function index()
@vinacode
vinacode / index.ctp
Created January 9, 2015 04:14
CakePHP Contact template
<?php
echo $this->Form->create($contact);
if ($this->Form->isFieldError('name')) {
echo $this->Form->error('name'); }
echo $this->Form->input('name', array('error' => false));
echo $this->Form->input('email');
echo $this->Form->input('body');
echo $this->Form->button('Submit');
echo $this->Form->end();
?>
@vinacode
vinacode / ContactForm.php
Created January 9, 2015 04:12
CakePHP 3.0 Contact form
<?php
namespace App\Form;
use Cake\Form\Form;
use Cake\Form\Schema;
use Cake\Validation\Validator;
/**
* Description of ContactForm