Skip to content

Instantly share code, notes, and snippets.

View chrishunt's full-sized avatar
🏕️
Adventuring

Chris Hunt chrishunt

🏕️
Adventuring
View GitHub Profile
@chrishunt
chrishunt / vim-tmux-copy-paste.md
Last active May 27, 2023 21:25
vim/tmux copy paste in mac os x

Shared Clipboard: vim,tmux,macos

One clipboard to rule them all. Requires tmux >= 1.8. Thanks @thoughtbot

Tell vim to use the system clipboard:

" ~/.vimrc
set clipboard=unnamed " use the system clipboard
@chrishunt
chrishunt / podcasts.md
Last active March 20, 2023 14:22
Podcast List
@chrishunt
chrishunt / instagram_download.md
Created December 8, 2012 17:00
Download Instagram Photos

Download High Resolution Instagram Photos

  1. Go to http://statigr.am/yourlogin
  2. Scroll down as many times as it is needed to have all yor pictures thumbnails displayed
  3. In the JS Console, grab all images
```javascript
$(".lienPhotoGrid a img").each(function(index) { console.log($(this).attr('src')) })
```
  1. Copy all image urls to a file
@chrishunt
chrishunt / config.ru
Created December 27, 2013 15:37
Debug HTTP Server
run -> (_) { [ 200, { 'Content-Type' => 'text/html', }, ['success'] ] }
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/sh
#.git/hooks/pre-commit
exec 1>&2
TODOS=$(git todo)
if [ ! -z "$TODOS" ]; then
echo 'Aborting commit due to stuff TODO'
echo $TODOS
@chrishunt
chrishunt / locations_for.rb
Created July 9, 2013 19:10
Get location of rake task definition
def locations_for(task)
Rake::TaskManager.record_task_metadata=true
Rake.application.load 'Rakefile'
Rake.application.tasks.each.find { |t| t.name == task }.locations
end
locations_for('test')
# ["../vendor/gems/ruby/1.9.1/gems/railties-4.0.0/lib/rails/test_unit/testing.rake:50:in `<top (required)>'"]
@chrishunt
chrishunt / test_after_commit.rb
Created July 9, 2013 16:51
Test after_commit hooks in Rails 4
require 'active_record/connection_adapters/abstract/transaction'
module ActiveRecord
module ConnectionAdapters
class SavepointTransaction < OpenTransaction
def perform_commit_with_transactional_fixtures
commit_records if number == 1
perform_commit_without_transactional_fixtures
end
@chrishunt
chrishunt / wrake.md
Last active December 18, 2015 04:19
Wrap your amazing Rakefile in a gem
$ bundle gem wrake
$ cd wrake
$ vi wrake.gemspec
  - Fill in TODOs on description and summary
  - Add 'rake' runtime depedency at the bottom
    - spec.add_runtime_dependency "rake"

$ vi lib/wrake/Rakefile
@chrishunt
chrishunt / aREADME.md
Last active December 18, 2015 01:08
What's was your first pull request?

What's was your first pull request?

$ gem install ruby-progressbar octokit
$ ruby first_pull_request.rb <github-username> <github-password>