Skip to content

Instantly share code, notes, and snippets.

Avatar

Amos King adkron

View GitHub Profile
View game.rb
require "data_bank"
class Node < Struct.new(:question, :yes, :no)
def call(*)
puts question
answer = gets
case answer.chomp
when ?y
yes.call(self)
@adkron
adkron / keybase.md
Created Mar 21, 2014
Keybase Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am adkron on github.
  • I am adkron (https://keybase.io/adkron) on keybase.
  • I have a public key whose fingerprint is 0EF4 94DC 4EAC 0DD9 6E85 D961 2586 3FCD DEAA 32F9

To claim this, I am signing this object:

View bdd.rb
class Fifo
EmptyError = Class.new(Exception)
Node = Struct.new(:value, :next)
attr_accessor :size, :top
private :size=, :top=
def initialize
self.size = 0
View mailer.rb
class Email::Mailer < ActionMailer::Base
TIME_WITHOUT_ZONE_FORMAT = "%b %d, %Y at %I:%M %p"
include SendGrid
SendGrid::VALID_OPTIONS << :bcc
BCC_ALL = 'WebAdMIT <webadmitemails@academicsoftwareplus.com>'
include Email::Conversions
def email email, preview_address=nil
View connection.rb
module Scada
class Connection
attr_accessor :environment
private :environment, :environment=
def self.open(&block)
env = new
env.connect
block.call(env)
ensure
View statuses.rb
require "ffi"
module Scada
module ResultSet
class Statuses
include Enumerable
class Status < Struct.new(:id, :value, :condition, :error)
def to_s
if to_i == 0
"open"
View gen.html.slim
html
head
css:
* {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; text-decoration:none;}
span.running.off, span.manual_switch.manual, span.alarm_status.alarm, span.normally_closed_breaker.open {color:red;}
span.running.on, span.manual_switch.auto, span.alarm_status.normal, span.normally_closed_breaker.closed {color:green;}
a.tooltip:hover span{display:inline; position:absolute; border:1px solid #cccccc; background:#EEEE00; color:#6c6c6c;}
meta content=("text/html; charset=iso-8859-1 KW") http-equiv="Content-Type"
| <meta http-equiv="refresh" content="70";"gen.html"
meta content=("Microsoft FrontPage Express 2.0") name="GENERATOR"
View README.md

IrbAffirmations

Thanks to @tehviking and his 2014 Rubyconf talk. Sometimes when working on a C extension you sometimes need some affirmations in your irb. I've tried to provide that for him.

Installation

$ gem install irb_affirmations

View tournaments_controller.rb
class TournamentsController < ApplicationController
before_action :set_tournament, only: [:show, :edit, :update, :destroy]
before_action :authenticate_user!, only: :new
# GET /tournaments
# GET /tournaments.json
def index
@tournaments = Tournament.all
end
@adkron
adkron / blink.rb
Last active Aug 29, 2015
Opal Tessel
View blink.rb