- Email: [email protected]
- Twitter: @iHiD
- Website or Blog: http://www.ihid.co.uk
- Company: Various :)
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
<h2>My First Blog Post</h2> | |
<div id="content"> | |
<script> | |
setInterval(function() { | |
alert("I'm annoying!!!") | |
}, 50) | |
</script> | |
</div> |
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
<h2>My First Blog Post</h2> | |
<div id="content"> | |
<script> | |
setInterval(function() { | |
alert("I'm annoying!!!") | |
}, 50) | |
</script> | |
</div> |
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
<h2><%= @blog_post.title %></h2> | |
<div id="content"><%= @blog_post.content %></div> |
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
<script> | |
setInterval(function() { | |
alert("I'm annoying!!!") | |
}, 50) | |
</script> |
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
def self.create_from_gemfile_url ( url ) | |
return nil if url.nil? | |
if url.match(/^https:\/\/github.com\//) | |
url = url.gsub("https://github.com", "https://raw.github.com") | |
url = url.gsub("/blob/", "/") | |
end | |
uri = URI.parse( url ) | |
http = Net::HTTP.new(uri.host, uri.port) | |
if uri.port == 443 | |
http.use_ssl = true |
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 ProjectsController < ApplicationController | |
def index | |
@project = current_user.projects.where('name LIKE ?', "#{params[:name]}%") | |
#... | |
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
# Use a hash | |
Project.where(:user_id => current_user.id) | |
# Use placeholders | |
Project.where("user_id = ?", current_user.id) | |
# Use bind variables | |
Project.where("user_id = :user_id", {:user_id => current_user.id}) |
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
@projects = Project.where(:user_id => current_user.id). | |
where('name LIKE ?', "#{params[:name]}%") |
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
SELECT * FROM "projects" | |
WHERE user_id = 1 | |
AND name LIKE '' OR created_at LIKE '%' |