Skip to content

Instantly share code, notes, and snippets.

Avatar
😁
I may be slow to respond.

snipe snipe

😁
I may be slow to respond.
View GitHub Profile
@snipe
snipe / inputrc
Created Apr 17, 2013
~/.inputrc for nice bash history up-arrows. This allows you to search through your history using the up and down arrows … i.e. type "cd /" and press the up arrow and you'll search through everything in your history that starts with "cd /". Create ~/.inputrc and fill it with this:
View inputrc
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
@snipe
snipe / goatse
Created Mar 14, 2013
Goatse ASCII art that won't break your W3C validation. (The original used double-hyphens inside the HTML comment, which would not validate.)
View goatse
<!--
* * * * * * * * * * * * * * * * * * * * * * * * *
* *
* / \ \ / \ *
*| | \ | | *
*| `. | | : *
*` | | \| | *
* \ | / / \\\ ____ \\ : *
* \ \/ ___~~ ~____| \ | *
* \ \__~ ~__\ | *
View gist:5512408
* g o a t s e x * g o a t s e x * g o a t s e x *
g g
o / \ \ / \ o
a| | \ | | a
t| `. | | : t
s` | | \| | s
e \ | / / \\\ --__ \\ : e
x \ \/ _--~~ ~--__| \ | x
* \ \_-~ ~-_\ | *
g \_ \ _.--------.______\| | g
View Laravel unique for all undeleted
<?php
/*
* Use Case:
* You have multiple deleted_at items that share an attribute that is supposed to be unique,
* for example, a username in a user's table, and are using model-level validation and watson/validation
*
* In this use case, you want to ignore ALL deleted items when considering uniqueness.
*
* The current `unique` validation rule doesn't seem to do this, even when you add the extra
* columns and ignored fields, e.g.:
@snipe
snipe / gist:4256150
Created Dec 11, 2012
Apache Ant build.xml file for PHPUnit+Jenkins+Ant+Symfony2
View gist:4256150
<?xml version="1.0" encoding="UTF-8"?>
<!-- Set some basic project information and targets -->
<project name="My Symfony2 Project" default="build">
<target name="build"
depends="prepare, vendors, dbupdate, fixtures, lint, phploc, phpmd, phpcpd, phpcs, phpunit"/>
<target name="build-parallel"
depends="prepare, vendors, dbupdate, fixtures, lint, tools-parallel, phpcpd, phpunit"/>
View Send Laravel Cashier invoices as an attachment
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use PDF;
@snipe
snipe / anxiety-depression-covid19
Last active Feb 11, 2021
Managing stress, anxiety and depression during Covid-19
View anxiety-depression-covid19
This list started as a Slack message, turned into a company email, then turned
into a blog post to include things *organizations* can do to manage this difficult time.
You can read the final blog post here: https://snipe.net/2020/03/24/managing-stress-anxiety-and-depression-during-covid-19/
------------------
Hi all,
I posted this to slack (and pinned it), but just in case you missed it, here it is in email.
@snipe
snipe / htaccess-ip-lock
Created Nov 6, 2012
Htaccess to handle IP whitelisting, password prompt otherwise
View htaccess-ip-lock
# Welcome to your htaccess file.
# Remember that modifying this file can break the entire website
# so please edit carefully.
# Also remember that the order of the rules below does matter,
# so be sure of what you're doing before shuffling things around.
AuthType Basic
AuthName "My Dev Environment"
# Specify what user/password file the server should look
@snipe
snipe / AppServiceProvider.php
Last active Feb 13, 2020
Validate email array in Laravel 5.2 wth custom validator
View AppServiceProvider.php
<?php
/**
* This service provider handles a few custom validation rules.
*
* PHP version 5.5.9
* @package Snipe-IT
* @version v3.0
*/
namespace App\Providers;
@snipe
snipe / gist:aee3b4f5793cfe0c3d39
Created Mar 6, 2015
Laravel Artisan command to upload fils to S3 with cache-control headers
View gist:aee3b4f5793cfe0c3d39
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class MoveToS3 extends Command {
/**
* The console command name.