Skip to content

Instantly share code, notes, and snippets.

View sanathks's full-sized avatar
🖖
Ѧ ѧ ︵͡︵ ̢ ̱ ̧̱ι̵̱̊ι̶̨̱ ̶̱ ︵ Ѧѧ ︵͡ ︵ ѧ Ѧ ̵̗̊o̵̖ ︵ Ѧ

Sanath Samarasinghe sanathks

🖖
Ѧ ѧ ︵͡︵ ̢ ̱ ̧̱ι̵̱̊ι̶̨̱ ̶̱ ︵ Ѧѧ ︵͡ ︵ ѧ Ѧ ̵̗̊o̵̖ ︵ Ѧ
View GitHub Profile
@sanathks
sanathks / currency-code.ts
Created July 7, 2020 09:10
Currency code enum for typescript
export enum CurrencyCode {
AED = 'AED',
AFN = 'AFN',
ALL = 'ALL',
AMD = 'AMD',
ANG = 'ANG',
AOA = 'AOA',
ARS = 'ARS',
AUD = 'AUD',
AWG = 'AWG',
sudo apt-get install -y curl zip unzip git nginx php7.2-fpm php7.2-cli php7.2-pgsql php7.2-gd php7.2-curl php-memcached php7.2-imap php7.2-mbstring php7.2-xml php7.2-zip php7.2-bcmath php7.2-soap php7.2-intl php-mongodb php7.2-readline php-msgpack php-igbinary
sudo apt-get -y install unzip zip php7.2 php7.2-mysql php7.2-fpm php7.2-mbstring php7.2-xml php7.2-curl
@sanathks
sanathks / DbTransaction.php
Created September 4, 2018 03:24
Laravel Database transaction middleware
<?php
namespace Core\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Validation\UnauthorizedException;
use Illuminate\Support\Facades\DB;
use Symfony\Component\HttpFoundation\Response;
@sanathks
sanathks / supervisord-example.conf
Created January 22, 2017 19:16 — forked from didip/supervisord-example.conf
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@sanathks
sanathks / load_routes.php
Created October 27, 2016 05:45
autoload routes
<?php
foreach (new DirectoryIterator(__DIR__.'/'.'Routes') as $file)
{
if (!$file->isDot() && !$file->isDir())
{
require_once __DIR__.'/Routes/'.$file->getFilename();
}
}
@sanathks
sanathks / composer-install.sh
Created May 27, 2016 05:49
install composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
function parse_git_dirty() {
git diff --quiet --ignore-submodules HEAD 2>/dev/null; [ $? -eq 1 ] && echo "*"
}
function parse_git_branch() {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/\1$(parse_git_dirty)/"
}
alias ga="git add ."
alias gaa="git add --all"
@sanathks
sanathks / 0_reuse_code.js
Last active August 29, 2015 14:27
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console