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
# .pryrc | |
color_escape_codes = { | |
black: "\033[0;30m", | |
red: "\033[0;31m", | |
green: "\033[0;32m", | |
yellow: "\033[0;33m", | |
blue: "\033[0;34m", | |
purple: "\033[0;35m", | |
cyan: "\033[0;36m", | |
reset: "\033[0;0m" |
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
/! Modal | |
#myModal.modal.fade aria-labelledby="myModalLabel" role="dialog" tabindex="-1" | |
.modal-dialog role="document" | |
.modal-content | |
.modal-header | |
button.close aria-label="Close" data-dismiss="modal" type="button" | |
span aria-hidden="true" × | |
h4#myModalLabel.modal-title Modal title | |
.modal-body | |
| \... |
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
/! Modal | |
#myModal.modal.fade aria-labelledby="myModalLabel" role="dialog" tabindex="-1" | |
.modal-dialog role="document" | |
.modal-content | |
.modal-header | |
button.close aria-label="Close" data-dismiss="modal" type="button" | |
span aria-hidden="true" × | |
h4#myModalLabel.modal-title Modal title | |
.modal-body | |
| \... |
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
#!/bin/sh | |
# exit on any error | |
set -e | |
echo | echo "$(tput setaf 3)Setting up machine for Ruby on Rails development\n\n" | |
echo "$(tput setaf 3)Installing laptop setup..." | |
echo "$(tput setaf 7)" | |
curl --remote-name https://raw.githubusercontent.com/thoughtbot/laptop/master/mac | |
sh mac 2>&1 |
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
## color sheme: hybrid | |
# default statusbar colors | |
set-option -g status-bg colour0 #base02 | |
set-option -g status-fg colour6 # colour100 #yellow | |
set-option -g status-attr default | |
# default window title colors | |
set-window-option -g window-status-fg colour13 #base0 | |
set-window-option -g window-status-bg 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
# method 1 | |
# returns members of the Fibonacci series up to a certain value | |
def method_one(max) | |
i1, i2 = 1, 1 | |
while i1 <= max | |
yield i1 | |
i1, i2 = i2, i1+i2 | |
end | |
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
# demo.gemspec | |
Gem::Specification.new do |spec| | |
spec.name = "Demogem" | |
spec.version = "1.0.2" | |
spec.authors = ["Carl Weis"] | |
spec.email = ["[email protected]"] | |
spec.description = %q{A Ruby library for a demo app.} | |
spec.summary = %q{Demo Gem Library} | |
spec.homepage = "http://carlweis.com/gems/demo" | |
spec.license = "MIT" |
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 " be iMproved, required | |
so ~/.vim/plugins.vim " load vundle plugins | |
syntax enable | |
"-------------General Settings--------------" | |
set backspace=indent,eol,start "Make backspace behave like every other editor. | |
let mapleader = ',' "The default leader is \, but a comma is much better. |
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
module FormHelper | |
def errors_for(form, field) | |
content_tag(:p, form.object.errors[field].try(:first), class: 'help-block') | |
end | |
def form_group_for(form, field, &block) | |
has_errors = form.object.errors[field].present? | |
content_tag :div, class: "form-group #{'has-error' if has_errors}" do | |
concat form.label(field, class: 'control-label') |
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
I spent some time on this recently - and my conclusion is that you cannot use memory sqlite for acceptance tests - due to the way acceptance tests work. i.e. because you are making an 'external' request to the server from your client (i.e. you make a curl request to the server) - then you cant have a memory database. | |
I tried a few things - and it just kept causing weird errors and failing tests when it should otherwise work. | |
What I do instead, for all my tests, is create a 'stubdb.sqlite' file - and then literally make a copy of that file inbetween each test. It is ridicously fast - especially if you have an SSD drive. | |
So my config\database.php file looks like this: | |
'mysqldev' => [ | |
'driver' => 'mysql', |