Skip to content

Instantly share code, notes, and snippets.

View rnaud's full-sized avatar
🤷‍♂️
My computer is so slow it hertz.

Arnaud Ferreri rnaud

🤷‍♂️
My computer is so slow it hertz.
View GitHub Profile
@rnaud
rnaud / omniauth_callbacks_controller.rb
Created April 11, 2011 07:00
My Onmiauth callback controller.
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
skip_before_filter :beta
def facebook
@user = User.find_for_facebook_oauth(env["omniauth.auth"], current_user)
if @user
if @user.persisted?
flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Facebook"
@rnaud
rnaud / puzzle_solver.rb
Created February 21, 2011 00:29
I'm only finding a 6 card deck
require 'json'
class Array
def rotate n
a =dup
n.times do a << a.shift end
a
end
end
@rnaud
rnaud / checkgrid.html
Created February 20, 2011 14:43
Check the values given by asterix.js
<!doctype html>
<html>
<head>
<style>
#solution {
width: 600px;
margin: 0 auto;
}
@rnaud
rnaud / Game card 9.js
Created February 20, 2011 13:32
Logic problem
var unshift = Array.prototype.unshift;
var splice = Array.prototype.splice;
var grid = [];
var used = [];
var new_grid = [];
grid.push([{type:"p", head : 1},{type:"c", head : 1},{type:"a", head : 2},{type:"o", head : 2}]);
grid.push([{type:"o", head : 1},{type:"a", head : 2},{type:"c", head : 2},{type:"p", head : 1}]);
grid.push([{type:"c", head : 1},{type:"p", head : 2},{type:"o", head : 2},{type:"a", head : 1}]);
grid.push([{type:"p", head : 1},{type:"c", head : 2},{type:"o", head : 2},{type:"a", head : 1}]);