Skip to content

Instantly share code, notes, and snippets.

View juandefelix's full-sized avatar

Juan Ortiz juandefelix

View GitHub Profile
@juandefelix
juandefelix / rails_app_facebook_login_guide.md
Last active February 6, 2024 22:44
Adding Facebook Login to a Rails application

Configuring a Rails app to use facebook sign in###

First of all: Im folliwing this tutorial from Rails Casts to do the implementation of facebook:

Creating the application: rails new facebook_oauth
Moving to the directory: cd facebook_oauth
Add the omniauth gem to your Gemfile: gem ‘omniauth’
In your terminal, run bundle

Create the file config/initializers/omniauth.rb and add:

@juandefelix
juandefelix / form-validator.js
Last active March 5, 2020 03:32 — forked from ksolo/form-validator.js
Form Validation
$(function(){
$("#target").submit(function(event){
event.preventDefault();
email = $("input[name='email']").val();
password = $("input[name='password']").val();
$('li').remove();
if (password.match(/\w{8}/) == null){
$("#errors").append("<li>Password must be at least 8 characters</li>");
@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.

@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 / 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)
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 / 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
@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 / carousel.js
Last active August 29, 2015 13:56 — forked from ksolo/carousel.js
Image Carousel