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
Element.prototype.triggerEvent = function(eventName) | |
{ | |
if (document.createEvent) | |
{ | |
var evt = document.createEvent('HTMLEvents'); | |
evt.initEvent(eventName, true, true); | |
return this.dispatchEvent(evt); | |
} | |
if (this.fireEvent) | |
return this.fireEvent('on' + eventName); |
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
function setEndOfContenteditable(contentEditableElement) | |
{ | |
var range,selection; | |
if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+ | |
{ | |
range = document.createRange();//Create a range (a range is a like the selection but invisible) | |
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range | |
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start | |
selection = window.getSelection();//get the selection object (allows you to change selection) | |
selection.removeAllRanges();//remove any selections already made |
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
<div id="confirmed"> | |
<h4>People who have already confirmed:</h4> | |
<div class="hSeparator"><!--[ie]--></div> | |
<table> | |
<%= @registerees.each do |r| %> | |
<tr> | |
<td><%= r[:fullName] %></td><td><%= r[:title]+' : '+r[:company] %></td><td><%= r[:city]+', ' r[:country]%></td> | |
</tr> | |
<% end %> | |
</table> |
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
get '/Registration' do | |
protected! | |
@registerees = User.all(:isRegistered => true) | |
erb :registration | |
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
def password_reset | |
o = [('a'..'z'),('A'..'Z')].map{|i| i.to_a}.flatten; | |
new_pass = (0..20).map{ o[rand(o.length)] }.join; | |
self.update(:shahash => User.encrypt(new_pass)) | |
return self.new_pass | |
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
class User | |
include DataMapper::Resource | |
timestamps :at | |
property :id, Serial | |
property :first_name, String, :required => true | |
property :last_name, String, :required => true | |
property :company, String | |
property :title, String | |
property :city, String |
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
DataObjects::DataError at /register | |
Out of range value for column 'mobile_number' at row 1 | |
Ruby /usr/local/rvm/gems/ruby-1.9.2-p180/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb: in execute_non_query, line 194 | |
Web POST lordevents.com.dev/register | |
Traceback (innermost first) | |
/usr/local/rvm/gems/ruby-1.9.2-p180/gems/dm-do-adapter-1.1.0/lib/dm-do-adapter/adapter.rb: in execute_non_query | |
connection.create_command(statement).execute_non_query(*bind_values)... |
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
<form id="registration" action="/register" method="post" accept-charset="utf-8"> | |
<table> | |
<tr> | |
<td><input type="text" name="first_name" value="" id="first_name" class="validate[required]"><br /><label for="first_name"><%= t[:forms][:firstName] %></label></td> | |
<td><input type="text" name="last_name" value="" id="last_name" class="validate[required]"><br /><label for="last_name"><%= t[:forms][:lastName] %></label></td> | |
</tr> | |
<tr> | |
<td><input type="text" name="company" value="" id="company" class="validate[required]"><br /><label for="company"><%= t[:forms][:company] %></label></td> | |
<td><input type="text" name="title" value="" id="title" class="validate[required]"><br /><label for="title"><%= t[:forms][:title] %></label></td> | |
</tr> |
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
ArgumentError at /faca-sua-insricao | |
invalid byte sequence in US-ASCII | |
file: utils.rb location: gsub line: 153 | |
sinatra.error | |
#<NoMethodError: undefined method `errors' for nil:NilClass> |
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
# encoding: utf-8 | |
class app < Sinatra::Application | |
Dir.glob('./routes/*').each { |r| require File.expand_path(File.join(File.dirname(__FILE__), r)) } | |
Dir.glob('./models/*').each { |r| require File.expand_path(File.join(File.dirname(__FILE__), r)) } | |
end |
OlderNewer