Skip to content

Instantly share code, notes, and snippets.

class MeController < ApplicationController
before_action :authenticate
def show
end
end
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def authenticate
redirect_to :login unless user_signed_in?
end
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
<h1> Welcome, please login to continue </h1>
<a href="/auth/google_oauth2">Sign in with Google</a>
<% if current_user %>
<% current_user.attributes.each do |k, v| %>
<b><%= k %>:</b> <%= v %> <br>
<% end %>
<% end %>
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
def authenticate
redirect_to :login unless user_signed_in?
end
def current_user
@Carpetfizz
Carpetfizz / __init__.py
Created April 22, 2018 23:33
pytsp fixed
import numpy as np
import subprocess
import os
import math
template = """NAME: {name}
TYPE: TSP
COMMENT: {name}
DIMENSION: {n_cities}
EDGE_WEIGHT_TYPE: EXPLICIT
@Carpetfizz
Carpetfizz / # gazebo8 - 2019-05-28_06-44-45.txt
Created May 28, 2019 14:03
gazebo8 (osrf/simulation/gazebo8) on macOS 10.14.5 - Homebrew build logs
Homebrew build logs for osrf/simulation/gazebo8 on macOS 10.14.5
Build date: 2019-05-28 06:44:45