Skip to content

Instantly share code, notes, and snippets.

View lando2319's full-sized avatar

Mike Land lando2319

View GitHub Profile
# THIS IS MY RESUME
name = "Mike Land"
email = "[email protected]"
website = "http://MikePLand.com"
blog = "http://MikePLand.com/blog"
# Skills Include
ror = "Ruby on Rails"
wp = "Wordpress"
@lando2319
lando2319 / collection_select_breakdown.rb
Last active December 17, 2015 16:19
Breakdown of collection_select rails
<%= f.collection_select(:client, Client.all, :name, :name) %>
collection_select(
[what field is it populating?],
[Where is it getting the data],
[What specifically is being written],
[What information is going to be displayed on the screem])
" surround.vim - Surroundings
" Author: Tim Pope <http://tpo.pe/>
" Version: 2.0
" GetLatestVimScripts: 1697 1 :AutoInstall: surround.vim
if exists("g:loaded_surround") || &cp || v:version < 700
finish
endif
let g:loaded_surround = 1
@lando2319
lando2319 / ActiveRecord::StatementInvalid in MessagesController#new
Created June 2, 2013 15:04
Solution: $ rake db:migrate This is what happens in pg when you don't run rake db:migrate
ActiveRecord::StatementInvalid in MessagesController#new
PG::Error: ERROR: relation "messages" does not exist
LINE 5: WHERE a.attrelid = '"messages"'::regclass
^
: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"messages"'::regclass
## Blackjack in Ruby
puts "============================="
puts "Welcome to Terminal Blackjack"
stack_of_cards = [
"2 D", "3 D", "4 D", "5 D", "6 D", "7 D", "8 D", "9 D", "10 D", "J D", "Q D", "K D", "A D",
"2 H", "3 H", "4 H", "5 H", "6 H", "7 H", "8 H", "9 H", "10 H", "J H", "Q H", "K H", "A H",
"2 C", "3 C", "4 C", "5 C", "6 C", "7 C", "8 C", "9 C", "10 C", "J C", "Q C", "K C", "A C",
"2 S", "3 S", "4 S", "5 S", "6 S", "7 S", "8 S", "9 S", "10 S", "J S", "Q S", "K S", "A S"
]
@lando2319
lando2319 / form_tag_example.rb
Last active December 18, 2015 19:19
specifying controller, params, method.
<%= form_tag position_game_stats_path do %>
<%= label_tag "recipient_email[:share_cards]" %>
<%= number_field_tag "position_game_stat[at_bats]" %>
<%= submit_tag("submit") %>
<% end %>
<p style="display:none">
Hello World
</p>
<button>
Click This
</button>
<script type="text/javascript">
<p style="display:none">
Hello World
</p>
<form id="approve_bg">
<input type="checkbox" id="approve_bg_check">
Click This
</form>
= form_tag(engagement_path, :controller => "engagements", :action => "update", :method => 'put') do
= hidden_field_tag "engagement[application_status]", "Accepted"
= submit_tag
.strftime("%I:%M %p")