This file contains 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
- if RAILS_ENV == 'development' | |
#debug | |
= link_to_function('Params Trace', "$('debug_params').toggle()") | |
#debug_params | |
%table | |
- params.keys.sort.each do |key| | |
%tr | |
%td= key | |
%td= params[key] |
This file contains 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
- if RAILS_ENV == 'development' | |
#debug | |
= link_to_function('Params Trace', "$('debug_params').toggle()") | |
#debug_params | |
%table | |
- params.keys.sort.each do |key| | |
%tr | |
%td= key | |
%td= params[key] |
This file contains 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
# Benchmarks the performance of ActiveRecord vs. Sequel for some common tasks. | |
# To make sure you have all the necessary gems: | |
# | |
# gem install active_record sequel faker | |
require 'active_record' | |
require 'sequel' | |
require 'faker' | |
require 'benchmark' |
This file contains 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 Image < ActiveRecord::Base | |
belongs_to :user | |
belongs_to :attachment, :polymorphic => true | |
# validates_presence_of :url | |
before_save :check_for_defaults | |
default_scope :order => 'id asc' |
This file contains 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 upload | |
file = params[:Filedata] | |
image = Image.new(:file => file, | |
:title => file.original_filename.split('.').first, | |
:description => '', | |
:attachment_type => 'Profile') | |
if image.upload | |
render :json => { :image => { :url => image.url, :path => image.image_path }}.to_json | |
else |
This file contains 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() { | |
$("#uploadify").uploadify({ | |
'scriptData':{'token':'#{user.uuid}'}, | |
'uploader':'/media/uploadify.swf', | |
'script':'#{account_upload_path}', | |
'cancelImg':'#{image_path('icons/cancel.png')}', | |
'queueID':'file_queue', | |
'auto':true, | |
'multi':false, | |
'buttonText':'UPDATE IMAGE', |
This file contains 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 CodeStatistics #:nodoc: | |
TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests) | |
def initialize(*pairs) | |
@pairs = pairs | |
@statistics = calculate_statistics | |
@total = calculate_total if pairs.length > 1 | |
end |
This file contains 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
# If this is a Rails app, put this into config/amazon_s3.yml and create an initializer with the commented code below | |
development: | |
bucket_name: dev.watchmemakethis.com | |
access_key_id: AKIAJVO23UDSUSXGO75Q | |
secret_access_key: 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 | |
url: https://s3.amazonaws.com/dev.watchmemakethis.com | |
cdn: https://d33hnx0c6n9niy.cloudfront.net | |
This file contains 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
var http = require('http'); | |
var fs = require('fs'); | |
var server = new http.Server(); | |
server.listen(8000); | |
server.on('request', function(request, response) { | |
var url = require('url').parse(request.url); | |
if (url.pathname === '/test/delay') { |
This file contains 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
activesupport (3.1.0.rc3) lib/active_support/core_ext/string/output_safety.rb:129:in `gsub!' | |
haml (3.1.1) lib/haml/compiler.rb:382:in `block in build_attributes' | |
haml (3.1.1) lib/haml/compiler.rb:358:in `each' | |
haml (3.1.1) lib/haml/compiler.rb:358:in `collect' | |
haml (3.1.1) lib/haml/compiler.rb:358:in `build_attributes' | |
haml (3.1.1) lib/haml/compiler.rb:407:in `prerender_tag' | |
haml (3.1.1) lib/haml/compiler.rb:119:in `compile_tag' | |
haml (3.1.1) lib/haml/compiler.rb:447:in `compile' | |
haml (3.1.1) lib/haml/compiler.rb:446:in `block (2 levels) in compile' | |
haml (3.1.1) lib/haml/compiler.rb:446:in `each' |