Skip to content

Instantly share code, notes, and snippets.

View twilson63's full-sized avatar

Tom Wilson twilson63

View GitHub Profile
## Haml View
- fields_for "tests[]", t do |lt|
= lt.text_field :name, { :class => "ac"}
## JQuery JS
$(document).ready( function(){
$('input.ac').autocomplete("/javascripts/search.js");
});
def hello
puts "World"
end
def test
puts "Hello World"
end
<div>
<%= "Hello World" %>
</div>
%div= "Hello World"
### Checking in your Changes to Git
git add .
git commit -a -m "Your Message Here"
### Make sure to pull down the latest changes
git pull origin master
### Manage any conflicts that may have occurred.
### Verify your code functions properly run a db:migrate if data changes were involved
@people = People.find(:all) do
any do
if !criteria.numeric?
all do
first_name =~ criteria.split(' ')[0] + '%'
last_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
end
all do
last_name =~ criteria.split(' ')[0] + '%'
first_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
@people = People.find(:all) do
any do
if !criteria.numeric?
all do
first_name =~ criteria.split(' ')[0] + '%'
last_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
end
all do
last_name =~ criteria.split(' ')[0] + '%'
first_name =~ criteria.split(' ')[1] + '%' if criteria.split(' ').length > 1
/* Example: */
$.each([objects], function() {
$('tbody').append("<tr><td>" + this.id + "</td><td>" + this.name + "</td></tr>");
});
/*
Simple, example, but you can imagine 10 columns or formated "ul"'s could get really ugly and a lot of string manipulation. Also the fact you could easily miss a lt or gt, and not know.
So we came up with jTag to make it more readable, and to have javascript handle the lt and gt for us.
document.write(
jTag(function() {
h1("Welcome to jTag");
h2("jTag is the new black");
p("It is a new tag library that makes it super easy to create html in js");
ul(function(){
li("Option 1");
li("Option 2");
});
})