Skip to content

Instantly share code, notes, and snippets.

[alias]
co = checkout
br = branch
ci = commit
st = status
plom = pull origin master
phom = push origin master
plo = pull origin
pho = push origin
ru = remote update
@kkiernan
kkiernan / _panels.scss
Created January 27, 2017 15:51
Collapsable Bootstrap Panel
//
// Mixins
//
@mixin panel-heading-control($content) {
border-right: 1px solid #ccc; // Adjust as needed
content: $content;
font-family: 'fontawesome'; // Adjust as needed
left: 0;
@kkiernan
kkiernan / Post.php
Last active November 27, 2021 03:50
Versioning trait for Laravel models
<?php
namespace App;
use App\Traits\Versionable;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
use Versionable;
@kkiernan
kkiernan / NullableFields.php
Last active April 29, 2016 13:32
A trait to help deal with handling empty strings in Eloquent models
<?php
namespace App\Models;
/**
* Converts empty values to nulls before saving a model to storage.
*/
trait NullableFields
{
/**
@kkiernan
kkiernan / scp-download.sh
Last active October 5, 2017 16:29
Secure copy files from server to local machine using ssh alias
#!/usr/bin/bash
# Copy a directory from the server to the local machine.
scp -r some-server:/some/server/path/ /some/local/path/
@kkiernan
kkiernan / file-name-formatter.php
Last active March 1, 2016 18:23
Quick script to clean up file names in a directory
<?php
/*
|---------------------------------------------------------------------
| Rename Files
|---------------------------------------------------------------------
|
| This is a simple script to renames files in the current directory.
| It converts filenames to lowercase, removes non-alphanumeric
| characters and converts spaces to dashes.
@kkiernan
kkiernan / MySqlDump.php
Last active March 4, 2024 19:19
Laravel Artisan command that runs the mysqldump utility
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class MySqlDump extends Command
{
/**
* The name and signature of the console command.
@kkiernan
kkiernan / ArrayPaginator.php
Last active June 6, 2023 07:48
A reusable helper class for pagination of array items in Laravel.
<?php
namespace App\Http\Utilities;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
class ArrayPaginator
{
@kkiernan
kkiernan / create.py
Last active December 27, 2022 09:25
import sublime, sublime_plugin, re
class CreateCommand(sublime_plugin.TextCommand):
# Runs the plugin
def run(self, edit, stub, offset):
self.view.insert(edit, offset, stub)
@kkiernan
kkiernan / index.html
Last active August 3, 2024 06:38
A Vue.js filter that formats a phone number.
<input type="text"
name="home_phone"
class="form-control"
v-model="homePhone | phone"
lazy>