Skip to content

Instantly share code, notes, and snippets.

View sdball's full-sized avatar

Stephen Ball sdball

View GitHub Profile
# add "[git]" to the prompt if in a git directory
# example (normal dir):
# user@host:/PATH
# $
# (in git directory)
# user@host:/PATH/GIT/PROJECT
# [git]$
export PROMPT_COMMAND='_GIT_LABEL= ;[ -d ".git" ] && _GIT_LABEL="[git]"'
export PS1="\u@\h:\w\n\${_GIT_LABEL}\$ "
@sdball
sdball / calculate_contentdm_scaling.php
Created September 9, 2010 15:30
A scaling function for CONTENTdm
<?php
/**
* Return CONTENTdm scaling of $width and $height to $maxwidth and $maxheight.
*
* @param string $width starting width
* @param string $height starting height
* @param string $maxwidth width limit
* @param string $maxheight height limit
* @return array dmscale, dmwidth, dmheight
@sdball
sdball / loltie.txt
Created March 4, 2015 02:23
loltie.txt
lol lol
<o>
|
|
|
>o< "I've lost R2!"
@sdball
sdball / keybase.md
Created May 12, 2014 14:35
keybase proof

Keybase proof

I hereby claim:

  • I am sdball on github.
  • I am sdball (https://keybase.io/sdball) on keybase.
  • I have a public key whose fingerprint is D718 9FCA 7760 1079 3990 C5AE 9337 38E4 021E 0115

To claim this, I am signing this object:

@sdball
sdball / self_instance_demo.rb
Created May 1, 2014 14:12
self vs instance vs local variables in initialize
class UsingSelf
attr_accessor :a, :b, :c
def initialize(a, b, c)
self.a = a
self.b = b
self.c = c
end
end
class UsingInstance