This file contains hidden or 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
| # config/routes.rb | |
| resource :ghost, only: [:create, :destroy] | |
| # app/controllers/ghosts_controller.rb | |
| class GhostsController < ApplicationController | |
| def create | |
| session[:admin_id] = current_user.id | |
| user = User.find(params[:user_id]) | |
| sign_in user |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 = ["carl@carlweis.com"] | |
| 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 hidden or 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 hidden or 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') |