D. R. Henner drhenner

View gist:8462170
1 2 3 4 5 6 7 8 9 10
# The purpose of this gist is to propose use of inheritance when upgrading objects to have "more functionality".
 
# For example:
 
# Lets say you have a `company` model and your project manager purposes a huge pivot to your existing application.
# Now new fields are "required" for the new companies you create. Unfortunately adding validators to the existing
# `company` model will cause things to blow up. You could create a form object for the new forms with form specific
# validators. Several issues are now introduced:
# 1) There can be several form objects for the company. Each with a slight difference in logic.
View gist:2655665
1 2 3 4 5 6 7 8 9 10
class Geek < Person
include StarWarsFan
end
 
class SeniorSoftwareDeveloper < Geek
def initialize(information, ruby_projects = [])
@likes = ["Ruby", "JavaScript", "Software Meetups", "Startups", "Code Reviews"]
 
@minimum_qualifications = [ "2 years of ruby, 1 year if you kicked butt",
"Writes tests for code.",
View credit_card_validator.js
1 2 3 4 5 6 7 8 9 10
var Hadean = window.Hadean || { };
 
Hadean.Validators = {
CreditCards : {
currentCardType : null,
creditCardInput : null,
cardRegexps : [
[ 'Visa Electron' , /^(417500|(4917|4913|4508|4844)\d{2})\d{10}$/ ]
, [ 'Visa' , /^4\d{12}(\d{3})?$/ ]
, [ 'MasterCard' , /^(5[1-5]\d{4}|677189)\d{10}$/ ]
Something went wrong with that request. Please try again.