Skip to content

Instantly share code, notes, and snippets.

@graywh
graywh / gist:58937
Created February 5, 2009 19:20
bad output from Hmisc::latex
% latex.default(object = object[[i]], caption = nx[i], label = nx[i], append = file != "", title = title, file = file, caption.lot = NULL, caption.loc = caption.loc, ...)
%
\begin{table}[!tbp]
\caption{prob.t\label{prob.t}}
\begin{center}
\begin{tabular}{lr}\hline\hline
\multicolumn{1}{l}{summary}&
\multicolumn{1}{c}{}
\tabularnewline \hline
< 0.005&$ 1.00000000000000000$\tabularnewline
@graywh
graywh / filetype.vim
Created April 15, 2009 14:37
detect .r files as R filetype in vim
if exists("did_load_filetypes")
finish
endif
augroup filetypedetect
" R
autocmd! BufNewFile,BufRead *.[rRsS] setfiletype r
autocmd! BufNewFile,BufRead *.[rR]history setfiletype r
@graywh
graywh / detect_libvte_terminal.sh
Created May 13, 2009 15:48
gnome-terminal detection to fix $TERM
# Set $TERM for libvte terminals that set $TERM wrong (like gnome-terminal)
{
[ "_$TERM" = "_xterm" ] && type ldd && type grep && type tput && [ -L "/proc/$PPID/exe" ] && {
if ldd /proc/$PPID/exe | grep libvte; then
if [ "`tput -Tgnome-256color colors`" = "256" ]; then
TERM=gnome-256color
elif [ "`tput -Txterm-256color colors`" = "256" ]; then
TERM=xterm-256color
elif tput -T gnome; then
TERM=gnome
function RemoveTrailingSpace()
if expand('%') =~? '\.patch$'
return
endif
try
%s/\s\+$//
norm! ``
catch /E486/
endtry
endfunction
% gvim
Xlib: extension "RANDR" missing on display ":0.0".
(gvim:19111): atk-bridge-WARNING **: AT_SPI_REGISTRY was not started at session startup.
(gvim:19111): atk-bridge-WARNING **: IOR not set.
(gvim:19111): atk-bridge-WARNING **: Could not locate registry
@graywh
graywh / common.scss
Created June 25, 2010 15:27
some basic styles i use in every rails project
div.p {
/* div's as p's
*
* this is a work-around for how rails
* displays error messages on a form
*/
margin-bottom: 1em;
}
.small {
@graywh
graywh / mario_bloop.rb
Created August 18, 2010 21:11
some bloopsaphone tunes
require 'rubygems'
require 'bloops'
b = Bloops.new
b.tempo = 100
sound = b.sound Bloops::SQUARE
sound.volume = 0.5
sound.sustain = 0.3
sound.attack = 0.1
sound.decay = 0.3
@graywh
graywh / 99bindings.patch
Created November 16, 2010 18:10
fix irssi's key bindings
Remove hack for binding ^ that prevents binding ctrl-^
--- irssi-0.8.15.orig/src/fe-text/gui-readline.c
+++ irssi-0.8.15/src/fe-text/gui-readline.c
@@ -392,12 +392,6 @@
str[g_unichar_to_utf8(key, str)] = '\0';
}
- if (strcmp(str, "^") == 0) {
- /* change it as ^^ */
- str[1] = '^';
@graywh
graywh / divisions.csv
Created December 20, 2010 16:43
Fantasy Football League Stats
Team 1 Team 2 Team 3 Team 4 Team 5 Team 6 Team 7 Team 8 Team 9 Team 10 Team 11 Team 12 Team 13 Team 14 Team 15 Team 16
2 2 2 1 1 1 2 2 1 1 2 2 2 1 1 1
class Calendar < ActiveRecord::Base
has_many :reservations
end
class Reservation < ActiveRecord::Base
belongs_to :calendar
def self.search(search_fields)
results = self #this is where I'd like to access the collection search was called on