Skip to content

Instantly share code, notes, and snippets.

@naoty
naoty / specs.watchr
Created August 30, 2011 16:15
test to run growl from watchr
# adapted from http://github.com/rspec/rspec-rails/blob/master/specs.watchr
# Run me with:
#
# $ watchr specs.watchr
# --------------------------------------------------
# Convenience Methods
# --------------------------------------------------
def growl(message)
@naoty
naoty / Gemfile
Created September 14, 2011 12:43
note Gemfile often used
source 'http://rubygems.org'
gem 'rails', '~> 3.1.0'
gem 'rake', '0.8.7'
gem 'mongoid'
gem 'bson_ext'
gem 'devise'
gem 'omniauth'
gem 'haml-rails'
gem 'jquery-rails'
@naoty
naoty / .vimrc
Created September 17, 2011 16:56
.vimrc
set nocompatible
" Display
" --------------------
set laststatus=2
set number
set nowrap
set showcmd
set showmatch
syntax on
@naoty
naoty / seeds.rb
Created October 6, 2011 10:52
seeds file which inserts csv data in a specific directory into mongodb
require 'csv'
require 'mongo'
path = "#{Rails.root}/db/seeds/"
db = Mongo::Connection.new.db('database_name')
Dir.open(path).each do |f|
if f.match(/(.*)\.csv$/)
col = db.collection($1)
col.remove
set nocompatible
" Display
" --------------------
set laststatus=2
set number
set nowrap
set ruler
set showcmd
set showmatch
[mysqld]
max_connections = 300 # default
character_set_server = utf8
query_cache_size = 64M
query_cache_type = 1
table_open_cache = 600 # 300 connections * 2 tables
table_definition_cache = 200
key_buffer_size = 500M
myisam_max_sort_file_size = 100G
myisam_recover = DEFAULT,BACKUP
[client]
user = root
password
host = 127.0.0.1
port = 3306
[mysql]
prompt = '\\u@\\h\\_(\\R:\\m:\\s)\\_[\\d]>\\_'
default-character-set = utf8
show-warnings
source 'http://rubygems.org'
gem 'rails'
gem 'unicorn'
gem 'capistrano'
gem 'mysql2'
gem 'devise'
gem 'omniauth', '~> 0.3.2'
gem 'haml-rails'
gem 'jquery-rails'
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
url = "http://ftp.vim.org/pub/vim/runtime/indent/"
html = `curl #{url}`
hrefs = html.scan(/href="(.*vim)"/).flatten
hrefs.each {|href| `wget #{url}#{href}` }