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
connectAddForm: function() { | |
$("form.people").submit(function() { | |
$.ajax({ | |
type: 'post', | |
dataType: 'json', | |
url: '/people', | |
data: $(this).serialize(), | |
success: function(json) { | |
$('ul.people').append('<li><span class="name">' + json.person.name + '</span> <a href="/people/' + json.person.id + '/delete" class="delete">delete</a></li>'); | |
$('#person_name').val(''); |
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
$(document).ready(function(){ | |
Actions.connectAddForm(); | |
Actions.connectDeleteLinks(); | |
}); |
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
<% form_tag(person_url(@person)) do %> | |
<%= hidden_field_tag :_method, 'delete' %> | |
<p>Are you sure you want to delete <%= @person.name %>?</p> | |
<%= submit_tag 'Delete' %> | |
<%= link_to 'Cancel', people_url %> | |
<% 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
<ul class="people"> | |
<li style="display:none"></li> | |
<% @people.each do |person| -%> | |
<li><span class="name"><%= person.name %></span> <%= link_to 'delete', delete_person_path(person), :class => 'delete' %></li> | |
<% end -%> | |
</ul> | |
<% form_for :person, :url => people_url, :html => {:class => 'people'} do |f| -%> | |
<%= f.text_field :name %> <%= f.submit 'Add Person'%> | |
<% 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 PeopleController < ApplicationController | |
def index | |
@people = Person.all | |
end | |
def create | |
@person = Person.new(params[:person]) | |
@person.save! | |
respond_to do |format| | |
format.html { redirect_to people_url } |
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
# worst thing you can do to someone in ruby? | |
# fork this and add other evil | |
class Module | |
def method_added(method) | |
undef_method method if rand > 0.999999 | |
end | |
end | |
# Fun with forking |
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
aeden:~$ rvm remove macruby-head; rvm install macruby-head --trace | |
it seems that /Users/aeden/.rvm/src/macruby-head is already non existent. | |
it seems that /Users/aeden/.rvm/macruby-head is already non existent. | |
install macruby-head --trace | |
+ [[ -z install ]] | |
+ [[ ! -z '' ]] |
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
while true do | |
RefineryQueue.stats_update | |
sleep 60 | |
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
Checkout: | |
git clone url | |
Checkout throwing away local changes: | |
git checkout -f | |
Checkout a single file to get it back to HEAD: |
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 Autotest::CustomTestMatch | |
Autotest.add_hook :initialize do |at| | |
at.add_mapping(/test/) do |f, _| | |
at.files_matching(/_test\.rb$/) | |
end | |
at.add_mapping(/lib\/.*/) do |f, _| | |
at.files_matching(/_test\.rb$/) | |
end | |
at.add_exception('test/performance') | |
end |