Skip to content

Instantly share code, notes, and snippets.

View juandefelix's full-sized avatar

Juan Ortiz juandefelix

View GitHub Profile
@juandefelix
juandefelix / index.html
Last active August 29, 2015 13:56 — forked from dbc-challenges/index.html
DBC Phase 2 Practice Assessment Part 3
<!doctype html>
<html>
<head>
<link rel="stylesheet" href="http://cdn.jsdelivr.net/normalize/2.1.0/normalize.css">
<link rel="stylesheet" href="main.css">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800">
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Lato:100,900">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/3.0.2/css/font-awesome.min.css">
</head>
@juandefelix
juandefelix / zoo.js
Last active August 29, 2015 13:56 — forked from dbc-challenges/zoo.js
//------------------------------------------------------------------------------------------------------------------
// YOUR CODE: Create your Zoo "object literal" and Animal "constructor" and "prototypes" here.
//------------------------------------------------------------------------------------------------------------------
function Animal (name, feet)
{
this.name = name;
this.feet = feet;
// this wasn't passing the last test,
@juandefelix
juandefelix / carousel.js
Last active August 29, 2015 13:56 — forked from ksolo/carousel.js
Image Carousel
@juandefelix
juandefelix / string_calculator.rb
Last active August 29, 2015 14:02
Calculator. This method calculates the result of the basic mathematical operations in a string
def calculator string
while string.match /[*\/]/
# p string
string.gsub!(/(\d+)\s*([*\/])\s*(\d+)/) do |regex|
num1 = $1.to_i
num2 = $3.to_i
operator = $2.to_sym
"#{[num1, num2].reduce(operator)}"
end
end
@juandefelix
juandefelix / 0.2.1-boggle_class_from_methods.rb
Last active December 27, 2015 22:39 — forked from dbc-challenges/0.2.1-boggle_class_from_methods.rb
phase 0 unit 2 week 1 boggle class challenge
class BoggleBoard
def initialize(board)
@board = board
end
def create_word(*coords)
coords.map {|coord| @board[coord.first][coord.last]}.join("")
end
503 git clone https://github.com/dbc-challenges/CLI-Obstacle-Course.git
504 ls
505 cd CLI*
506 ls
507 man ls
508 ls -al
509 mv images app/assets
510 ls
511 ls -al
512 cd app/views/static_files
@juandefelix
juandefelix / devise_email_confirmation_token_generation.md
Last active January 24, 2016 03:50
Devise email confirmation token generation

Mecanismo usado por Devise identificar un usuario por medio de un token para confirmar el email: Siguiendo este issue, vemos cómo podemos generar un token para la transacción. El código

Devise.token_generator.generate(class, column)

genera un token encriptado único para una instancia de la clase class y devuelve el token encriptado y sin encriptar. El token sin encriptar se envía en el link del email. Al acceder a este link, Devise comprobará qué instancia de Order contiene un token encriptado correspondiente al token del link así:

  def generate_confirmation_token
 raw, enc = Devise.token_generator.generate(self.class, :confirmation_token)
@juandefelix
juandefelix / osx-10.10-setup.md
Created March 4, 2016 22:19 — forked from kevinelliott/osx-10.10-setup.md
Mac OS X 10.10 Yosemite Setup

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

@juandefelix
juandefelix / README.md
Last active June 15, 2016 04:21
Implements a method that flattens a nested array, based on recursion.

my_flatten

Implements a method that flattens a nested array, based on recursion.
Includes several tests that check the method behavior with different arrays.