Skip to content

Instantly share code, notes, and snippets.

View davidxkr's full-sized avatar

David Madrigal davidxkr

  • ArcusFi
  • Colima, Mexico
View GitHub Profile
@davidxkr
davidxkr / 0_reuse_code.js
Created May 12, 2016 14:01
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davidxkr
davidxkr / a
Last active August 29, 2015 14:17
[
{"header": "Datos Personales",
"key": "barcodeReader", "title": "Presiona aquí para leer el código de barras de la credencial", "action": "openCamera:"},
.primary-form{
width: 1000px;
}
RailsSettings::Settings::SettingNotFound in Admin::ConfigurationsController#update
Setting variable "footer_image" not found
Rails.root: /Users/david_xkr/proyectos/pp_peru
Application Trace | Framework Trace | Full Trace
lib/image_creator.rb:36:in `upload_images'
app/controllers/admin/configurations_controller.rb:37:in `upload_style_images'
app/controllers/admin/configurations_controller.rb:15:in `update'
Request
The n^(th) term of the sequence of triangle numbers is given by, t_(n) = ½n(n+1); so the first ten triangle numbers are:
1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ...
By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the word value for SKY is 19 + 11 + 25 = 55 = t_(10). If the word value is a triangle number then we shall call the word a triangle word.
implement the ruby code than answer the last question ?
Using the next file: words.txt a 16K text file containing nearly two-thousand common English words, how many are triangle words?

#Question 3# ##Problem overview##

On May 18, 2006 Jeff Atwood from http://www.codinghorror.com/blog/ said:

I'm often asked why the book Refactoring isn't included in my recommended developer reading list. Although I own the book, and I've read it twice, I felt it was too prescriptive-- if you see (x), then you must do (y). Any programmer worth his or her salt should already be refactoring aggressively. It's so essential to the craft that if you have to read a book to understand how it works, you probably shouldn't be a programmer in the first place.

There's nothing wrong with codifying refactoring guidelines in a book. But the most important guideline is to watch for warning signs in your own code-- so called "code smells". ##Now, this is what you have do to##

require 'benchmark'
class Euler14Recursive
def initialize
@chain_size = 0
end
def euler_chain_recursive(number)
@chain_size += 1
class SM1
def initialize
file = File.exists?('dev.log') ? File.open('dev.log', 'a') : File.new('dev.log', 'a')
file << 'Just creating ' + self.class.to_s + "\n"
end
end
class SM2
def initialize
#Feedback from "El gran pregunton" !!!!
# Es posible que no haya quedado muy claro el problema
# ya que calculas el primer numero triangular que "Acumula" 500 divisores
#
def triangle_num
cont = 0 #Puedes ahorrarte estas cuatro lineas con "Asignación paralela" "cont, n, i, tri = 0, 0, 0, 0"
n = 0
i = 0
#Feedback from "El Gran pregunton" !!!!
# Podemos ver que entendiste bien la idea
# Por otro lado es posible refactorizar tu codigo de la siguiente manera
i = 1
y=0
x=1 # estas tres asignaciones pueden ser en una sola linea "Asignación paralela" i,y,x = 1,0,1
while i=1 do # Recuerda i == 1