Skip to content

Instantly share code, notes, and snippets.

View ignasbernotas's full-sized avatar
🎉

Ignas Bernotas ignasbernotas

🎉
View GitHub Profile
@ignasbernotas
ignasbernotas / christmas.php
Created December 30, 2015 16:26
Christmas tree
<?php
/**
* Ask santa for less fugly code next year
*
* Happy new year from Ignas:)
*/
//Open alternate window
@ignasbernotas
ignasbernotas / gitpull.command
Created January 14, 2016 14:00
Git pull cronjob
*/1 * * * * su -s /bin/sh root -c 'cd <project_dir> && /usr/bin/git pull && node node_modules/gulp/bin/gulp.js --production && composer update && chown -R user:user *'
@ignasbernotas
ignasbernotas / .htaccess
Last active April 3, 2016 20:49
.htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond /public/%{REQUEST_URI} -d
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)$ /public/$1/
RewriteBase /
RewriteCond %{REQUEST_URI} !^/public/
@ignasbernotas
ignasbernotas / size.sql
Created April 15, 2016 09:34
Calculates data and index size
SELECT
IF(ISNULL(DB)+ISNULL(ENGINE)=2,'Database Total',
CONCAT(DB,' ',IFNULL(ENGINE,'Total'))) "Reported Statistic",
LPAD(CONCAT(FORMAT(DAT/POWER(1024,pw1),2),' ',
SUBSTR(units,pw1*2+1,2)),17,' ') "Data Size",
LPAD(CONCAT(FORMAT(NDX/POWER(1024,pw2),2),' ',
SUBSTR(units,pw2*2+1,2)),17,' ') "Index Size",
LPAD(CONCAT(FORMAT(TBL/POWER(1024,pw3),2),' ',
SUBSTR(units,pw3*2+1,2)),17,' ') "Total Size"
FROM
'use strict'
(function() {
})();
@ignasbernotas
ignasbernotas / artisan.sh
Created August 8, 2016 08:35
Artisan bash autocompletion
#!/bin/bash
_artisan()
{
local cache commands artisanOutput word
_get_comp_words_by_ref -n : -c word
cache=/tmp/.artisan_command_cache_$BASHPID
commands=()
@ignasbernotas
ignasbernotas / loader.js
Created October 17, 2016 22:39
Vuex initial data preloading plugin
import * as types from './../mutation-types'
export default function loadInitialState () {
return store => {
const actions = [
types.UPDATE_PROJECT_LIST
]
actions.forEach(action => store.dispatch(action))
}
@ignasbernotas
ignasbernotas / relationships.js
Last active October 18, 2016 01:13
Dexie relationship loading plugin
import Dexie from 'dexie'
/**
* Usage: db.table_a.with('table_a_children', 'parent_id', 'children', 'id')
*
* This will return all items from table 'table_a'
* where each item will have a 'children' array with linked records from 'table_a_children' table
*/
Dexie.addons.push((db) => {
/**
<?php
namespace App\Libraries\Date;
use Carbon\Carbon;
/**
* Class DateRange
*
* @package App\Libraries\Date
@ignasbernotas
ignasbernotas / setup.sh
Last active June 3, 2017 08:44
OSX Setup
#!/bin/sh
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew tap caskroom/cask
brew cask install google-chrome iterm2 sequel-pro vagrant virtualbox slack spotify boom bettertouchtool vlc phpstorm basecamp bittorrent zsh
brew install git
mv /usr/local/Caskroom/bittorrent/latest/Bittorrent.app /Applications/Bittorrent.app