Skip to content

Instantly share code, notes, and snippets.

View vcavallo's full-sized avatar

Vinney Cavallo ~sogrum-savluc vcavallo

View GitHub Profile
@christo16
christo16 / Rails State Select
Created December 3, 2010 00:08
Create a select list for US states in Rails
<%= select(:address, :state, [
['Select a State', 'None'],
['Alabama', 'AL'],
['Alaska', 'AK'],
['Arizona', 'AZ'],
['Arkansas', 'AR'],
['California', 'CA'],
['Colorado', 'CO'],
['Connecticut', 'CT'],
['Delaware', 'DE'],
@anderssvendal
anderssvendal / README.md
Created October 29, 2012 10:20
ubuntu + unicorn + sinatra
@p1nox
p1nox / postgresql_configuration_on_ubuntu_for_rails.md
Last active November 29, 2023 04:38
PostgreSQL configuration without password on Ubuntu for Rails

Abstract

You could have postgre installed on localhost with password (or without user or password seted after instalation) but if we are developing we really don't need password, so configuring postgre server without password for all your rails project is usefull.

Install Postgre packages

  • postgresql
  • postgresql-client
  • libpq-dev
@todgru
todgru / starttmux.sh
Last active March 3, 2024 15:40
Start up tmux with custom windows, panes and applications running
#!/bin/sh
#
# Setup a work space called `work` with two windows
# first window has 3 panes.
# The first pane set at 65%, split horizontally, set to api root and running vim
# pane 2 is split at 25% and running redis-server
# pane 3 is set to api root and bash prompt.
# note: `api` aliased to `cd ~/path/to/work`
#
session="work"
-- SQL Basic Syntax --
--initialize SQLite database w/ command line:
sqlite3 database_name.db
--helpful commands
.help -- list of commands
.tables -- see all tables
.mode column / .header on -- helpful for viewing
@Integralist
Integralist / Vim shortcuts for rspec and cucumber tests.vim
Last active May 28, 2018 15:15
Shortcut Vim mappings for running RSpec and Cucumber tests
" Running Tests...
" See also <https://gist.github.com/8114940>
" Run currently open RSpec test file
map <Leader>rf :w<cr>:!rspec % --format nested<cr>
" Run current RSpec test
" RSpec is clever enough to work out test to run if cursor is on any line within the test
map <Leader>rl :w<cr>:exe "!rspec %" . ":" . line(".")<cr>
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active February 12, 2024 17:18
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew

OBSOLETE

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

@zdk
zdk / version.rake
Last active April 14, 2017 15:01
Rake task for Git based Rails app semantic versioning.
#gem 'colorize'
module Version
VERSION_FILE = "#{Rails.root}/config/initializers/version.rb"
PATTERN = /(\d+)\.(\d+)\.(\d+)-(.*)/
PATTERN_NOMETA = /(\d+\.\d+\.\d+)/
@@major = 0; @@minor = 0; @@patch = 0; @@build = 'a'
@@version_rb = File.read(VERSION_FILE)
def self.version_rb
@szydan
szydan / gist:b225749445b3602083ed
Last active February 5, 2024 15:16
<U+FEFF> character showing up in files. How to remove them?
1) In your terminal, open the file using vim:
vim file_name
2) Remove all BOM characters:
:set nobomb
3) Save the file:
:wq
@rvill
rvill / UDID
Created January 16, 2015 04:05
get iOS device UDID without xcode or itunes, using linux cmd line
lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2