Skip to content

Instantly share code, notes, and snippets.

View seanbuscay's full-sized avatar

Sean Buscay seanbuscay

View GitHub Profile
@seanbuscay
seanbuscay / if_file_exists.sh
Created July 29, 2013 15:05
Check if file existsd
#!/bin/bash
FILE=$1
 
if [ -f $FILE ];
then
echo "File $FILE exists"
else
echo "File $FILE does not exists"
fi
@seanbuscay
seanbuscay / misc.php
Last active September 7, 2018 19:31
Get the first sentence in a string.
function firstSentence($string) {
$sentences = explode(".", $string);
return $sentences[0];
}
git checkout --orphan newbranch
git rm -rf .
<do work>
git add your files
git commit -m 'Initial commit'
Flush DNS in OS X 10.9 Mavericks
Running the latest version of OS X? Here is how to flush the DNS cache in 10.9:
dscacheutil -flushcache;sudo killall -HUP mDNSResponder
@seanbuscay
seanbuscay / strip_classes.php
Created September 23, 2013 16:16
function to remove classes on tags. Note will fail if body tag has a class in it. See: http://stackoverflow.com/questions/1170912/strip-all-classes-from-p-tags
$html=preg_replace('/class=".*?"/', '', $html);
<?php
/**
 *
 * @strip a single HTML/XML tag from a string
 *
 * @param array $tags The tags to strip
 *
 * @param string The string to strip from
 *
pbcopy < ~/.ssh/id_rsa.pub
@seanbuscay
seanbuscay / git_remote_prune.sh
Created October 8, 2013 18:29
cleanup remote branches list. the dry run shows you what it will do. withouth the flag it will run the clean up.
git remote prune origin --dry-run
rm -rf ~/.Trash/*
find . -exec touch {} \;