This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" | |
set fileencodings=utf-8,latin1 | |
endif | |
set nocompatible " Use Vim defaults (much better!) | |
set bs=2 " allow backspacing over everything in insert mode | |
"set ai " always set autoindenting on | |
"set backup " keep a backup file | |
set viminfo='20,\"50 " read/write a .viminfo file, don't store more | |
" than 50 lines of registers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:set nocompatible | |
:set autoindent | |
:set sw=2 | |
set encoding=utf8 | |
set fileencoding=utf8 | |
set filetype=on | |
au BufRead,BufNewFile *.htm, *.html, *.rhtm, *.rhtml, *.erb so /Users/dramsay/.vim/syntax/html.vim | |
au BufNewFile,BufRead *.yaml,*.yml so ~/.vim/syntax/yaml.vim | |
:syntax on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'irb/completion' | |
require 'map_by_method' | |
require 'what_methods' | |
require 'pp' | |
IRB.conf[:AUTO_INDENT]=true | |
#require 'wirble' | |
# start wirble (with color) | |
#Wirble.init |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# user and group to run as | |
user abcde abcde; | |
# number of nginx workers | |
worker_processes 4; | |
# pid of nginx master process | |
pid /var/run/nginx.pid; | |
# Number of worker connections. 1024 is a good default |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def truncate_words(text, length=30, end_string="...") | |
pattern = %r(^(.{#{length}}[\w.]*)(.*)) | |
text.gsub(pattern) {$2.empty? ? $1 : $1 + end_string} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'openssl' | |
module Encryption | |
def encrypt(data, password, salt) | |
cipher = OpenSSL::Cipher::Cipher.new('aes-256-cbc') | |
cipher.encrypt | |
cipher.pkcs5_keyivgen(password, salt) | |
encrypted_data = cipher.update(data) | |
encrypted_data << cipher.final | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def truncate_comment(text, length=30, end_string="...") | |
pattern = %r(^(.{#{length}})(.*)) | |
text.gsub(pattern) {$2.empty? ? $1 : $1 + '...'} | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script type="text/javascript" src="jquery.js"></script> | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
$('.clickable').click(function() { | |
alert('Clicked ' + this.id); | |
$('#reply_to').val(this.id); | |
alert('reply_to value: ' + $('#reply_to').val()); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* CREDIT: http://on-ruby.blogspot.com/2009/03/author-interview-venkat-subramaniam.html */ | |
/* define method that takes an upperLimit Int and a function literal that accepts | |
* a single Int parameter and returns a Boolean */ | |
def totalSelectValuesInRange(upperLimit: Int, isOKToUse: Int => Boolean) = { | |
/* Create a range by calling to on 1 (in RichInt wrapper for Int) */ | |
val range = 1 to upperLimit | |
/* Fold left on range, starting with 0 - kind of like Ruby's 'inject' */ | |
(0 /: range) { (sum, number) => | |
sum + (if (isOKToUse(number)) number else 0) } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% for data in @other_search %> | |
<% at = 0 %> | |
<% for obj in data %> | |
<% if at == 0 %> | |
<% new_obj = obj.school.name %> | |
<% at = at + 1 %> | |
<% else %> | |
<% new_obj = obj %> | |
<% at = at + 1 %> | |
<% end %> |
OlderNewer