SlideShare a Scribd company logo
1 of 55
Download to read offline
WTF ORIENTED PROGRAMMING
by @AkitaOnRails
project_id	
  =	
  @user.project	
  ==	
  nil	
  ?	
  nil	
  :	
  @user.project.id
project_id	
  =	
  @user.project	
  ==	
  nil	
  ?	
  nil	
  :	
  @user.project.id
project_id	
  =	
  @user.try(:project).try(:id)
@politician	
  =	
  Politician.where(name:	
  "Terminator").first	
  
@politician.try(:studio).try(:name)
@politician	
  =	
  Politician.where(name:	
  "Terminator").first	
  
@politician.try(:studio).try(:name)
LAW OF DEMETER
@politician	
  =	
  Politician.where(name:	
  "Terminator").first	
  
@politician.try(:studio).try(:name)
LAW OF DEMETER
class	
  Politician	
  
	
  	
  delegate	
  :name,	
  to:	
  :studio,	
  
	
  	
  	
  	
  prefix:	
  true,	
  allow_nil:	
  true	
  
	
  	
  #	
  ...	
  
end	
  
@politician.studio.name
class	
  Politician	
  
	
  	
  delegate	
  :name,	
  to:	
  :studio,	
  
	
  	
  	
  	
  prefix:	
  true,	
  allow_nil:	
  true	
  
	
  	
  #	
  ...	
  
end	
  
@politician.studio.name@politician.studio_name
class	
  Politician	
  
	
  	
  delegate	
  :name,	
  to:	
  :studio,	
  
	
  	
  	
  	
  prefix:	
  true,	
  allow_nil:	
  true	
  
	
  	
  #	
  ...	
  
end	
  
@politician.studio.name@politician.studio_name
array	
  =	
  []	
  
list.each	
  do	
  |state|	
  
	
  	
  array	
  <<	
  [state.name,	
  state.acronym]	
  
end	
  
array
array	
  =	
  []	
  
list.each	
  do	
  |state|	
  
	
  	
  array	
  <<	
  [state.name,	
  state.acronym]	
  
end	
  
array
for	
  state	
  in	
  list
array	
  =	
  []	
  
list.each	
  do	
  |state|	
  
	
  	
  array	
  <<	
  [state.name,	
  state.acronym]	
  
end	
  
array
list.map	
  {	
  |state|	
  [state.name,	
  state.acronym]	
  }
for	
  state	
  in	
  list
array	
  =	
  []	
  
list.each	
  do	
  |state|	
  
	
  	
  if	
  state.name	
  =~	
  /^S/	
  
	
  	
  	
  	
  array	
  <<	
  [state.name,	
  state.acronym]	
  
	
  	
  end	
  
end	
  
array
array	
  =	
  []	
  
list.each	
  do	
  |state|	
  
	
  	
  if	
  state.name	
  =~	
  /^S/	
  
	
  	
  	
  	
  array	
  <<	
  [state.name,	
  state.acronym]	
  
	
  	
  end	
  
end	
  
array
list.	
  
	
  	
  select	
  {	
  |state|	
  state.name	
  =~	
  /^S/	
  }.	
  
	
  	
  map	
  {	
  |state|	
  [state.name,	
  state.acronym]	
  }
def	
  formatdate(d)	
  
	
  	
  	
  	
  months	
  =	
  Hash.new	
  
	
  	
  	
  	
  months["Jan"]	
  =	
  "janeiro"	
  
	
  	
  	
  	
  months["Feb"]	
  =	
  "fevereiro"	
  
	
  	
  	
  	
  #	
  ...	
  
	
  	
  	
  	
  months["Dec"]	
  =	
  "dezembro"	
  
	
  	
  
	
  	
  	
  	
  weeks	
  =	
  Hash.new	
  
	
  	
  	
  	
  weeks["Sun"]	
  =	
  "Domingo"	
  
	
  	
  	
  	
  #	
  ...	
  
	
  	
  	
  	
  weeks["Fri"]	
  =	
  "Sexta"	
  
	
  	
  	
  	
  weeks["Sat"]	
  =	
  "Sábado"	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  return	
  weeks[d.strftime("%a")]+",	
  "+d.strftime("%d")+"	
  de	
  "+months[d.strftime("%b")]	
  
end
def	
  formatdate(d)	
  
	
  	
  	
  	
  months	
  =	
  Hash.new	
  
	
  	
  	
  	
  months["Jan"]	
  =	
  "janeiro"	
  
	
  	
  	
  	
  months["Feb"]	
  =	
  "fevereiro"	
  
	
  	
  	
  	
  #	
  ...	
  
	
  	
  	
  	
  months["Dec"]	
  =	
  "dezembro"	
  
	
  	
  
	
  	
  	
  	
  weeks	
  =	
  Hash.new	
  
	
  	
  	
  	
  weeks["Sun"]	
  =	
  "Domingo"	
  
	
  	
  	
  	
  #	
  ...	
  
	
  	
  	
  	
  weeks["Fri"]	
  =	
  "Sexta"	
  
	
  	
  	
  	
  weeks["Sat"]	
  =	
  "Sábado"	
  
	
  	
  	
  	
  	
  
	
  	
  	
  	
  return	
  weeks[d.strftime("%a")]+",	
  "+d.strftime("%d")+"	
  de	
  "+months[d.strftime("%b")]	
  
end
#	
  config/locales/pt-­‐BR.yml	
  
pt-­‐BR:	
  
	
  	
  time:	
  
	
  	
  	
  	
  formats:	
  
	
  	
  	
  	
  	
  	
  short_wday:	
  "%a,	
  %d	
  de	
  %B”	
  
d.to_s(:short_wday)
<?php	
  if	
  (LANGUAGE	
  ==	
  'en')	
  {	
  ?>	
  <body	
  class="en">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'pt')	
  {	
  ?>	
  <body	
  class="pt">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'mx')	
  {	
  ?>	
  <body	
  class="mx">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'kp')	
  {	
  ?>	
  <body	
  class="kp">	
  <?php	
  }	
  ?>
<?php	
  if	
  (LANGUAGE	
  ==	
  'en')	
  {	
  ?>	
  <body	
  class="en">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'pt')	
  {	
  ?>	
  <body	
  class="pt">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'mx')	
  {	
  ?>	
  <body	
  class="mx">	
  <?php	
  }	
  ?>	
  
<?php	
  if	
  (LANGUAGE	
  ==	
  'kp')	
  {	
  ?>	
  <body	
  class="kp">	
  <?php	
  }	
  ?>
<body	
  class="<?php	
  LANGUAGE	
  ?>">
address	
  =	
  ((!client.street.to_s.nil?)?	
  client.street.to_s	
  :	
  "")	
  +	
  	
  
((!client.number.to_s.nil?)?	
  "	
  Nº	
  "	
  +	
  client.number.to_s	
  :	
  "")	
  +	
  "	
  "	
  +	
  	
  
((!client.city.to_s.nil?)?	
  client.city.to_s	
  :	
  "")	
  +	
  	
  
((!client.zip.to_s.nil?)?	
  "	
  -­‐	
  CEP:	
  "	
  +	
  client.zip.to_s	
  :	
  "")
address	
  =	
  ((!client.street.to_s.nil?)?	
  client.street.to_s	
  :	
  "")	
  +	
  	
  
((!client.number.to_s.nil?)?	
  "	
  Nº	
  "	
  +	
  client.number.to_s	
  :	
  "")	
  +	
  "	
  "	
  +	
  	
  
((!client.city.to_s.nil?)?	
  client.city.to_s	
  :	
  "")	
  +	
  	
  
((!client.zip.to_s.nil?)?	
  "	
  -­‐	
  CEP:	
  "	
  +	
  client.zip.to_s	
  :	
  "")
address	
  =	
  "#{client.street}	
  Nº	
  #{client.number}	
  #{client.city}	
  -­‐	
  CEP:	
  #{client.zip}"
address	
  =	
  ((!client.street.to_s.nil?)?	
  client.street.to_s	
  :	
  "")	
  +	
  	
  
((!client.number.to_s.nil?)?	
  "	
  Nº	
  "	
  +	
  client.number.to_s	
  :	
  "")	
  +	
  "	
  "	
  +	
  	
  
((!client.city.to_s.nil?)?	
  client.city.to_s	
  :	
  "")	
  +	
  	
  
((!client.zip.to_s.nil?)?	
  "	
  -­‐	
  CEP:	
  "	
  +	
  client.zip.to_s	
  :	
  "")
address	
  =	
  "#{client.street}	
  Nº	
  #{client.number}	
  #{client.city}	
  -­‐	
  CEP:	
  #{client.zip}"
address	
  =	
  "%s	
  Nº	
  %s	
  %s	
  -­‐	
  CEP:	
  %s"	
  %	
  [client.street,	
  client.number,	
  client.city,	
  client.zip]
address	
  =	
  ((!client.street.to_s.nil?)?	
  client.street.to_s	
  :	
  "")	
  +	
  	
  
((!client.number.to_s.nil?)?	
  "	
  Nº	
  "	
  +	
  client.number.to_s	
  :	
  "")	
  +	
  "	
  "	
  +	
  	
  
((!client.city.to_s.nil?)?	
  client.city.to_s	
  :	
  "")	
  +	
  	
  
((!client.zip.to_s.nil?)?	
  "	
  -­‐	
  CEP:	
  "	
  +	
  client.zip.to_s	
  :	
  "")
address	
  =	
  "#{client.street}	
  Nº	
  #{client.number}	
  #{client.city}	
  -­‐	
  CEP:	
  #{client.zip}"
address	
  =	
  "%s	
  Nº	
  %s	
  %s	
  -­‐	
  CEP:	
  %s"	
  %	
  [client.street,	
  client.number,	
  client.city,	
  client.zip]
class	
  ClientDecorator	
  
	
  	
  #	
  ...	
  
	
  	
  def	
  formatted_address	
  
	
  	
  	
  	
  "%s	
  Nº	
  %s	
  %s	
  -­‐	
  CEP:	
  %s"	
  %	
  [street,	
  number,	
  city,	
  zip]	
  
	
  	
  end	
  
end
–Jamie Zawinksi
“Some people, when confronted with a problem,
think, “I know, I’ll use regular expressions.” Now
they have two problems.”
http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :email,	
  format:	
  {	
  with:	
  /A[^@]+@([^@.]+.)+[^@.]+z/	
  }	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :email,	
  format:	
  {	
  with:	
  /A[^@]+@([^@.]+.)+[^@.]+z/	
  }	
  
end
class	
  EmailValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  email_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  email")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  def	
  email_valid?(email)	
  
	
  	
  	
  	
  Mail::Address.new(email)	
  
	
  	
  	
  	
  true	
  
	
  	
  rescue	
  Mail::Field::ParseError	
  =>	
  e	
  
	
  	
  	
  	
  false	
  
	
  	
  end	
  	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :email,	
  format:	
  {	
  with:	
  /A[^@]+@([^@.]+.)+[^@.]+z/	
  }	
  
end
class	
  EmailValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  email_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  email")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  def	
  email_valid?(email)	
  
	
  	
  	
  	
  Mail::Address.new(email)	
  
	
  	
  	
  	
  true	
  
	
  	
  rescue	
  Mail::Field::ParseError	
  =>	
  e	
  
	
  	
  	
  	
  false	
  
	
  	
  end	
  	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :email,	
  format:	
  {	
  with:	
  /A[^@]+@([^@.]+.)+[^@.]+z/	
  }	
  
end
class	
  EmailValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  email_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  email")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  def	
  email_valid?(email)	
  
	
  	
  	
  	
  Mail::Address.new(email)	
  
	
  	
  	
  	
  true	
  
	
  	
  rescue	
  Mail::Field::ParseError	
  =>	
  e	
  
	
  	
  	
  	
  false	
  
	
  	
  end	
  	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :email,	
  email:	
  true	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :link,	
  format:	
  {	
  with:	
  
	
  	
  	
  	
  /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix	
  
	
  	
  }	
  
end
https://coderwall.com/p/ztig5g/validate-urls-in-rails
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :link,	
  format:	
  {	
  with:	
  
	
  	
  	
  	
  /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix	
  
	
  	
  }	
  
end
https://coderwall.com/p/ztig5g/validate-urls-in-rails
class	
  UrlValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  url_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  URL")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  	
  #	
  a	
  URL	
  may	
  be	
  technically	
  well-­‐formed	
  but	
  may	
  	
  
	
  	
  #	
  not	
  actually	
  be	
  valid,	
  so	
  this	
  checks	
  for	
  both.	
  
	
  	
  def	
  url_valid?(url)	
  
	
  	
  	
  	
  url	
  =	
  URI.parse(url)	
  rescue	
  false	
  
	
  	
  	
  	
  url.kind_of?(URI::HTTP)	
  ||	
  url.kind_of?(URI::HTTPS)	
  
	
  	
  end	
  	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :link,	
  format:	
  {	
  with:	
  
	
  	
  	
  	
  /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix	
  
	
  	
  }	
  
end
https://coderwall.com/p/ztig5g/validate-urls-in-rails
class	
  UrlValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  url_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  URL")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  	
  #	
  a	
  URL	
  may	
  be	
  technically	
  well-­‐formed	
  but	
  may	
  	
  
	
  	
  #	
  not	
  actually	
  be	
  valid,	
  so	
  this	
  checks	
  for	
  both.	
  
	
  	
  def	
  url_valid?(url)	
  
	
  	
  	
  	
  url	
  =	
  URI.parse(url)	
  rescue	
  false	
  
	
  	
  	
  	
  url.kind_of?(URI::HTTP)	
  ||	
  url.kind_of?(URI::HTTPS)	
  
	
  	
  end	
  	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :link,	
  url:	
  true	
  
end
class	
  User	
  <	
  ActiveRecord::Base	
  
	
  	
  validates	
  :link,	
  format:	
  {	
  with:	
  
	
  	
  	
  	
  /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix	
  
	
  	
  }	
  
end
https://coderwall.com/p/ztig5g/validate-urls-in-rails
class	
  UrlValidator	
  <	
  ActiveModel::EachValidator	
  
	
  	
  def	
  validate_each(record,	
  attribute,	
  value)	
  
	
  	
  	
  	
  unless	
  url_valid?(value)	
  
	
  	
  	
  	
  	
  	
  record.errors[attribute]	
  <<	
  (options[:message]	
  ||	
  "must	
  be	
  a	
  valid	
  URL")	
  
	
  	
  	
  	
  end	
  
	
  	
  end	
  
	
  	
  #	
  a	
  URL	
  may	
  be	
  technically	
  well-­‐formed	
  but	
  may	
  	
  
	
  	
  #	
  not	
  actually	
  be	
  valid,	
  so	
  this	
  checks	
  for	
  both.	
  
	
  	
  def	
  url_valid?(url)	
  
	
  	
  	
  	
  url	
  =	
  URI.parse(url)	
  rescue	
  false	
  
	
  	
  	
  	
  url.kind_of?(URI::HTTP)	
  ||	
  url.kind_of?(URI::HTTPS)	
  
	
  	
  end	
  	
  
end
def	
  query	
  
	
  	
  Vote.connection.select_values	
  <<-­‐SQL	
  
	
  	
  	
  	
  SELECT	
  voteable_id	
  
	
  	
  	
  	
  FROM	
  votes	
  
	
  	
  	
  	
  LEFT	
  OUTER	
  JOIN	
  authorships	
  ON	
  authorships.bill_id	
  =	
  voteable_id	
  
	
  	
  	
  	
  LEFT	
  OUTER	
  JOIN	
  politicians	
  ON	
  politicians.id	
  =	
  politician_id	
  
	
  	
  	
  	
  WHERE	
  voteable_type	
  =	
  'Bill'	
  
	
  	
  	
  	
  	
  	
  AND	
  person_type	
  =	
  'User'	
  
	
  	
  	
  	
  	
  	
  AND	
  votes.created_at	
  >=	
  now()	
  -­‐	
  interval	
  '90	
  days'	
  
	
  	
  	
  	
  	
  	
  #{@condition.present??	
  "AND	
  #{@condition}"	
  :	
  ""}	
  
	
  	
  	
  	
  GROUP	
  BY	
  voteable_id	
  
	
  	
  	
  	
  ORDER	
  BY	
  count(*)	
  DESC	
  LIMIT	
  6;	
  
	
  	
  SQL	
  
end
http://guides.rubyonrails.org/active_record_querying.html
def	
  query	
  
	
  	
  Vote.connection.select_values	
  <<-­‐SQL	
  
	
  	
  	
  	
  SELECT	
  voteable_id	
  
	
  	
  	
  	
  FROM	
  votes	
  
	
  	
  	
  	
  LEFT	
  OUTER	
  JOIN	
  authorships	
  ON	
  authorships.bill_id	
  =	
  voteable_id	
  
	
  	
  	
  	
  LEFT	
  OUTER	
  JOIN	
  politicians	
  ON	
  politicians.id	
  =	
  politician_id	
  
	
  	
  	
  	
  WHERE	
  voteable_type	
  =	
  'Bill'	
  
	
  	
  	
  	
  	
  	
  AND	
  person_type	
  =	
  'User'	
  
	
  	
  	
  	
  	
  	
  AND	
  votes.created_at	
  >=	
  now()	
  -­‐	
  interval	
  '90	
  days'	
  
	
  	
  	
  	
  	
  	
  #{@condition.present??	
  "AND	
  #{@condition}"	
  :	
  ""}	
  
	
  	
  	
  	
  GROUP	
  BY	
  voteable_id	
  
	
  	
  	
  	
  ORDER	
  BY	
  count(*)	
  DESC	
  LIMIT	
  6;	
  
	
  	
  SQL	
  
end
def	
  query	
  
	
  	
  query	
  =	
  Vote.select('voteable_id')	
  
	
  	
  	
  	
  joins("LEFT	
  OUTER	
  JOIN	
  authorships	
  ON	
  authorships.bill_id	
  =	
  voteable_id").	
  
	
  	
  	
  	
  joins("LEFT	
  OUTER	
  JOIN	
  politicians	
  ON	
  politicians.id	
  =	
  politician_id").	
  
	
  	
  	
  	
  where(voteable_type:	
  'Bill',	
  person_type:	
  'User').	
  
	
  	
  	
  	
  where("votes.created_at	
  >=	
  now()	
  -­‐	
  interval	
  '90	
  days'").	
  
	
  	
  	
  	
  group('voteable_id').	
  
	
  	
  	
  	
  order('count(*)	
  desc').	
  
	
  	
  	
  	
  limit(6)	
  
	
  	
  query	
  =	
  query.where(@condition)	
  if	
  @condition.present?	
  
	
  	
  query	
  
end
http://guides.rubyonrails.org/active_record_querying.html
OBRIGADO!
@akitaonrails

More Related Content

What's hot

RIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWTRIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWTMichael Galpin
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askAndrea Giuliano
 
{tidygraph}と{ggraph}によるモダンなネットワーク分析
{tidygraph}と{ggraph}によるモダンなネットワーク分析{tidygraph}と{ggraph}によるモダンなネットワーク分析
{tidygraph}と{ggraph}によるモダンなネットワーク分析Takashi Kitano
 
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜Takashi Kitano
 
Database performance 101
Database performance 101Database performance 101
Database performance 101Leon Fayer
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin
 
A Tour to MySQL Commands
A Tour to MySQL CommandsA Tour to MySQL Commands
A Tour to MySQL CommandsHikmat Dhamee
 
ABC of Perl programming
ABC of Perl programmingABC of Perl programming
ABC of Perl programmingBo Hua Yang
 
questionnaries-theme.tpl_.php_.txt
questionnaries-theme.tpl_.php_.txtquestionnaries-theme.tpl_.php_.txt
questionnaries-theme.tpl_.php_.txtsahilsahoo85
 
Managing category structures in relational databases
Managing category structures in relational databasesManaging category structures in relational databases
Managing category structures in relational databasesAntoine Osanz
 
Mining the social web ch1
Mining the social web ch1Mining the social web ch1
Mining the social web ch1HyeonSeok Choi
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)riue
 
令和から本気出す
令和から本気出す令和から本気出す
令和から本気出すTakashi Kitano
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testingVincent Pradeilles
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsDavid Golden
 
Protocols
ProtocolsProtocols
ProtocolsSV.CO
 
Syntactic sugar in postgre sql
Syntactic sugar in postgre sqlSyntactic sugar in postgre sql
Syntactic sugar in postgre sqlAntony Abramchenko
 
Syntactic sugar in Postgre SQL
Syntactic sugar in Postgre SQLSyntactic sugar in Postgre SQL
Syntactic sugar in Postgre SQLAntony Abramchenko
 

What's hot (20)

RIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWTRIAs Done Right: Grails, Flex, and EXT GWT
RIAs Done Right: Grails, Flex, and EXT GWT
 
Everything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to askEverything you always wanted to know about forms* *but were afraid to ask
Everything you always wanted to know about forms* *but were afraid to ask
 
Leveraging Symfony2 Forms
Leveraging Symfony2 FormsLeveraging Symfony2 Forms
Leveraging Symfony2 Forms
 
{tidygraph}と{ggraph}によるモダンなネットワーク分析
{tidygraph}と{ggraph}によるモダンなネットワーク分析{tidygraph}と{ggraph}によるモダンなネットワーク分析
{tidygraph}と{ggraph}によるモダンなネットワーク分析
 
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜
好みの日本酒を呑みたい! 〜さけのわデータで探す自分好みの酒〜
 
Database performance 101
Database performance 101Database performance 101
Database performance 101
 
Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"Webmontag Berlin "coffee script"
Webmontag Berlin "coffee script"
 
A Tour to MySQL Commands
A Tour to MySQL CommandsA Tour to MySQL Commands
A Tour to MySQL Commands
 
Perl6 one-liners
Perl6 one-linersPerl6 one-liners
Perl6 one-liners
 
ABC of Perl programming
ABC of Perl programmingABC of Perl programming
ABC of Perl programming
 
questionnaries-theme.tpl_.php_.txt
questionnaries-theme.tpl_.php_.txtquestionnaries-theme.tpl_.php_.txt
questionnaries-theme.tpl_.php_.txt
 
Managing category structures in relational databases
Managing category structures in relational databasesManaging category structures in relational databases
Managing category structures in relational databases
 
Mining the social web ch1
Mining the social web ch1Mining the social web ch1
Mining the social web ch1
 
関数潮流(Function Tendency)
関数潮流(Function Tendency)関数潮流(Function Tendency)
関数潮流(Function Tendency)
 
令和から本気出す
令和から本気出す令和から本気出す
令和から本気出す
 
An introduction to property-based testing
An introduction to property-based testingAn introduction to property-based testing
An introduction to property-based testing
 
Taking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order FunctionsTaking Perl to Eleven with Higher-Order Functions
Taking Perl to Eleven with Higher-Order Functions
 
Protocols
ProtocolsProtocols
Protocols
 
Syntactic sugar in postgre sql
Syntactic sugar in postgre sqlSyntactic sugar in postgre sql
Syntactic sugar in postgre sql
 
Syntactic sugar in Postgre SQL
Syntactic sugar in Postgre SQLSyntactic sugar in Postgre SQL
Syntactic sugar in Postgre SQL
 

Similar to WTF Oriented Programming, com Fabio Akita

Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manualinteldualcore
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackVic Metcalfe
 
(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and ProfitOlaf Alders
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairMark
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009David Pollak
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a bossgsterndale
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick touraztack
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languagesArthur Xavier
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme SwiftMovel
 
JBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersJBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersTikal Knowledge
 
Creating a compiler in Perl 6
Creating a compiler in Perl 6Creating a compiler in Perl 6
Creating a compiler in Perl 6Andrew Shitov
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using RoomNelson Glauber Leal
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”apostlion
 
Implementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsImplementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsKostyantyn Stepanyuk
 
Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonSiddhi
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Peter Meyer
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB jhchabran
 

Similar to WTF Oriented Programming, com Fabio Akita (20)

Scala 2 + 2 > 4
Scala 2 + 2 > 4Scala 2 + 2 > 4
Scala 2 + 2 > 4
 
Internet programming lab manual
Internet programming lab manualInternet programming lab manual
Internet programming lab manual
 
An Elephant of a Different Colour: Hack
An Elephant of a Different Colour: HackAn Elephant of a Different Colour: Hack
An Elephant of a Different Colour: Hack
 
(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit(Ab)Using the MetaCPAN API for Fun and Profit
(Ab)Using the MetaCPAN API for Fun and Profit
 
CoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love AffairCoffeeScript - A Rubyist's Love Affair
CoffeeScript - A Rubyist's Love Affair
 
Beginning Scala Svcc 2009
Beginning Scala Svcc 2009Beginning Scala Svcc 2009
Beginning Scala Svcc 2009
 
Refactor like a boss
Refactor like a bossRefactor like a boss
Refactor like a boss
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Ruby Language - A quick tour
Ruby Language - A quick tourRuby Language - A quick tour
Ruby Language - A quick tour
 
PHP Tutorial (funtion)
PHP Tutorial (funtion)PHP Tutorial (funtion)
PHP Tutorial (funtion)
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languages
 
Extreme Swift
Extreme SwiftExtreme Swift
Extreme Swift
 
JBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java ProgrammersJBUG 11 - Scala For Java Programmers
JBUG 11 - Scala For Java Programmers
 
Creating a compiler in Perl 6
Creating a compiler in Perl 6Creating a compiler in Perl 6
Creating a compiler in Perl 6
 
Persisting Data on SQLite using Room
Persisting Data on SQLite using RoomPersisting Data on SQLite using Room
Persisting Data on SQLite using Room
 
RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”RubyBarCamp “Полезные gems и plugins”
RubyBarCamp “Полезные gems и plugins”
 
Implementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsImplementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord models
 
Creating Domain Specific Languages in Python
Creating Domain Specific Languages in PythonCreating Domain Specific Languages in Python
Creating Domain Specific Languages in Python
 
Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018Using a mobile phone as a therapist - Superweek 2018
Using a mobile phone as a therapist - Superweek 2018
 
Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB Introduction à CoffeeScript pour ParisRB
Introduction à CoffeeScript pour ParisRB
 

More from iMasters

O que você precisa saber para modelar bancos de dados NoSQL - Dani Monteiro
O que você precisa saber para modelar bancos de dados NoSQL - Dani MonteiroO que você precisa saber para modelar bancos de dados NoSQL - Dani Monteiro
O que você precisa saber para modelar bancos de dados NoSQL - Dani MonteiroiMasters
 
Postgres: wanted, beloved or dreaded? - Fabio Telles
Postgres: wanted, beloved or dreaded? - Fabio TellesPostgres: wanted, beloved or dreaded? - Fabio Telles
Postgres: wanted, beloved or dreaded? - Fabio TellesiMasters
 
Por que minha query esta lenta? - Suellen Moraes
Por que minha query esta lenta? - Suellen MoraesPor que minha query esta lenta? - Suellen Moraes
Por que minha query esta lenta? - Suellen MoraesiMasters
 
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...iMasters
 
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesiMasters
 
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...iMasters
 
Arquitetando seus dados na prática para a LGPD - Alessandra Martins
Arquitetando seus dados na prática para a LGPD - Alessandra MartinsArquitetando seus dados na prática para a LGPD - Alessandra Martins
Arquitetando seus dados na prática para a LGPD - Alessandra MartinsiMasters
 
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...iMasters
 
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana Chahoud
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana ChahoudDesenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana Chahoud
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana ChahoudiMasters
 
Use MDD e faça as máquinas trabalharem para você - Andreza Leite
 Use MDD e faça as máquinas trabalharem para você - Andreza Leite Use MDD e faça as máquinas trabalharem para você - Andreza Leite
Use MDD e faça as máquinas trabalharem para você - Andreza LeiteiMasters
 
Entendendo os porquês do seu servidor - Talita Bernardes
Entendendo os porquês do seu servidor - Talita BernardesEntendendo os porquês do seu servidor - Talita Bernardes
Entendendo os porquês do seu servidor - Talita BernardesiMasters
 
Backend performático além do "coloca mais máquina lá" - Diana Arnos
Backend performático além do "coloca mais máquina lá" - Diana ArnosBackend performático além do "coloca mais máquina lá" - Diana Arnos
Backend performático além do "coloca mais máquina lá" - Diana ArnosiMasters
 
Dicas para uma maior performance em APIs REST - Renato Groffe
Dicas para uma maior performance em APIs REST - Renato GroffeDicas para uma maior performance em APIs REST - Renato Groffe
Dicas para uma maior performance em APIs REST - Renato GroffeiMasters
 
7 dicas de desempenho que equivalem por 21 - Danielle Monteiro
7 dicas de desempenho que equivalem por 21 - Danielle Monteiro7 dicas de desempenho que equivalem por 21 - Danielle Monteiro
7 dicas de desempenho que equivalem por 21 - Danielle MonteiroiMasters
 
Quem se importa com acessibilidade Web? - Mauricio Maujor
Quem se importa com acessibilidade Web? - Mauricio MaujorQuem se importa com acessibilidade Web? - Mauricio Maujor
Quem se importa com acessibilidade Web? - Mauricio MaujoriMasters
 
Service Mesh com Istio e Kubernetes - Wellington Figueira da Silva
Service Mesh com Istio e Kubernetes - Wellington Figueira da SilvaService Mesh com Istio e Kubernetes - Wellington Figueira da Silva
Service Mesh com Istio e Kubernetes - Wellington Figueira da SilvaiMasters
 
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto Pascutti
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto PascuttiErros: Como eles vivem, se alimentam e se reproduzem? - Augusto Pascutti
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto PascuttiiMasters
 
Elasticidade e engenharia de banco de dados para alta performance - Rubens G...
Elasticidade e engenharia de banco de dados para alta performance  - Rubens G...Elasticidade e engenharia de banco de dados para alta performance  - Rubens G...
Elasticidade e engenharia de banco de dados para alta performance - Rubens G...iMasters
 
Construindo aplicações mais confiantes - Carolina Karklis
Construindo aplicações mais confiantes - Carolina KarklisConstruindo aplicações mais confiantes - Carolina Karklis
Construindo aplicações mais confiantes - Carolina KarklisiMasters
 
Monitoramento de Aplicações - Felipe Regalgo
Monitoramento de Aplicações - Felipe RegalgoMonitoramento de Aplicações - Felipe Regalgo
Monitoramento de Aplicações - Felipe RegalgoiMasters
 

More from iMasters (20)

O que você precisa saber para modelar bancos de dados NoSQL - Dani Monteiro
O que você precisa saber para modelar bancos de dados NoSQL - Dani MonteiroO que você precisa saber para modelar bancos de dados NoSQL - Dani Monteiro
O que você precisa saber para modelar bancos de dados NoSQL - Dani Monteiro
 
Postgres: wanted, beloved or dreaded? - Fabio Telles
Postgres: wanted, beloved or dreaded? - Fabio TellesPostgres: wanted, beloved or dreaded? - Fabio Telles
Postgres: wanted, beloved or dreaded? - Fabio Telles
 
Por que minha query esta lenta? - Suellen Moraes
Por que minha query esta lenta? - Suellen MoraesPor que minha query esta lenta? - Suellen Moraes
Por que minha query esta lenta? - Suellen Moraes
 
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...
Relato das trincheiras: o dia a dia de uma consultoria de banco de dados - Ig...
 
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalvesORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
ORMs heróis ou vilões dentro da arquitetura de dados? - Otávio gonçalves
 
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...
SQL e NoSQL trabalhando juntos: uma comparação para obter o melhor de ambos -...
 
Arquitetando seus dados na prática para a LGPD - Alessandra Martins
Arquitetando seus dados na prática para a LGPD - Alessandra MartinsArquitetando seus dados na prática para a LGPD - Alessandra Martins
Arquitetando seus dados na prática para a LGPD - Alessandra Martins
 
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...
O papel do DBA no mundo de ciência de dados e machine learning - Mauro Pichil...
 
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana Chahoud
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana ChahoudDesenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana Chahoud
Desenvolvimento Mobile Híbrido, Nativo ou Web: Quando usá-los - Juliana Chahoud
 
Use MDD e faça as máquinas trabalharem para você - Andreza Leite
 Use MDD e faça as máquinas trabalharem para você - Andreza Leite Use MDD e faça as máquinas trabalharem para você - Andreza Leite
Use MDD e faça as máquinas trabalharem para você - Andreza Leite
 
Entendendo os porquês do seu servidor - Talita Bernardes
Entendendo os porquês do seu servidor - Talita BernardesEntendendo os porquês do seu servidor - Talita Bernardes
Entendendo os porquês do seu servidor - Talita Bernardes
 
Backend performático além do "coloca mais máquina lá" - Diana Arnos
Backend performático além do "coloca mais máquina lá" - Diana ArnosBackend performático além do "coloca mais máquina lá" - Diana Arnos
Backend performático além do "coloca mais máquina lá" - Diana Arnos
 
Dicas para uma maior performance em APIs REST - Renato Groffe
Dicas para uma maior performance em APIs REST - Renato GroffeDicas para uma maior performance em APIs REST - Renato Groffe
Dicas para uma maior performance em APIs REST - Renato Groffe
 
7 dicas de desempenho que equivalem por 21 - Danielle Monteiro
7 dicas de desempenho que equivalem por 21 - Danielle Monteiro7 dicas de desempenho que equivalem por 21 - Danielle Monteiro
7 dicas de desempenho que equivalem por 21 - Danielle Monteiro
 
Quem se importa com acessibilidade Web? - Mauricio Maujor
Quem se importa com acessibilidade Web? - Mauricio MaujorQuem se importa com acessibilidade Web? - Mauricio Maujor
Quem se importa com acessibilidade Web? - Mauricio Maujor
 
Service Mesh com Istio e Kubernetes - Wellington Figueira da Silva
Service Mesh com Istio e Kubernetes - Wellington Figueira da SilvaService Mesh com Istio e Kubernetes - Wellington Figueira da Silva
Service Mesh com Istio e Kubernetes - Wellington Figueira da Silva
 
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto Pascutti
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto PascuttiErros: Como eles vivem, se alimentam e se reproduzem? - Augusto Pascutti
Erros: Como eles vivem, se alimentam e se reproduzem? - Augusto Pascutti
 
Elasticidade e engenharia de banco de dados para alta performance - Rubens G...
Elasticidade e engenharia de banco de dados para alta performance  - Rubens G...Elasticidade e engenharia de banco de dados para alta performance  - Rubens G...
Elasticidade e engenharia de banco de dados para alta performance - Rubens G...
 
Construindo aplicações mais confiantes - Carolina Karklis
Construindo aplicações mais confiantes - Carolina KarklisConstruindo aplicações mais confiantes - Carolina Karklis
Construindo aplicações mais confiantes - Carolina Karklis
 
Monitoramento de Aplicações - Felipe Regalgo
Monitoramento de Aplicações - Felipe RegalgoMonitoramento de Aplicações - Felipe Regalgo
Monitoramento de Aplicações - Felipe Regalgo
 

Recently uploaded

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Recently uploaded (20)

How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

WTF Oriented Programming, com Fabio Akita

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14. project_id  =  @user.project  ==  nil  ?  nil  :  @user.project.id
  • 15. project_id  =  @user.project  ==  nil  ?  nil  :  @user.project.id project_id  =  @user.try(:project).try(:id)
  • 16. @politician  =  Politician.where(name:  "Terminator").first   @politician.try(:studio).try(:name)
  • 17. @politician  =  Politician.where(name:  "Terminator").first   @politician.try(:studio).try(:name) LAW OF DEMETER
  • 18. @politician  =  Politician.where(name:  "Terminator").first   @politician.try(:studio).try(:name) LAW OF DEMETER
  • 19. class  Politician      delegate  :name,  to:  :studio,          prefix:  true,  allow_nil:  true      #  ...   end   @politician.studio.name
  • 20. class  Politician      delegate  :name,  to:  :studio,          prefix:  true,  allow_nil:  true      #  ...   end   @politician.studio.name@politician.studio_name
  • 21. class  Politician      delegate  :name,  to:  :studio,          prefix:  true,  allow_nil:  true      #  ...   end   @politician.studio.name@politician.studio_name
  • 22.
  • 23. array  =  []   list.each  do  |state|      array  <<  [state.name,  state.acronym]   end   array
  • 24. array  =  []   list.each  do  |state|      array  <<  [state.name,  state.acronym]   end   array for  state  in  list
  • 25. array  =  []   list.each  do  |state|      array  <<  [state.name,  state.acronym]   end   array list.map  {  |state|  [state.name,  state.acronym]  } for  state  in  list
  • 26. array  =  []   list.each  do  |state|      if  state.name  =~  /^S/          array  <<  [state.name,  state.acronym]      end   end   array
  • 27. array  =  []   list.each  do  |state|      if  state.name  =~  /^S/          array  <<  [state.name,  state.acronym]      end   end   array list.      select  {  |state|  state.name  =~  /^S/  }.      map  {  |state|  [state.name,  state.acronym]  }
  • 28. def  formatdate(d)          months  =  Hash.new          months["Jan"]  =  "janeiro"          months["Feb"]  =  "fevereiro"          #  ...          months["Dec"]  =  "dezembro"              weeks  =  Hash.new          weeks["Sun"]  =  "Domingo"          #  ...          weeks["Fri"]  =  "Sexta"          weeks["Sat"]  =  "Sábado"                    return  weeks[d.strftime("%a")]+",  "+d.strftime("%d")+"  de  "+months[d.strftime("%b")]   end
  • 29. def  formatdate(d)          months  =  Hash.new          months["Jan"]  =  "janeiro"          months["Feb"]  =  "fevereiro"          #  ...          months["Dec"]  =  "dezembro"              weeks  =  Hash.new          weeks["Sun"]  =  "Domingo"          #  ...          weeks["Fri"]  =  "Sexta"          weeks["Sat"]  =  "Sábado"                    return  weeks[d.strftime("%a")]+",  "+d.strftime("%d")+"  de  "+months[d.strftime("%b")]   end #  config/locales/pt-­‐BR.yml   pt-­‐BR:      time:          formats:              short_wday:  "%a,  %d  de  %B”   d.to_s(:short_wday)
  • 30. <?php  if  (LANGUAGE  ==  'en')  {  ?>  <body  class="en">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'pt')  {  ?>  <body  class="pt">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'mx')  {  ?>  <body  class="mx">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'kp')  {  ?>  <body  class="kp">  <?php  }  ?>
  • 31. <?php  if  (LANGUAGE  ==  'en')  {  ?>  <body  class="en">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'pt')  {  ?>  <body  class="pt">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'mx')  {  ?>  <body  class="mx">  <?php  }  ?>   <?php  if  (LANGUAGE  ==  'kp')  {  ?>  <body  class="kp">  <?php  }  ?> <body  class="<?php  LANGUAGE  ?>">
  • 32. address  =  ((!client.street.to_s.nil?)?  client.street.to_s  :  "")  +     ((!client.number.to_s.nil?)?  "  Nº  "  +  client.number.to_s  :  "")  +  "  "  +     ((!client.city.to_s.nil?)?  client.city.to_s  :  "")  +     ((!client.zip.to_s.nil?)?  "  -­‐  CEP:  "  +  client.zip.to_s  :  "")
  • 33. address  =  ((!client.street.to_s.nil?)?  client.street.to_s  :  "")  +     ((!client.number.to_s.nil?)?  "  Nº  "  +  client.number.to_s  :  "")  +  "  "  +     ((!client.city.to_s.nil?)?  client.city.to_s  :  "")  +     ((!client.zip.to_s.nil?)?  "  -­‐  CEP:  "  +  client.zip.to_s  :  "") address  =  "#{client.street}  Nº  #{client.number}  #{client.city}  -­‐  CEP:  #{client.zip}"
  • 34. address  =  ((!client.street.to_s.nil?)?  client.street.to_s  :  "")  +     ((!client.number.to_s.nil?)?  "  Nº  "  +  client.number.to_s  :  "")  +  "  "  +     ((!client.city.to_s.nil?)?  client.city.to_s  :  "")  +     ((!client.zip.to_s.nil?)?  "  -­‐  CEP:  "  +  client.zip.to_s  :  "") address  =  "#{client.street}  Nº  #{client.number}  #{client.city}  -­‐  CEP:  #{client.zip}" address  =  "%s  Nº  %s  %s  -­‐  CEP:  %s"  %  [client.street,  client.number,  client.city,  client.zip]
  • 35. address  =  ((!client.street.to_s.nil?)?  client.street.to_s  :  "")  +     ((!client.number.to_s.nil?)?  "  Nº  "  +  client.number.to_s  :  "")  +  "  "  +     ((!client.city.to_s.nil?)?  client.city.to_s  :  "")  +     ((!client.zip.to_s.nil?)?  "  -­‐  CEP:  "  +  client.zip.to_s  :  "") address  =  "#{client.street}  Nº  #{client.number}  #{client.city}  -­‐  CEP:  #{client.zip}" address  =  "%s  Nº  %s  %s  -­‐  CEP:  %s"  %  [client.street,  client.number,  client.city,  client.zip] class  ClientDecorator      #  ...      def  formatted_address          "%s  Nº  %s  %s  -­‐  CEP:  %s"  %  [street,  number,  city,  zip]      end   end
  • 36. –Jamie Zawinksi “Some people, when confronted with a problem, think, “I know, I’ll use regular expressions.” Now they have two problems.” http://davidcel.is/blog/2012/09/06/stop-validating-email-addresses-with-regex/
  • 37. class  User  <  ActiveRecord::Base      validates  :email,  format:  {  with:  /A[^@]+@([^@.]+.)+[^@.]+z/  }   end
  • 38. class  User  <  ActiveRecord::Base      validates  :email,  format:  {  with:  /A[^@]+@([^@.]+.)+[^@.]+z/  }   end class  EmailValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  email_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  email")          end      end    def  email_valid?(email)          Mail::Address.new(email)          true      rescue  Mail::Field::ParseError  =>  e          false      end     end
  • 39. class  User  <  ActiveRecord::Base      validates  :email,  format:  {  with:  /A[^@]+@([^@.]+.)+[^@.]+z/  }   end class  EmailValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  email_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  email")          end      end    def  email_valid?(email)          Mail::Address.new(email)          true      rescue  Mail::Field::ParseError  =>  e          false      end     end
  • 40. class  User  <  ActiveRecord::Base      validates  :email,  format:  {  with:  /A[^@]+@([^@.]+.)+[^@.]+z/  }   end class  EmailValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  email_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  email")          end      end    def  email_valid?(email)          Mail::Address.new(email)          true      rescue  Mail::Field::ParseError  =>  e          false      end     end class  User  <  ActiveRecord::Base      validates  :email,  email:  true   end
  • 41.
  • 42. class  User  <  ActiveRecord::Base      validates  :link,  format:  {  with:          /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix      }   end https://coderwall.com/p/ztig5g/validate-urls-in-rails
  • 43. class  User  <  ActiveRecord::Base      validates  :link,  format:  {  with:          /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix      }   end https://coderwall.com/p/ztig5g/validate-urls-in-rails class  UrlValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  url_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  URL")          end      end      #  a  URL  may  be  technically  well-­‐formed  but  may        #  not  actually  be  valid,  so  this  checks  for  both.      def  url_valid?(url)          url  =  URI.parse(url)  rescue  false          url.kind_of?(URI::HTTP)  ||  url.kind_of?(URI::HTTPS)      end     end
  • 44. class  User  <  ActiveRecord::Base      validates  :link,  format:  {  with:          /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix      }   end https://coderwall.com/p/ztig5g/validate-urls-in-rails class  UrlValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  url_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  URL")          end      end      #  a  URL  may  be  technically  well-­‐formed  but  may        #  not  actually  be  valid,  so  this  checks  for  both.      def  url_valid?(url)          url  =  URI.parse(url)  rescue  false          url.kind_of?(URI::HTTP)  ||  url.kind_of?(URI::HTTPS)      end     end
  • 45. class  User  <  ActiveRecord::Base      validates  :link,  url:  true   end class  User  <  ActiveRecord::Base      validates  :link,  format:  {  with:          /(^$)|(^(http|https)://[a-­‐z0-­‐9]+([-­‐.]{1}[a-­‐z0-­‐9]+)*.[a-­‐z]{2,5}(([0-­‐9]{1,5})?/.*)?$)/ix      }   end https://coderwall.com/p/ztig5g/validate-urls-in-rails class  UrlValidator  <  ActiveModel::EachValidator      def  validate_each(record,  attribute,  value)          unless  url_valid?(value)              record.errors[attribute]  <<  (options[:message]  ||  "must  be  a  valid  URL")          end      end      #  a  URL  may  be  technically  well-­‐formed  but  may        #  not  actually  be  valid,  so  this  checks  for  both.      def  url_valid?(url)          url  =  URI.parse(url)  rescue  false          url.kind_of?(URI::HTTP)  ||  url.kind_of?(URI::HTTPS)      end     end
  • 46. def  query      Vote.connection.select_values  <<-­‐SQL          SELECT  voteable_id          FROM  votes          LEFT  OUTER  JOIN  authorships  ON  authorships.bill_id  =  voteable_id          LEFT  OUTER  JOIN  politicians  ON  politicians.id  =  politician_id          WHERE  voteable_type  =  'Bill'              AND  person_type  =  'User'              AND  votes.created_at  >=  now()  -­‐  interval  '90  days'              #{@condition.present??  "AND  #{@condition}"  :  ""}          GROUP  BY  voteable_id          ORDER  BY  count(*)  DESC  LIMIT  6;      SQL   end http://guides.rubyonrails.org/active_record_querying.html
  • 47. def  query      Vote.connection.select_values  <<-­‐SQL          SELECT  voteable_id          FROM  votes          LEFT  OUTER  JOIN  authorships  ON  authorships.bill_id  =  voteable_id          LEFT  OUTER  JOIN  politicians  ON  politicians.id  =  politician_id          WHERE  voteable_type  =  'Bill'              AND  person_type  =  'User'              AND  votes.created_at  >=  now()  -­‐  interval  '90  days'              #{@condition.present??  "AND  #{@condition}"  :  ""}          GROUP  BY  voteable_id          ORDER  BY  count(*)  DESC  LIMIT  6;      SQL   end def  query      query  =  Vote.select('voteable_id')          joins("LEFT  OUTER  JOIN  authorships  ON  authorships.bill_id  =  voteable_id").          joins("LEFT  OUTER  JOIN  politicians  ON  politicians.id  =  politician_id").          where(voteable_type:  'Bill',  person_type:  'User').          where("votes.created_at  >=  now()  -­‐  interval  '90  days'").          group('voteable_id').          order('count(*)  desc').          limit(6)      query  =  query.where(@condition)  if  @condition.present?      query   end http://guides.rubyonrails.org/active_record_querying.html
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.