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
| require 'rubygems' | |
| require 'active_record' | |
| require 'yaml' | |
| require 'rake' | |
| def initialize_active_record | |
| config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml')) | |
| ActiveRecord::Base.establish_connection(config['development']) | |
| ActiveRecord::Base.default_timezone = :utc | |
| 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
| <?php | |
| //attempt 1 | |
| @q = | |
| //attempt 2 | |
| $q = 'mekdigital' unless $q | |
| //attempt 3 | |
| $q = 'mekdigital' unless $q; |
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
| <% if flash[:notice] %> | |
| <div id="notice"> | |
| <%= flash[:notice] %> | |
| <%= javascript_tag "fade_notice();" %> | |
| </div> | |
| <% end %> | |
| function fade_notice(){ | |
| setTimeout("$('notice').fade();", 3500); | |
| } |
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 language='javascript' src='http://app.headcounters.com/users.js'></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
| # Author: Emanuele Tozzato (mailto:etozzato@gmail.com) | |
| # | |
| # = Description | |
| # Execute given block until true for given attempts. | |
| # = Usage | |
| # exec! { gateway.perform_handshake('2897-XSANI-19827') } | |
| module Exec | |
| CONFIG = { | |
| :default_attempts => 3, |
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
| # app.rb | |
| get '/number.js' do | |
| @n = rand(100) | |
| erb :number | |
| 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
| <!-- example.html --> | |
| <script language='javascript' src='http://localhost:3000/number.js'></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
| => Booting Mongrel | |
| => Rails 2.3.2 application starting on http://0.0.0.0:3000 | |
| => Call with -d to detach | |
| => Ctrl-C to shutdown server | |
| Mongrel: port 3000 is already in use, trying 3001 |
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 FailController < ApplicationController | |
| def index | |
| Fail.add_request(request.host, request.path, request.env['HTTP_REFERER'] || '', request.remote_ip || "0.0.0.0") | |
| respond_to do |format| | |
| format.html { render :file => "#{RAILS_ROOT}/public/404.html", :status => "404 Not Found" } | |
| format.all { render :nothing => true, :status => "404 Not Found" } | |
| 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
| def valid_dns? | |
| return true if self.cname | |
| begin | |
| require 'resolv' | |
| heroku = Resolv.getaddresses("proxy.heroku.com") | |
| ip = Resolv.getaddress(self.landing.gsub('http://', '')) | |
| update_attribute(:cname, true) if heroku.include?(ip) | |
| return self.cname | |
| rescue | |
| return false |
OlderNewer