Skip to content

Instantly share code, notes, and snippets.

@kaplan
kaplan / tmux_cheatsheet.markdown
Last active May 14, 2021 01:51
My most commonly used tmux commands and reference sites for learning tmux

tmux handy commands and references

####sessions

tmux new -s session_name      # new session by name
tmux attach -t session_name     # attach session by name (you can also use a instead of attach)
tmux switch -t session_name     # switch session by name (you can also use a instead of attach)
tmux list-sessions              # list existing sessions
bind-key : new -s session_name  # new session from within a session  
// detach
tmux detach # detach currently attached session
@kaplan
kaplan / MacVim_RVM_Ruby.markdown
Last active December 15, 2015 10:39
MacVim with RVM and Ruby 1.9.3

Install MacVim with RVM and Ruby 1.9.3

Problem: I wanted to use Vim in the Terminal (or MacVim) with Command-T and my RVM Ruby version.

Command-T documentation says it should be built using the Ruby version you intend to use in Vim/MacVim (System is recommended).

I could get the Homebrew installed version of Vim setup with my Ruby 1.9.3 along with Command-T in 1.9.3, but couldn't make it work for MacVim. So, if I tried to used Command-T in MacVim I got the Caught deadly signal SEGV error.

Originally I tried to install MacVim using Homebrew, but then in MacVim :ruby puts RUBY_VERSION will show 1.8.7 even though the brew install was done with my RVM's Ruby set to 1.9.3

I decided after asking on stackoverflow and learning about how to see mvim --version and vim --version and the Linking: to try a non brew install using the [build guide for MacVim](https://github.com/b4wi

@kaplan
kaplan / MntLion_User_Migration.markdown
Last active December 15, 2015 21:39
PHP/MySQL, Virtual Hosts Mountain Lion Setup from a user migration. Clean install on a new hard drive using a Mountain Lion bootable drive for MacOS install and a Time Machine ext. hd for the User Migration

###Basic setup outline (This may be wrong but it roughly contains everything you've been doing. Check the references for more info.)

  • Enable PHP and vhosts in the httpd.conf file
  • Set the permissions on the default /Library/WebServer/Documents
  • Start Apache
  • Test with the localhost in the browser
  • Make the username.conf file and set the default directory to the /Users/username/Sites/
  • Restart Apache
  • Edit PHP config to work with MySQL
  • Fix the permissions on the existing user MySQL
@kaplan
kaplan / scary_craps.rb
Last active December 20, 2015 19:08
Scary Craps
class Die
def roll_die
rand(1..6)
end
end
class CrapsGame
attr_accessor :point, :dice_roll
def pass
@kaplan
kaplan / scary_craps_revised.rb
Created August 14, 2013 03:08
A revised, non-recursive version of the scary_craps.rb file. This needs to run in the terminal b/c there's a chomp for the rolling again after a point is set. Before I was just hitting command + b to run it in Sublime Text2.
class Die
def roll_die
rand(1..6)
end
end
class CrapsShooter
attr_accessor :point, :dice_roll, :game_over
def crap_out?
@kaplan
kaplan / middleman_dev_approaches.md
Last active May 12, 2016 11:42
Local development setup approaches for Middleman with Pow or Apache with the Mac OS.

Middleman Local Dev Approaches

Update 03-03-2015
I've moved over to a new MacBookPro running 10.10.2. I think I'm going to leave POW off this machine. I've been trying to use more Vagrant VMs in general, but the Localhost is so fast for just getting something in the browser, especially when testing things out on the front end in the browser. One thing I'm noticing about the 2nd approach is that the build with a vhost works great, but just getting the .git setup was a little tricky. I had to make the main directory, the build directory and git init in each. Then, I added the remotes from the working (development) repository for the source and the staging server repo for the build. Looks like I might install Passenger on this new machine so that I can use a vhost for the source files. Otherwise I need to use the http://0.0.0.0:4567/ or http://localhost:4567/ which isn't a bad thing vs installing Passenger?

Udpate 03-03-2015
Wow, just installed Phusion Passenger in about 15min using the g

@kaplan
kaplan / deploy.rb
Last active December 28, 2015 07:59
Trying to setup a Capistrano 3.x deployment workflow for a Rails app on a Virtual Machine (VirtualBox or VMFusion), Vagrant with Ubuntu, Nginx, Unicorn provisioned using Chef.
set :application, 'deployrails.yo'
set :repo_url, 'http://repo.workalicio.us/deployrails1103.git'
set :deploy_to, '/home/vagrant/deployrails'
set :scm, :git
set :deploy_via, :copy
set :branch, 'master'
set :format, :pretty
set :log_level, :debug
@kaplan
kaplan / gist:d563fcbbb1b4370d2659
Last active August 29, 2015 14:04
Handy Vim Reference

vim handy commands and references

commands

:e.       # list current directory  
:bd       # leave a directory listing
:put +    # paste from clipoard, this works 
"+p       # paste while in normal mode from clipboard
u         # undo in normal mode

ctrl+r # redo in normal mode

@kaplan
kaplan / setup_vagrant_lempp.md
Last active August 29, 2015 14:12
Looking at a setup for a Vagrant LEMPP stack. The idea was to setup an Ubuntu 14.04 stack that could handle PHP and Ruby.

Vagrant Nginx with PHP-FPM and Passenger

Stack Details

  • OS: Ubuntu 14.04 Trusty 64
  • HTTP Web Server: Nginx
  • Database: MySQL
  • PHP Server-side Scripting: PHP-FPM
  • Ruby Server-side Scripting: Passenger
@kaplan
kaplan / fontcustom-workflow-multicolor-icons.md
Last active May 15, 2022 23:44
Workflow for creating multicolor icon fonts with FontCustom

Custom Multicolor Icon Workflow with FontCustom

goal: taking a multicolor icon and generating fonts using the same keyboard character in order to layer and color.

  • using illustrator to create the artwork and svgs
  • set the artboard to match in Illustrator: Objects > Artboard > Fit ...
  • separate the layers, and save out black svgs, knocking out the shapes from each other
  • save each layer into a separate folder with name that matches the element, the goal is to make each layer a font

now that you have each layer in its own directory, start making the fonts with FontCustom