Skip to content

Instantly share code, notes, and snippets.

View gayanhewa's full-sized avatar
🐢

Gayan Hewa gayanhewa

🐢
View GitHub Profile
@gayanhewa
gayanhewa / Google protobuf installation on Mac
Created December 5, 2018 22:16 — forked from rajkrrsingh/Google protobuf installation on Mac
Steps to Install google protobuf on Mac
$wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.bz2
$tar xvf protobuf-2.5.0.tar.bz2
$cd protobuf-2.5.0
$./configure CC=clang CXX=clang++ CXXFLAGS='-std=c++11 -stdlib=libc++ -O3 -g' LDFLAGS='-stdlib=libc++' LIBS="-lc++ -lc++abi"
$make -j 4
$sudo make install
$protoc --version
@gayanhewa
gayanhewa / disable-xdebug.sh
Created August 23, 2018 21:03 — forked from hacfi/disable-xdebug.sh
OS X homebrew php 7.0 enable/disable xdebug extension script
#!/bin/sh
sed -i.default "s/^zend_extension=/;zend_extension=/" /usr/local/etc/php/7.0/conf.d/ext-xdebug.ini
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
echo "xdebug disabled"
@gayanhewa
gayanhewa / xdebug
Created August 22, 2017 07:54
xdebug visual studio code using the php debug extension from felix
1. Remote VM must have xdebug running
vagrant@app:/etc/php/7.0/fpm$ cat conf.d/20-xdebug.ini
zend_extension=/usr/lib/php/20151012/xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_connect_back=1
xdebug.remote_port=9000
2. VSCode should have the below launch config.
@gayanhewa
gayanhewa / index.php
Created August 8, 2017 04:41
Visa Checkout Sample
<html>
<head>
<script type="text/javascript">
function createCookie(name,value,days) {
var expires = "";
if (days) {
var date = new Date();
date.setTime(date.getTime() + (days*24*60*60*1000));
@gayanhewa
gayanhewa / au_phone_validate
Created February 16, 2017 09:47
jquery validator australian phone number
jQuery.validator.addMethod("au_phone", function(value, element) {
return this.optional(element) || /^(?:\+?(61))? ?(?:\((?=.*\)))?(0?[2-57-8])\)? ?(\d\d(?:[- ](?=\d{3})|(?!\d\d[- ]?\d[- ]))\d\d[- ]?\d[- ]?\d{3})$/.test(value);
}, "Invalid phone number");
@gayanhewa
gayanhewa / HTML: select, year & month.js
Created February 4, 2017 01:46 — forked from kovaldn/HTML: select, year & month.js
HTML: select, year & month
// html
<label for="year">Год</label>
<select name="year" id="year"></select>
<label for="month">Месяц</label>
<select name="month" id="month">
<option value = "1">01</option>
<option value = "2">02</option>
<option value = "3">03</option>
<option value = "4">04</option>
@gayanhewa
gayanhewa / vimrc
Last active December 21, 2016 02:42
Vimrc
call plug#begin('~/.vim/plugged')
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'ervandew/supertab'
Plug 'shawncplus/phpcomplete.vim'
Plug 'tpope/vim-fugitive'
Plug 'bling/vim-bufferline'
Plug 'mileszs/ack.vim'
call plug#end()
set nocompatible
@gayanhewa
gayanhewa / Routes
Created December 8, 2016 12:26
Adding Routes
// Using a closure
$router->add('GET', '/', function() {
echo "Hello World";
});
// Using class method mapping
$route->add('GET', '/new/route', ClassName::class, 'method');
@gayanhewa
gayanhewa / Project Structure
Created December 8, 2016 12:26
Project Structure
app/ - App Diretory
config/
routes/ - All route files go in here.
routes.php - Default route file. All route files added will be loaded when the app is bootstrapped.
services/ - Service bindings
services.php
bootstrap/
bootstrap.php - Bootstrapping code for the app
public/
index.php - Entry point to the web app
@gayanhewa
gayanhewa / rtl8821ae.conf
Created November 27, 2016 06:48
Realtek 8821ae driver config for linux. This avoids the connection drops for the 8821ae driver. Tested against debian jessie
options rtl8821ae debug=0 disable_watchdog=N fwlps=N swlps=Y swenc=Y ips=N msi=0