Skip to content

Instantly share code, notes, and snippets.

View JrGoodle's full-sized avatar
🐈‍⬛

Joe DeCapo JrGoodle

🐈‍⬛
View GitHub Profile
@JrGoodle
JrGoodle / 0_reuse_code.js
Last active August 29, 2015 14:23
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@JrGoodle
JrGoodle / adb-screenshot.sh
Last active August 29, 2015 14:22
Save Android screenshot on Desktop
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > $HOME/Desktop/screen.png
@JrGoodle
JrGoodle / git-restore-last-version.sh
Last active August 29, 2015 14:22
Git - Check out deleted file from commit before deletion
RESTORE_FILE=file/to/restore
git checkout $(git rev-list -n 1 HEAD -- "$RESTORE_FILE")^ -- "$RESTORE_FILE"
@JrGoodle
JrGoodle / compilers.cmake
Last active August 29, 2015 14:21
Check for current C++ compiler
Configuration based on current compiler
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
# using Clang
set(COMPILER_NAME "Clang")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# using GCC
set(COMPILER_NAME "GCC")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
# using Intel C++
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
@JrGoodle
JrGoodle / git-rename-case.sh
Last active August 29, 2015 14:21
Rename file in git when there's just a change in case
git mv -f File file
include(CMakeParseArguments)
# Function to wrap a given string into multiple lines at the given column position.
# Parameters:
# VARIABLE - The name of the CMake variable holding the string.
# AT_COLUMN - The column position at which string will be wrapped.
function(WRAP_STRING)
set(oneValueArgs VARIABLE AT_COLUMN)
cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN})
@JrGoodle
JrGoodle / my-platform-check.sh
Last active August 29, 2015 14:14
Bash Platform check
case "$(uname)" in
Linux) export MY_PLATFORM="linux";
;;
Darwin) export MY_PLATFORM="osx";
[[ -e "/usr/local/bin/brew" ]] && export PATH=/usr/local/bin:$PATH #Homebrew
;;
CYGWIN*) export MY_PLATFORM="windows";
;;
esac
#! /bin/bash
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
# black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
@JrGoodle
JrGoodle / ack-find-replace.sh
Last active August 29, 2015 14:14
find and replace with ack and perl regex
ack -l 'PATTERN' | xargs perl -pi -E 's#PATTERN#REPLACEMENT#g'
ack -lQ '${PATTERN}' | xargs perl -pi -E 's#\${PATTERN}#\${REPLACEMENT}#g'
@JrGoodle
JrGoodle / meow.sh
Last active August 29, 2015 14:14
bash meow shell function
#!/bin/bash
function meow() {
local CURRENT_VOLUME=$(osascript -e 'output volume of (get volume settings)')
osascript -e "set volume output volume 50"
say -v Kathy meow
osascript -e "set volume output volume \"${CURRENT_VOLUME}\""
}