Skip to content

Instantly share code, notes, and snippets.

@justinleveck
justinleveck / .tmux.conf
Last active August 26, 2020 21:02
tmux conf for remote shell
## Use reattach-to-user-namespace as the wrapper script to handle Mac OS X
## support for pbcopy and pbpaste.
#set -g default-shell /usr/bin/zsh
set -g default-command "${SHELL}"
## Tell tmux to copy these environment variables over from the original shell
## that tmux was launched in. These are important for ssh-agent on mac os x to
## work properly when inside your tmux sessions. Otherwise, it will make you
## type in your key password when trying to ssh to different machines.
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION"
.center {
position: absolute;
width: 50px;
height: 25px;
top: calc(50% - 25px); /* 50% - height */
left: calc(50% - 50px); /* 50% - width */
}

Twitter API

GET

Show Tweet

# Capybara Screenshots - Full Page
options = {}
# options[:width] = current_window.size[0]
# options[:height] = current_window.size[1]
path = "tmp/screenshot.png"
page.driver.resize_window(2548, 1238)
options[:width] = 2548
options[:height] = 1238
Tabbed by: Jason Watson
Date: 4/24/2009
Updated: 7/29/2010
Bridge added. Check out the tutorial video:
http://il.youtube.com/watch?v=b73onkQt9ds&feature=related
Performance video:
http://www.youtube.com/watch?v=UJDguHJ34SE
@justinleveck
justinleveck / .gitconfig
Last active January 21, 2016 23:51
git checkout alias (with fuzzy match)
[alias]
co = "!f() { \
git checkout $(git branch | grep $1 | sed -e 's/^* //'); \
}; f"
Money.new(payment_transactions.succeeded.joins(:offer_purchase).sum("#{OfferPurchase.table_name}.price_in_cents"))
@justinleveck
justinleveck / 0_reuse_code.js
Created September 30, 2015 17:34
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
picc.format = (function() {
var formatter = function(fmt, _empty) {
var round = false;
if (typeof fmt === 'string') {
round = !!fmt.match(/d$/);
fmt = d3.format(fmt);
}
return function(key, empty) {
empty = empty || _empty;
if (typeof empty === 'string') {
@justinleveck
justinleveck / set_config_values.rb
Last active August 29, 2015 14:24
Script to set CS-Cart config.local.php values using environment variable values
#!/usr/bin/env ruby
file_names = ['path/to/config.local.php']
config_values = [
'CS_CART_DB_HOST',
'CS_CART_DB_NAME',
'CS_CART_DB_USER',
'CS_CART_DB_PASSWORD',
'CS_CART_HTTP_HOST',