Skip to content

Instantly share code, notes, and snippets.

View fosron's full-sized avatar
💻
Hard at work

Tautvydas fosron

💻
Hard at work
View GitHub Profile
@fosron
fosron / SupervisordInstallationUbuntu12.04LTS.md
Created February 9, 2018 16:09 — forked from alexhayes/SupervisordInstallationUbuntu12.04LTS.md
Supervisord Installation on Ubuntu 12.04 LTS

Supervisord Installation on Ubutnu 12.04 LTS

There are a number of solutions for installing supervisord and automatically running it on Ubuntu - this is what worked for me (on multiple installations...).

Installation

Quick & Easy

sudo bash < <(curl https://gist.githubusercontent.com/alexhayes/814fd0d0f7020e918a95/raw/full-install.sh)
@fosron
fosron / LoggerTrait.php
Last active June 11, 2019 06:40
Trait for Logging to both Console and A Log File (To use with Laravel Artisan Commands)
<?php
namespace App\Traits;
use Monolog\Formatter\FormatterInterface;
use Monolog\Formatter\JsonFormatter;
use Monolog\Formatter\LineFormatter;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Logger;
use Monolog\Processor\GitProcessor;
@fosron
fosron / bash_profile.sh
Last active October 2, 2017 07:49
Various .bash_profile / .bash_rc additions for macOS and other Shell resources
# .bash_profile
# colors for shell
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
# start aliases
# git commamands simplified
@fosron
fosron / instructions.md
Last active September 21, 2017 09:22
XDebug and MAMP

Instructions

Comment out anything xdebug related (except the extension itself) from your CLI ini File (MAMP has 2 different files for CLI and Apache), find the file with:

php -i | grep "Loaded Configuration"

Add this to ~/.bash_profile

@fosron
fosron / color-extractor.php
Last active May 10, 2017 08:11
color-extractor
<?php
<<<CONFIG
packages:
- "league/color-extractor: 0.3.*"
CONFIG;
use League\ColorExtractor\Color;
use League\ColorExtractor\ColorExtractor;
use League\ColorExtractor\Palette;
@fosron
fosron / timer.js
Last active February 21, 2017 12:12
Micro-optimisations for JS
var timer = function(name) {
var start = new Date();
return {
stop: function() {
var end = new Date();
var time = end.getTime() - start.getTime();
console.log('Timer:', name, 'finished in', time, 'ms');
}
}
};
@fosron
fosron / CronRunCommand.php
Created December 15, 2016 15:46 — forked from sisou/CronRunCommand.php
Cron job command for Laravel 4.2
<?php
# Cron job command for Laravel 4.2
# Inspired by Laravel 5's new upcoming scheduler (https://laravel-news.com/2014/11/laravel-5-scheduler)
#
# Author: Soren Schwert (GitHub: sisou)
#
# Requirements:
# =============
# PHP 5.4
@fosron
fosron / Envoy.blade.php
Created November 3, 2016 14:04
Envoy simple deploy script
@servers(['web' => 'user@server.com'])
@setup
$dir = '/var/www'
@endsetup
@task('deploy')
cd {{ $dir }};
echo Putting website in maintenance
php artisan down
@fosron
fosron / colors.md
Created September 6, 2016 06:31 — forked from 0x263b/colors.md
Random color from string in javascript

Random color from string in javascript

Consider a list of strings you need to permanently assign a random color.

First you should turn the string into a hash.

var string = "string"
var hash = 0
@fosron
fosron / arrays.md
Last active August 26, 2016 08:20
Conversion of arrays

#Convert a HTML input 2-dimensional array into an array of keys-values

We get this JSON input:

{
    "number":[
        "1241",
        "1241"
 ],