This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git branch --merged | grep -Ev "(^\*|master|dev)" | xargs git branch -d | |
git remote prune origin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The grep regex determines what you actually remove | |
# Remove old containers | |
docker ps -a | grep "\(weeks\|hours\) ago" | awk '{print $1}' | xargs docker rm | |
# Remove images without tags | |
docker images | grep "^<none>" | awk '{print $3}' | xargs docker rmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo kextunload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport | |
sudo kextload -b com.apple.iokit.BroadcomBluetoothHostControllerUSBTransport |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Replace the variable 'size' with the desired string length | |
o = [('a'..'z'), ('A'..'Z'), (0..9)].map { |i| i.to_a }.flatten; string = (0...size).map { o[rand(o.length)] }.join |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Re-sync clock on ubuntu | |
sudo /etc/init.d/ntp stop | |
sudo ntpdate ntp.ubuntu.com | |
sudo apt-get install ntp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reflection | |
typeof 100 => Number | |
object instanceof Object => true/false | |
Array.isArray(array_var) => true/false | |
// Detecting object properties | |
"property" in object => true/false // checks own and prototype | |
object.hasOwnProperty("property") => true/false | |
Object.keys(object) // returns own properties only | |
for (var property in object) {} // loops over enumerable own and prototype properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In your .bashrc/.bash_profile paste the following (add any other commands to bundle_commands): | |
bundle_commands="sidekiq spring rake spec rspec cap rails rackup guard middleman" | |
function run_bundler_cmd () { | |
if [ -r ./Gemfile ]; then | |
bundle exec $@ | |
else | |
$@ | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove existing files from repo: | |
find . -name .DS_Store -print0 | xargs -0 git rm --ignore-unmatch | |
Add .DS_Store to .gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery -> | |
checkLocalStorage = -> | |
lastTab = localStorage.getItem("name_of_saved_item") | |
if lastTab | |
# Set active tab to previous tab from before page reload | |
$("a[href='#{lastTab}']").tab("show") | |
localStorage.removeItem("name_of_saved_item") | |
# Execute every time page is loaded | |
checkLocalStorage() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "csv" | |
def csv_headers | |
["Your", "Headers", "Here"] | |
end | |
files = Dir["file_names_*.csv"].sort_by { |f| "if you want to sort the files" } | |
file_contents = files.map { |f| CSV.read(f) } | |
csv_string = CSV.generate do |csv| |
NewerOlder