Skip to content

Instantly share code, notes, and snippets.

@etelford
etelford / gist:7529cab70ff93b3be7ad
Created November 8, 2014 14:50
Use emoji in bash prompt
export PS1="\w 🎺 : "
@etelford
etelford / git-snippets.md
Last active August 4, 2020 23:06
Various git snippets

Branches

Create a new branch from a specific commit

git checkout -b {new_branch_name} {hash}

Delete local branch

git branch -d {branch_name}

Delete remote branch

git push origin --delete {branch_name}

@etelford
etelford / bash_snippets.sh
Created April 17, 2015 13:44
Bash snippets
# Find and delete all files old than 3 days
`find . -name "*.sql.gz" -mtime +3 -delete`
@etelford
etelford / vim-snippets.sh
Last active August 29, 2015 14:20
Vim snippets
# Copy a line
yy
# Delete a line
dd
# Past line AFTER
p
# Past line BEFORE
@etelford
etelford / PrimaryColor.php
Last active February 2, 2017 20:00
Get the most common color from an image using the PHP Intervention library
<?php
use Intervention\Image\Filters\FilterInterface;
/**
* A simple filter to get the predominant color from an image using the
* Intervention library (http://image.intervention.io).
*
* Usage with no options:
* $image = Image::make($file);
https://github.com/jakubroztocil/httpie
export FIRE='Authorization:Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI'
http -v PUT :8000/profile "$FIRE" email=bob@aol.com avatar=http://google.com age=33
  1. Get the deploy URL from Forge (or other PaaS)

  2. Create a dotfile in the root of your project, like .forge, and place the URL in that file

  3. Add the file from step 2 to your .gitignore

  4. Add the following to your .zshrc or .bashrc, etc.

    function deploy() { xargs curl -I < .forge & }

@etelford
etelford / debug.html
Created September 30, 2016 18:38
Bootstrap Responsive Debugging
<div id="u-debug-size">
<div id="u-debug-size__inner"></div>
</div>
<!-- make 31 option tags with value and the text the two-digit number in the sequence -->
option[value="$$"]${$$}*31
<!-- or specify the start value -->
option[value="$$$$@2017"]${$$$$@2017}*83
@etelford
etelford / debug.blade.php
Created April 5, 2018 12:53
CSS viewport debug for Tailwind CSS
@if(env('CSS_DEBUG'))
<div class="fixed pin-b pin-l text-white opacity-50">
<span class="absolute pin-b pin-l bg-red p-4 sm:hidden md:hidden lg:hidden xl:hidden">Mobile</span>
<span class="absolute pin-b pin-l bg-orange p-4 hidden sm:block md:hidden lg:hidden xl:hidden">Small</span>
<span class="absolute pin-b pin-l bg-green p-4 hidden sm:hidden md:block lg:hidden xl:hidden">Medium</span>
<span class="absolute pin-b pin-l bg-blue p-4 hidden sm:hidden md:hidden lg:block xl:hidden">Large</span>
<span class="absolute pin-b pin-l bg-purple p-4 hidden sm:hidden md:hidden lg:hidden xl:block"><nobr>X-Large</nobr></span>
</div>
@endif