Skip to content

Instantly share code, notes, and snippets.

View fivetwentysix's full-sized avatar
💭
yet another programmer

Patrick Ma fivetwentysix

💭
yet another programmer
View GitHub Profile
@fivetwentysix
fivetwentysix / gist:713109
Created November 24, 2010 04:25
backup.rb
notifier_settings do
to "john@gmail.com"
from "john@gmail.com"
smtp do
host "mail.google.com.com"
port "587"
username "john"
password "password"
Installing mysql (2.8.1) with native extensions /Users/user/.rvm/rubies/ree-1.8.7-2010.02/lib/ruby/site_ruby/1.8/rubygems/installer.rb:483:in `build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)
/Users/user/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
formElement.addEvent('submit', function(e) {
e.stop();
this.send();
});
respond_to do |format|
if @reply.save
if request.xhr?
format.js
end
else
format.html { render :text => 'Fail' }
end
end
if ($('repliesContainer')) {
var containerElement = $('repliesContainer');
var highlightEffect = function() {
var newElement = containerElement.getChildren('div').getLast();
newElement.setStyle('color', '#ffa');
};
new Request.HTML({
url: '<%= instruction_instruction_item_reply_path(:id => @reply.id) %>',
append: $(containerElement),
onSuccess: highlightEffect
# GET /replies/1
def show
if request.xhr?
@reply = Reply.find(params[:id])
render :partial => 'instruction_items/reply', :locals => {:reply => @reply}
end
end
<%= link_to 'Edit', edit_instruction_instruction_item_reply_path(:id => reply.id, :instruction_id => params[:instruction_id], :instruction_item_id => params[:id]), :class => 'replyEditLink' %>
if ($('edit_reply_<%= @reply.id %>')) {
$('edit_reply_<%= @reply.id %>').addEvent('submit', function(e) {
e.stop();
this.send();
});
}
var targetDiv = $('edit_reply_<%= @reply.id %>').getParent('div');
var highlightEffect = function() {
targetDiv.setStyle('color', '#ffa');
};
new Request.HTML({
url: '<%= instruction_instruction_item_reply_path(:id => @reply.id) %>',
update: targetDiv,
onSuccess: highlightEffect
}).get();
class CreateCarouselsTable < ActiveRecord::Migration
def self.up
create_table(:carousels) do |t|
t.string :alternate_text
t.string :destination_url
t.string :image_file_name
t.string :image_content_type
t.integer :image_file_size
t.datetime :image_updated_at
end