Let's call it AdequateForm for now.
class SignUpForm < AdequateForm
attribute :first_name
attribute :last_name
attribute :birthdate, :date
validates :first_name, :birthdate, presence: true
end
Let's call it AdequateForm for now.
class SignUpForm < AdequateForm
attribute :first_name
attribute :last_name
attribute :birthdate, :date
validates :first_name, :birthdate, presence: true
end
// look ma, no jquery | |
// assuming that you have | |
// <a data-komments-permalink="/foobar">comments count goes here</a> | |
// somewhere in your HTML | |
function _kmtsLoaded(){ | |
var links = [].slice.apply(document.querySelectorAll("a[data-komments-permalink]")); | |
links.forEach(function(link){ |
// Prototype toQueryString fix | |
(function(){ | |
'use strict'; | |
function typeOf(obj) { | |
if (obj instanceof Date) { | |
return 'date'; | |
} else if (Object.isArray(obj)) { | |
return 'array'; |
/* | |
Prototype's helper for quick and easy observing | |
click events on different elements including | |
anchors with '#' href | |
Usage examples: | |
instead of: |
run 'rm public/index.html' | |
run 'rm public/favicon.ico' | |
run 'rm public/images/rails.png' | |
# remove Prototype defaults | |
run 'rm public/javascripts/controls.js' | |
run 'rm public/javascripts/dragdrop.js' | |
run 'rm public/javascripts/effects.js' | |
run 'rm public/javascripts/prototype.js' |
// тупо | |
var wiget = new Class({ | |
// ... | |
getSomething: function(){ | |
if (this.something) return this.something; | |
this.something = new Element('div'); | |
// тут километры кода | |
return this.something; |
!function(){ | |
function fakeLength(fn, length) { | |
if (length == fn.length) return fn; | |
var fakeArgs = []; | |
while(length--) fakeArgs.push('$fakeArg'+length); | |
return eval('(function('+fakeArgs.join(',')+'){ return fn.apply(this, arguments); })'); | |
} | |
Function.prototype.allRequired = function(){ |
class Authentication < ActiveRecord::Base | |
belongs_to :user | |
serialize :info | |
serialize :credentials | |
def update_from_omniauth(omniauth) | |
self.uid = omniauth['uid'] | |
self.provider = omniauth['provider'] | |
self.info = omniauth['user_info'] | |
self.credentials = omniauth['credentials'] |
my_object.bool_method?? 'yes' : 'no' | |
# or | |
my_object.bool_method? ? 'yes' : 'no' | |
# or | |
(my_object.bool_method?) ? 'yes' : 'no' |
= extends :html5_base do | |
- append :head do | |
meta(http-equiv="X-UA-Compatible" content="IE=edge") | |
title Lolwut | |
= area :assets do | |
= javascript_include_tag 'application' | |
= yield | |
#fb-root |