Skip to content

Instantly share code, notes, and snippets.

View rednebmas's full-sized avatar

Sam Bender rednebmas

View GitHub Profile
@rednebmas
rednebmas / 0_reuse_code.js
Created July 21, 2014 04:42
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
@rednebmas
rednebmas / reset to commit without erasing history
Created July 22, 2014 21:44
Reset to previous commit without removing history
Reverting Working Copy to an Older Commit
To revert to a commit that's older than the most recent commit:
# Resets index to former commit; replace '56e05fced' with your commit code
git reset 56e05fced
# Moves pointer back to previous HEAD
git reset --soft HEAD@{1}
@rednebmas
rednebmas / heroku drop db
Created July 23, 2014 20:21
Drop database on heroku
heroku pg:reset DATABASE
heroku run rake db:migrate
heroku run rake db:seed
http://stackoverflow.com/questions/4820549/how-to-empty-db-in-heroku
@rednebmas
rednebmas / BackgroundTimerSnippet.m
Created December 5, 2015 01:18
NSTimer that runs in the background
[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:nil];
self.testTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(doStuff) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:self.testTimer forMode:NSRunLoopCommonModes];
@rednebmas
rednebmas / print_html.js
Created February 12, 2016 20:51
Print document HTML in an Anki Card
<script>
var pretag = document.createElement("pre");
pretag.innerHTML = document.getElementsByTagName("html")[0].outerHTML.replace(/[\u00A0-\u9999<>\&]/gim, function(i) {
return '&#'+i.charCodeAt(0)+';';
});
document.body.appendChild(pretag);
</script>
@rednebmas
rednebmas / random_style_options.js
Last active March 13, 2022 07:11
Random style options for Anki Cards for improved memory
/*******************************************************************
* Copy the following code into the FRONT SIDE of any card template in Anki.
*
* Find the next comment block for the snippet for the BACK SIDE.
******************************************************************/
<script>
var modifyIt = document.getElementsByTagName("body")[0];
if (document.getElementsByTagName("hr").length == 0)
@rednebmas
rednebmas / test.html
Last active February 27, 2016 06:42
Responsive HTML "table cell" with vertically centered detail arrow
<!-- Created for my INFO 360 project ProcrastiNo -->
<!-- Based on code from http://jsfiddle.net/Mandarinazul/WMLd4/ -->
<!DOCTYPE html>
<html lang="en">
<body>
<style>
div {
font-family: Tahoma, Verdana sans-serif;
box-sizing: border-box;
-moz-box-sizing: border-box;
@rednebmas
rednebmas / useful_and_common.bash
Last active August 10, 2016 15:05
Useful and common bash commands
#########
## Git ##
#########
# search diff of dangling commits for the word AVCaptureDevice
git fsck --no-reflog | awk '/dangling commit/ {print $3}' | \
while read ref; do if [ "`git show -p $ref|grep -c AVCaptureDevice`" -ne 0 ]; then echo $ref ; fi ; done
# list git commit messages for dangling commits
git fsck --lost-found | grep "dangling commit" | cut -d" " -f 3 | xargs -I "{}" git show --stat "{}" # view git messages for dangling commits
@rednebmas
rednebmas / .bash_profile
Last active February 14, 2019 00:57
My bash profile
## homebrew
export PATH="/usr/local/sbin:$PATH"
### aliases and functions
alias gits='git status'
alias gitbr='git branch '
alias reload='source ~/.bash_profile'
alias b_p='vim ~/.bash_profile'
alias grep='grep --color'
alias ls='ls -1' # each file/folder on it's own line
@rednebmas
rednebmas / karabiner.private.xml
Last active January 12, 2017 17:11
Karabiner (https://pqrs.org/osx/karabiner/) customization file
<?xml version="1.0"?>
<root>
<appdef>
<appname>GOOGLE_CHROME</appname>
<equal>com.google.Chrome</equal>
</appdef>
<appdef>
<appname>TERMINAL</appname>