Skip to content

Instantly share code, notes, and snippets.

@fylooi
fylooi / gist:07f79da3c7f02ad3b52ffc2ca6da303e
Last active December 7, 2018 04:45
ruby-self-signed-certificate
cert_dir = "#{Dir.pwd}/config/certs"
Dir.mkdir(cert_dir) unless File.exists?(cert_dir)
localhost_key = "#{Dir.pwd}/#{File.join('config', 'certs', 'localhost.key')}"
localhost_cert = "#{Dir.pwd}/#{File.join('config', 'certs', 'localhost.crt')}"
unless File.exist?(localhost_key)
def generate_root_cert(root_key)
root_ca = OpenSSL::X509::Certificate.new
root_ca.version = 2 # cf. RFC 5280 - to make it a "v3" certificate
# Camper: Sample Bot
#
# Enjoys moving around and firing powerful shots
class Fylooi < RTanque::Bot::Brain
NAME = 'fylooi'
include RTanque::Bot::BrainHelper
CORNERS = [:NW, :NE, :SE, :SW]
TURRET_FIRE_RANGE = RTanque::Heading::ONE_DEGREE * 1.0
SWITCH_CORNER_TICK_RANGE = (100..300)
# this class builds a Spree::CreditCard for saved payment
# from our existing user profile structure
class SpreeCreditCardBuilder
def self.create!(user)
new(user).create_without_validation!
end
def initialize(user)
@params = {}
# spree cc icons depend on downcased cc type
@fylooi
fylooi / gist:b704a26c1737d23eae0c
Last active August 29, 2015 14:09
fylooi's Rails set up on Windows

Objective

This file documents the steps required to set up a working Rails development environment on a Windows 8.1 machine.

Methods

Native development is feasible if you don't need cutting edge Ruby and gems. Windows support is second class when it comes to the latest version of a lot of gems. Some gems (eg. Unicorn) are not able to run on Windows.

Native

You will need to add the /bin directory to your PATH for every installation

Default stack: