Skip to content

Instantly share code, notes, and snippets.

View onethirtyfive's full-sized avatar

Joshua Morris onethirtyfive

View GitHub Profile
@onethirtyfive
onethirtyfive / sensor-light.yaml
Created April 21, 2024 16:28 — forked from Blackshome/sensor-light.yaml
Home Assistant Sensor Light that can be used in Blueprints
blueprint:
name: Sensor Light
description: >
# 💡 Sensor Light
**Version: 6.5**
Your lighting experience, your way - take control and customize it to perfection! 💡✨
@onethirtyfive
onethirtyfive / keybase.md
Created February 7, 2021 11:36
keybase.md

Keybase proof

I hereby claim:

  • I am onethirtyfive on github.
  • I am onethirtyfive (https://keybase.io/onethirtyfive) on keybase.
  • I have a public key whose fingerprint is AB42 5AB2 8DD7 9A67 27AA 2CFE FF30 B1CA 93CB 1225

To claim this, I am signing this object:

class Base
A_VALUE = 2
def foo
end
end
module Refiner
refine Base do
def foo
old_value = super
@onethirtyfive
onethirtyfive / keybase.md
Created September 15, 2016 20:26
keybase.md

Keybase proof

I hereby claim:

  • I am onethirtyfive on github.
  • I am onethirtyfive (https://keybase.io/onethirtyfive) on keybase.
  • I have a public key whose fingerprint is AB42 5AB2 8DD7 9A67 27AA 2CFE FF30 B1CA 93CB 1225

To claim this, I am signing this object:

@onethirtyfive
onethirtyfive / provider_example.js
Created August 25, 2011 17:44 — forked from mbbx6spp/provider_example.js
Illustration of provider idiom in Javascript for sharing with fellow Code PaLOUsa 2011 conference attendee from this morning #CPL11
/*
* Javascript provider idiom illustrated
* @author Susan Potter
* @date 2011-01-28
*/
// FinEnv "interface"
var FinEnv = function () {
return {
println: function (output) {
letters = ['a', 'b', 'c', 'd']
letters.each do |letter|
puts letter
end
=> prints each letter. easy.
# below, '' is an empty string.
# result_string is initially '', the argument passed to inject.
@onethirtyfive
onethirtyfive / gist:1141150
Created August 12, 2011 00:17
Grape presenters?
# lib/api/presenters/detailed_post.rb
module API
module Presenters
class DetailedPost
include ActiveModel::Serializers::JSON
include ActiveModel::Serializers::Xml
attr_accessor :post
delegate :attributes, :to => :post
source 'http://rubygems.org'
RAILS_VERSION = '~> 3.1.0.rc4'
DM_VERSION = '~> 1.1.0'
RSPEC_VERSION = '~> 2.6.0'
CUCUMBER_VERSION = '~> 1.0.0'
gem 'activesupport', RAILS_VERSION, :require => 'active_support'
gem 'actionpack', RAILS_VERSION, :require => 'action_pack'
gem 'actionmailer', RAILS_VERSION, :require => 'action_mailer'
@onethirtyfive
onethirtyfive / gist:1083182
Created July 14, 2011 19:06
Class-Table Inheritance Meta-model for DataMapper
# This example is an alternative to implementing polymorphic associations
# using an ActiveRecord-esque 'type' column. In this model, there are many
# 'units.' Unit is an abstract supertype. Descendants are modeled referencing
# a unit by 'unit_id', a foreign key to the primary key in the units model.
# Note: This approach maintains referential integrity in the database via
# descendants' FK to unit.id; however, it is the application's responsibility
# to ensure that no two descendants reference the same unit. This is an
# intrinsic limitation of the "Class Table Inheritance" approach, but it's
# a lot better than maintaining "type" data that is opaque to the data store.
@onethirtyfive
onethirtyfive / gist:1079730
Created July 13, 2011 04:42
How to query this database with DM query language?
Here's the relevant part of the schema, simplified, showing relations:
CREATE TABLE "units" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" VARCHAR(50)
);
CREATE TABLE "champions" (
"unit_id" INTEGER NOT NULL,
"title" VARCHAR(50),