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
create table johns_problem as | |
select distinct trim(name) as name | |
from drugs | |
where customer_id IS NOT NULL | |
order by name; | |
select distinct name from drugs | |
-- delete table johns_problem |
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
ActionView::Template::Error (Can't mass-assign protected attributes: locale): | |
1: <div id='recent_activity'> | |
2: <h2><%= t('.latest_activity') %></h2> | |
3: <% if (activity = @recent_activity.collect { |a| | |
4: activity_message_for(a) | |
5: }.reject(&:blank?)).present? %> | |
6: <ul class='clickable'> | |
7: <% activity.each do |message| %> | |
activemodel (3.2.8) lib/active_model/mass_assignment_security/sanitizer.rb:48:in `process_removed_attributes' | |
activemodel (3.2.8) lib/active_model/mass_assignment_security/sanitizer.rb:20:in `debug_protected_attribute_removal' |
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
unless MyModel::Translation.column_names.map(&:to_sym).include?(:new_attrib) | |
add_column MyModel::Translation.table_name, :new_attrib, :string | |
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
class ContactsController < ApplicationController | |
def create | |
@contact = Contact.new(params[:contact]) | |
if @contact.valid? | |
ContactMailManager.delay.send_contact_mail(@contact) | |
redirect_to contact_path(1), :notice => t("contact.sent") | |
else | |
... | |
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
require 'uri' | |
if ENV.has_key? "BUCKET_URL" | |
uri = URI.parse(ENV["BUCKET_URL"]) | |
ENV["S3_ACCESS_KEY"] = uri.user | |
ENV["S3_ACCESS_SECRET"] = uri.password | |
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
## Rails Upgrade check | |
# | |
# Check your github repos for out of date rails apps | |
# | |
# usage: $ ENV=yourusername PASSWORD=yourpassword ruby railscheck.rb | |
# or | |
# usage: $ ENV=yourusername PASSWORD=yourpassword ORG=yourorgname ruby railscheck.rb | |
# | |
# n.b requires the octokit gem |
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
Writing is hard, so do it. | |
========================== | |
Over the last few months I've been working on something that I wouldn't have seen myself doing at any point in my life, and that's the task of writing a book. I'm not talking about a 'Janet & John' novel, or some sort of 'Fifty Shades of Grey' sort of affair, but a proper printed dead tree, trip over it, technical book. | |
It all started back in May/June time when I was approached by a good friend at [Heroku](http://www.heroku.com), who had been approached in turn by [O'Reilly](http://www.oreilly.com), to produce a book about the platform and some rough ideas for what sort of book might be relevant and saleable. At the end of a fairly lengthy process it ended up that I was the author, had a contract in my hand and a schedule to try and stick to. | |
Cripes | |
## Getting started |
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
class Array | |
def foo | |
puts self | |
end | |
end | |
class Bar < ActiveRecord::Base | |
...blah | |
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
LOG: could not bind IPv4 socket: Can't assign requested address | |
HINT: Is another postmaster already running on port 5432? If not, wait a few seconds and retry. | |
WARNING: could not create listen socket for "localhost" | |
FATAL: could not create any TCP/IP sockets |
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
$ ~/ nslookup | |
> server 8.8.8.8 | |
Default server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
> o localhost | |
Server: 8.8.8.8 | |
Address: 8.8.8.8#53 | |
Non-authoritative answer: | |
Name: o.dev.kyanmedia.net |