Skip to content

Instantly share code, notes, and snippets.

@grimmwerks
grimmwerks / gist:978b3323fa49fdfc966bac372d76fc48
Created November 22, 2017 07:26
rubymotion build error symlink error
Built with redpotion (potion new appname). I commented out cocoapods and motion-yaml thinking they were throwing the errors but still no love.
MaggotEater:raffle grimm$ rake
Ignoring bcrypt-3.1.11 because its extensions are not built. Try: gem pristine bcrypt --version 3.1.11
Ignoring bcrypt-ruby-3.0.1 because its extensions are not built. Try: gem pristine bcrypt-ruby --version 3.0.1
Ignoring bindex-0.5.0 because its extensions are not built. Try: gem pristine bindex --version 0.5.0
Ignoring binding_of_caller-0.7.3 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.3
Ignoring binding_of_caller-0.7.2 because its extensions are not built. Try: gem pristine binding_of_caller --version 0.7.2
Ignoring byebug-9.1.0 because its extensions are not built. Try: gem pristine byebug --version 9.1.0
Ignoring byebug-9.0.6 because its extensions are not built. Try: gem pristine byebug --version 9.0.6
@grimmwerks
grimmwerks / Delete from resource show
Created October 30, 2017 18:24
Active Admin Delete override
SQL (1.1ms) DELETE FROM "sensor_events" WHERE "sensor_events"."id" = $1 [["id", 334602]]
(0.5ms) COMMIT
Redirected to http://0.0.0.0:3000/admin/sensor_events
Completed 303 See Other in 37ms (ActiveRecord: 12.3ms)
Started GET "/admin/sensor_events" for 127.0.0.1 at 2017-10-30 14:21:57 -0400
Processing by Admin::SensorEventsController#index as */*
AdminUser Load (0.8ms) SELECT "admin_users".* FROM "admin_users" WHERE "admin_users"."id" = $1 ORDER BY "admin_users"."id" ASC LIMIT $2 [["id", 2], ["LIMIT", 1]]
Redirected to http://0.0.0.0:3000/admin/sensor_events/334602/edit
{
3 => "Rigo 1 strap brace",
2 => "Rigo 2 strap brace",
1 => "Rigo 3 strap brace"
}
class PatientInfoCell < PM::XLFormCell
include PatientInfoCellStylesheet
def on_load
apply_style :patient_info_cell
# Add subviews here, like so:
# append UILabel, :label_style_here
# -or-
@grimmwerks
grimmwerks / strap_cell.rb
Created March 30, 2016 04:27
Promotion XL Form cell attempt
class StrapCell < PM::XLFormCell
attr_accessor :position, :tension, :name
attr_accessor :strap_name, :strap_position, :strap_tension
include StrapCellStylesheet
def setup(data_cell, screen)
super
draw_cell
# mp self.methods.sort - Object.instance_methods
@grimmwerks
grimmwerks / base_product.rb
Created November 18, 2015 02:49
A base product where I'm allowing x amounts of location and feedback as enums and saved via bitmasking
class BaseProduct < ActiveRecord::Base
enum location: { unknown: 0, upper: 1, middle: 2, lower: 3}
enum feedback: { light: 1, vibration: 2}
# has_many :sensor_locations
has_many :products
def sensor_locations=(sensor_locations)
self.locations_mask = (sensor_locations & BaseProduct.locations.keys).map { |r| 2**BaseProduct.locations.keys.index(r) }.sum