Skip to content

Instantly share code, notes, and snippets.

View seabre's full-sized avatar

Sean Brewer seabre

  • CrowdFiber
  • Chattanooga, TN
View GitHub Profile
@seabre
seabre / .tmux.conf
Created February 25, 2013 23:06
My tmux config.
# Default shell should be zsh
set-option -g default-shell /bin/zsh
set -g default-terminal "xterm"
#C-b is not acceptable -- Vim uses it
set-option -g prefix C-a
bind-key C-a last-window
# Start numbering at 1
set -g base-index 1
@seabre
seabre / sightsee.rb
Created February 12, 2013 20:22
Automated, multibrowser 'click through' test to be used with sauce labs.
require 'rubygems'
require 'selenium-webdriver'
project = "Some Project"
browsers = {
"Firefox 18 (Windows)" => {:browser => Selenium::WebDriver::Remote::Capabilities.firefox, :platform => 'Windows 2008', :version => '18'},
"Firefox 6 (Windows)" => {:browser => Selenium::WebDriver::Remote::Capabilities.firefox, :platform => 'Windows 2003', :version => '6'},
"Safari 6 (OS X)" => {:browser => Selenium::WebDriver::Remote::Capabilities.safari, :platform => 'Mac 10.8', :version => '6'},
"Safari 5 (OS X)" => {:browser => Selenium::WebDriver::Remote::Capabilities.safari, :platform => 'Mac 10.6', :version => '5'},
@seabre
seabre / innerheight.js
Created February 11, 2013 07:50
Crossbrowser innerHeight
(function(){
if(window.innerWidth!= undefined){
return [window.innerWidth, window.innerHeight];
}
else{
var B= document.body,
D= document.documentElement;
return [Math.max(D.clientWidth, B.clientWidth),
Math.max(D.clientHeight, B.clientHeight)];
}
(auto_scroll = (start, height) ->
setTimeout (->
increment = height / 4
next_increment = start + increment
window.scrollTo start, next_increment
if next_increment < height auto_scroll(next_increment, height) else return true
), 8000
)(0, document.body.scrollHeight)
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) *2^(8-i));if(k)printf("%0o ",k);print}'
@seabre
seabre / emailaddrgtandeq.py
Last active December 11, 2015 02:39
Get e-mail address in between < and >
value.strip().match(/<(.*?)>/)[0]

Pairing With tmux

Host

$ tmux -S /tmp/pair
$ chmod 777 /tmp/pair

Client

@seabre
seabre / Gemfile
Created December 18, 2012 04:03
Simple example to find possible tag/topic of a text.
source "http://rubygems.org"
gem 'uea-stemmer'
gem 'stopwords'
@seabre
seabre / pagespeed.js
Created October 11, 2012 18:44
Pagespeed crawler for PhantomJS
var address, sitemap, system;
sitemap = require('webpage').create();
system = require('system');
if (system.args.length === 1) {
console.log('Usage: pagespeed.js <some DOMAIN>');
phantom.exit(1);
} else {
@seabre
seabre / import_csv_rails_activerecord.rb
Created June 1, 2012 20:59
Import CSV Into Rails Application via ActiveRecord
# If you are using a gem like paper_trail that records
# user edit history, you should "login" first.
# See this gist for more details if you are
# using Devise:
# https://gist.github.com/2855072
require 'csv'
csv_text = File.read('my_csv_file_to_import.csv')