Skip to content

Instantly share code, notes, and snippets.

@just3ws
just3ws / git-manage-changeable.sh
Created March 11, 2015 21:00
Toggle whether a file is changeable or unchangeable in a repo as well as list the unchangeable files.
git-assume-unchangeable () {
git update-index --assume-unchanged "$@"
}
git-assume-changeable () {
git update-index --no-assume-unchanged "$@"
}
git-show-unchangeable () {
git ls-files -v | grep -e "^[hsmrck]"
@just3ws
just3ws / process.rb
Last active January 14, 2017 14:46
Leverage the "J" in JRuby for Powerful Concurrency
#!/usr/bin/env jruby
require_relative '../lib/schrute'
require 'csv'
require 'thread_safe'
java_import java.util.concurrent.Callable
java_import java.util.concurrent.Executors
java_import java.util.concurrent.FutureTask
@just3ws
just3ws / phantom_error.js
Created November 15, 2014 07:58
Error running Capybara Tests. UI works fine in browser but crashes when automated using PhantomJS
{"error"=>{"name"=>"Poltergeist.JavascriptError", "args"=>[[{"message"=>"TypeError: 'undefined' is not an object (evaluating 'jqXHR.responseJSON.join')", "stack"=>"TypeError: 'undefined' is not an object (evaluating 'jqXHR.responseJSON.join')
at http://127.0.0.1:51206/assets/application.js:12369
at http://127.0.0.1:51206/assets/application.js:3120
at http://127.0.0.1:51206/assets/application.js:3232
at http://127.0.0.1:51206/assets/application.js:9278 in done
at http://127.0.0.1:51206/assets/application.js:9686"}]]}}
@just3ws
just3ws / vcr.rb
Created November 5, 2014 15:02
VCR configuration that does a pretty good job of filtering out GitHub, Twitter, and LinkedIn keys.
VCR.configure do |c|
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
c.hook_into :webmock
c.ignore_localhost = true
c.default_cassette_options = { record: :new_episodes }
c.allow_http_connections_when_no_cassette = false
c.configure_rspec_metadata!
c.ignore_hosts 'codeclimate.com'
@just3ws
just3ws / heroku.log
Created August 5, 2014 19:21
ExecJS parsing error in production (can't repro in dev)
2014-08-05T19:19:50.312518+00:00 app[web.1]: URL: http://errbit.pre-history.com/locate/53e12e5589c5c39eff000392
2014-08-05T19:19:50.317455+00:00 app[web.1]:
2014-08-05T19:19:50.317459+00:00 app[web.1]: ActionView::Template::Error (Unexpected token: operator (<) (line: 23285, col: 0, pos: 793884)
2014-08-05T19:19:50.317461+00:00 app[web.1]:
2014-08-05T19:19:50.317463+00:00 app[web.1]: Error
2014-08-05T19:19:50.317466+00:00 app[web.1]: at new JS_Parse_Error (/tmp/execjs20140805-21-o7l23cjs:2357:10623)
2014-08-05T19:19:50.317468+00:00 app[web.1]: at js_error (/tmp/execjs20140805-21-o7l23cjs:2357:10842)
2014-08-05T19:19:50.317470+00:00 app[web.1]: at croak (/tmp/execjs20140805-21-o7l23cjs:2357:19067)
2014-08-05T19:19:50.317473+00:00 app[web.1]: at token_error (/tmp/execjs20140805-21-o7l23cjs:2357:19204)
2014-08-05T19:19:50.317475+00:00 app[web.1]: at unexpected (/tmp/execjs20140805-21-o7l23cjs:2357:19292)
@just3ws
just3ws / vagrant.yml
Created July 26, 2014 18:28
Coderwall Custom Developer Configuration for Vagrant
#
# This is a recommended settings if you use the `script/ide` Tmux configuration Coderwall development
#
# Custom Vagrant Settings [Example]
#
# This file allows the override of Vagrant settings.
# In order to use, create a copy named vagrant.yml
#
@just3ws
just3ws / server version
Last active August 29, 2015 14:01
UGtastic Server Configuration
erver {
listen 80;
server_name ugtastic.com;
return 301 http://www.ugtastic.com$request_uri;
}
server {
listen 80;
# listen 443 default ssl;
@just3ws
just3ws / convert_string_hash_representation_to_ruby_hash.rb
Last active December 12, 2023 01:27
Converting a string representation of a Ruby Hash back into a Ruby Hash
require 'pp'
require 'json'
s = "{:exit_url=>\"null\", :exit_target_type=>\"left\", :furthest_scrolled=>\"locations\", :time_spent=>\"543210\", :user_id=>\"123456\", :visited_at=>789101112, :user=>nil}"
pp JSON.parse("{" + s.gsub(/^{|}$/, '').split(', ').map { |pair| pair.split('=>') }.map {|k, v| [k.gsub(/^:(\w*)/, '"\1"'), v == 'nil' ? "null" : v].join(": ") }.join(", ") + "}")
=> {"exit_url"=>"null", "exit_target_type"=>"left", "furthest_scrolled"=>"locations", "time_spent"=>"543210", "user_id"=>"123456", "visited_at"=>789101112, "user"=>nil}
@just3ws
just3ws / conditionals.sh
Created March 7, 2014 04:02
Some checks for common env settings that are useful in ZSH scripts.
# checks (stolen from zshuery)
if [[ $(uname) = 'Linux' ]]; then
IS_LINUX=1
fi
if [[ $(uname) = 'Darwin' ]]; then
IS_MAC=1
fi
if [[ -x `which brew` ]]; then
@just3ws
just3ws / append-to-rc.sh
Created November 15, 2013 15:19
Append a file to and then re-source the current shell's RC file.
echo "source \$HOME/upcity/devenv/bin/host-functions.sh" >> "$HOME/.`basename "${SHELL}"`rc"
source $HOME/.`basename "${SHELL}"`rc