Skip to content

Instantly share code, notes, and snippets.

View smashedlife's full-sized avatar

Jonathan So smashedlife

  • Portland, Oregon
View GitHub Profile
@smashedlife
smashedlife / make_bootable_windows_usb.md
Created May 24, 2015 06:47
Make a bootable flash drive on Windows

Open the command prompt as an administrator and run the following commands:

  1. diskpart
  2. list disk
  3. select disk (usb disk)
  4. clean
  5. create partition primary
  6. select partition 1
  7. active
  8. format fs=fat32 quick

Programming Elixir Exercises

Chapter 2 - Pattern Matching

Exercise: Pattern Matching 2

Which of the following will match

[ a, b, a ] = [ 1, 2, 3 ]
# (MatchError) no match of right hand side value: [ 1, 2, 3 ]
@smashedlife
smashedlife / 0_reuse_code.js
Created June 13, 2014 18:19
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
@smashedlife
smashedlife / git-deploy.rb
Last active August 29, 2015 14:01
git-deploy
#!/usr/bin/env ruby
if ARGV[0].nil? || ARGV[0].empty?
deploy = 'deploy.yml'
else
deploy = ARGV[0] + '.yml'
end
unless File.exists? deploy
puts "File does not exist: " + deploy

EmberConf 2014 Talks – Slides and Other Resources

This is an unofficial list gathered from presenters' Twitter feeds. Last updated March 29, 2014. All talks were recorded so videos should be posted at some point at EmberConf.com.

Day 1

Keynote – Yehuda Katz and Tom Dale

@smashedlife
smashedlife / Linux Commands.md
Last active January 4, 2016 21:29
Useful Linux commands

Delete all files older than X days

find /path/to/base/dir -type d -ctime +10 -exec rm -fr {} \;

What it all does:

  • find: the unix command for finding files /directories / links etc.
  • /path/to/base/dir: the directory to start your search
@smashedlife
smashedlife / Gitstats.sh
Last active March 16, 2021 01:01
Git stats
# detailed stats for an individual
git log --shortstat --author=AUTHOR --since=9-1-2013 --until=9-30-2013 | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed: ", files, "\nlines inserted: ", inserted, "\nlines deleted: ", deleted}'
# commit numbers by author for the repo
git log --pretty=format:%an --since=10-1-2011 | awk '{ ++c[$0]; } END { for(cc in c) printf "%5d %s\n",c[cc],cc; }' | sort -r
# detailed stats per author, including contribution to the total change
git log --numstat --since=8-1-2014 --until=8-31-2014 | awk '
function printStats(author) {
printf "%s:\n", author
@smashedlife
smashedlife / vim.md
Last active December 21, 2015 05:58
List of VIM key mappings

Random Commands

ctrl+z - minimize vim
fg - restore vim

Ctrl-P

ctrl+b - Change to buffer managemenet
ctrl+v - Open file in vertical split

ctrl+x - Open file in new horizontal vim session

@smashedlife
smashedlife / Default (OSX).sublime-keymap
Created February 1, 2013 07:02
Custom Key Bindings for Sublime Text Editor
[
{ "keys": ["f1"], "command": "toggle_side_bar" },
{ "keys": ["j", "j"], "command": "exit_insert_mode",
"context":
[
{ "key": "setting.command_mode", "operand": false },
{ "key": "setting.is_widget", "operand": false }
]
},
{ "keys": ["ctrl+t"], "command": "side_bar_new_file2" },
@smashedlife
smashedlife / Preferences.sublime-settings
Last active December 11, 2015 16:09
Sublime Text Editor User Preferences
{
"bold_folder_labels": true,
"caret_style": "wide_caret",
"close_windows_when_empty": true,
"color_scheme": "Packages/Color Scheme - Default/Monokai Bright.tmTheme",
"detect_slow_plugins": false,
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",