Skip to content

Instantly share code, notes, and snippets.

Christopher Sexton csexton

Block or report user

Report or block csexton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
csexton / 0_reuse_code.js
Last active Aug 29, 2015
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View foo.rb
class Foo
def a_string
View gist:4992036
#!/usr/bin/env ruby
require 'pty'
interface = 'en0'
cmd = %W[tshark -i #{interface} -R http -T fields -e -e http.user_agent]
cmd = "yes"
PTY.spawn( cmd ) do |r, w, pid|
View Compiling
Compile with `gcc -Wall -lssl -lcrypto shait.c`
View Compiling
Compile with `gcc -Wall -lssl -lcrypto shait.c`
#!/usr/bin/env bash
apt-get -y update
apt-get -y upgrade
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
tar -xvzf ruby-1.9.3-p194.tar.gz
cd ruby-1.9.3-p194/
./configure --prefix=/usr/local
csexton / kapow.zsh
Created Jun 10, 2011
Zsh function to restart an app running under pow
View kapow.zsh
# Restart a rack app running under pow
# Adds a kapow command that will restart an app
# $ kapow myapp
# Supports command completion.
# If you are not already using completion you might need to enable it with
View gist:515754
class Person
attr_accessor :name, :weight
#want to set a default for @weight in here
#Tried @weight ||= 45 and
# @weight = 45 and
# self.weight = 45
def initialize
@weight = 45
View gist:381243
def update
@server = Server.find(params[:id])
respond_to do |format|
if @server.update_attributes(params[:server])
flash[:notice] = 'Server was successfully updated.'
format.html { redirect_to(@server) }
format.xml { head :ok }
- (void)installButtonBeforeItem:(NSString *)beforeItem toToolbar:(NSString *)toolbarIdentifier
NSToolbar *toolbar = nil;
for (NSWindow *window in [NSApp orderedWindows]) {
if (NO == [[[window toolbar] identifier] isEqualToString:toolbarIdentifier]) continue;
toolbar = [window toolbar];
if ([toolbar respondsToSelector:@selector(onepasswordSetDelegate:)]) {
[toolbar setDelegate:[toolbar delegate]]; // this will call a swizzled method
You can’t perform that action at this time.