Skip to content

Instantly share code, notes, and snippets.

View adkron's full-sized avatar

Amos King adkron

View GitHub Profile
class TornamentsController < ApplicationController
before_action :authenticate_user!, only: [:new, :edit, :update, :destroy]
before_action :set_tornament, only: [:show, :edit, :update, :destroy]
respond_to :html
def index
@tornaments = Tornament.all
respond_with(@tornaments)
end
require "test_helper"
describe TornamentsController do
let(:tornament) { tornaments :one }
it "gets index" do
get :index
assert_response :success
assert_not_nil assigns(:tornaments)
require "test_helper"
describe TornamentsController do
let(:tornament) { tornaments :one }
it "gets index" do
get :index
assert_response :success
assert_not_nil assigns(:tornaments)
var tessel = require('tessel');
var rfidlib = require('rfid-pn532');
var http = require('http');
var querystring = require('querystring');
var rfid = rfidlib.use(tessel.port['A']);
rfid.on('ready', function (version) {
@adkron
adkron / blink.rb
Last active August 29, 2015 14:13
Opal Tessel
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

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

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"
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"
module Scada
class Connection
attr_accessor :environment
private :environment, :environment=
def self.open(&block)
env = new
env.connect
block.call(env)
ensure