Skip to content

Instantly share code, notes, and snippets.

@sattybhens
sattybhens / java.osx
Created December 8, 2014 01:55
Switching versions of Java on OSX
http://stackoverflow.com/questions/21964709/how-to-change-default-java-version
First run
/usr/libexec/java_home -V
Pick the version you want to be the default (1.6.0_65-b14-462 for arguments sake) then:
export JAVA_HOME=`/usr/libexec/java_home -v 1.6.0_65-b14-462`
@sattybhens
sattybhens / index.html
Created March 16, 2012 19:28
urls to get javascript library's
<!DOCTYPE html>
<html>
<head>
<title>simple</title>
<link rel="stylesheet" href="css/jquery.mobile-1.0.1.css" />
<script src="js/libs/jquery-1.7.1.js"></script>
<script src="js/libs/jquery.mobile-1.0.1.js"></script>
</head>
@sattybhens
sattybhens / excel_formulas.rb
Created December 28, 2011 05:35
discover unique excel formula's using JRuby and POI
# Given an Excel file... iterate over each cell that has a formula
# and collect all the unique formula signatures
# formula signature are in RPN and shown as
# => Ref#UnaryMinus#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply
# => Ref#Ref#Multiply#Ref#Ref#Multiply#Subtract#Parenthesis#Ref#Multiply#Int#Int#Power#Divide#Ref#Subtract
# => Ref#Ref#Multiply#Ref#Ref#Multiply#Subtract#Parenthesis#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply#Ref#Subtract
# => Ref#Ref#Multiply#Int#Int#Power#Divide
# => Ref#Area#Attr#Ref#Multiply#Ref#Multiply#Parenthesis#Divide
# => Ref#Area#Attr#Ref#Multiply#Int#Int#Power#Divide#Ref#Multiply#Parenthesis#Divide
# => Ref#Area#Attr#Ref#Multiply#Int#Int#Power#Divide#Parenthesis#Divide
@sattybhens
sattybhens / cumulative.coffee
Created July 12, 2011 20:10
sum consecutive numbers in an array
value = 0
result = [100, -20, -20, 50, 70].map((e, i) ->
value += e
).shift()
console.log result
@sattybhens
sattybhens / regex_cell_names
Created June 6, 2011 20:44
regex for excel names
(\$?[A-Z]{1,}\$?[0-9]{1,}):?
@sattybhens
sattybhens / excel_names.rb
Created June 6, 2011 19:00
Excel Cell Names
class CellRange
LETTERS = ('A'..'ZZ').to_a
attr_reader :max_col, :min_col, :max_row, :min_row
def initialize(cells)
@cells = cells
@sattybhens
sattybhens / configure libiconv on OSX
Created April 18, 2011 16:58
command line options for libiconv
./configure CC="gcc -arch i386 -arch x86_64" CXX="g++ -arch i386 -arch x86_64" CPP="gcc -E" CXXCPP="g++ -E" --prefix=/usr/local
@sattybhens
sattybhens / dates.r
Created April 17, 2011 02:43
manipulating dates in R
# HELPER FUNCTIONS
as.week_of_month <- function(d) {
  day <-format(d,"%d")
  val <- ((as(day,"numeric")-1)/7)+1
  val <- as(val,"integer")
  val <- as(val,"character")
}
# then to convert to a date use
@sattybhens
sattybhens / vim config
Created March 31, 2011 19:18
my vim config file :)
" To start vim without using this .vimrc file, use:
" vim -u NORC
"
" To start vim without loading any .vimrc or plugins, use:
" vim -u NONE
"
" Use vim settings, rather then vi settings (much better!)
" This must be first, because it changes other options as a side effect.
set nocompatible
@sattybhens
sattybhens / original.pde
Created February 21, 2011 22:44
red-recket png using processing
void setup() {
size(16,16);
noLoop();
noStroke();
colorMode(HSB,360,100,100);
}
void draw() {