The state_machines
gem allows you to conditionally define methods based on particular states (i.e. values of an attribute):
class Vehicle
state_machine :alarm_state do
state :active do
def disable_alarm!
end
class Counter | |
attr_reader :thing | |
def initialize(thing) | |
@thing = thing | |
end | |
# The `number` argument's default is an expression that | |
# the will be evaluated in the context of the instance. | |
def print(number: thing.length) |
FROM rocker/shiny:4.0.3 | |
ENV RENV_VERSION 0.12.5-2 | |
RUN \ | |
# Ensure shiny-server is run as the shiny user: | |
sed -i 's/exec/exec s6-setuidgid shiny/g' /etc/services.d/shiny-server/run && \ | |
# Remove all the examples: | |
rm -r /srv/shiny-server && \ | |
# Install Renv: |
require 'active_support/all' | |
require 'parquet' # with CentOS7 dependencies as per https://arrow.apache.org/install/ | |
data = { | |
'a_string' => ['hello world'], | |
'an_int' => [1], | |
'a_float' => [1.23], | |
'a_date' => [Date.today], | |
'a_time' => [Time.now.change(usec: 0)] # there's a precision limit... | |
} |
# Added to support Oracle on Rails 6. | |
# See: https://github.com/rsim/oracle-enhanced/issues/2023 | |
original = ActiveRecord::Relation.instance_method(:delete_all).source | |
unless Digest::MD5.hexdigest(original) == '89a3e7c95873d278263c3d288a6cc242' | |
raise 'Please re-verify oracle_delete_all_shim.rb - method appears to have changed!' | |
end | |
module ActiveRecord |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
# gem "rails", "5.2.2.1" # FAILS | |
# gem "sqlite3", "~> 1.3.6" |
ActionDispatch::IntegrationTest.class_eval do | |
# Attempts a test up to 3x before allowing it to fail / error. | |
def run | |
attempts_remaining = 3 | |
previous_failure = failures.last | |
flakey_failures = [] | |
loop do | |
break if attempts_remaining < 1 |
#!/usr/bin/env ruby | |
# frozen_string_literal: true | |
require "bundler/inline" | |
gemfile(true) do | |
source "https://rubygems.org" | |
# gem "rails", "5.2.3" # WORKS | |
# gem "sqlite3" |
diff --git a/tensorflow/tensorflow.bzl b/tensorflow/tensorflow.bzl | |
index cad5de1..1cfcbbd 100644 | |
--- a/tensorflow/tensorflow.bzl | |
+++ b/tensorflow/tensorflow.bzl | |
@@ -367,7 +367,7 @@ def tf_cc_shared_object( | |
srcs = [], | |
deps = [], | |
data = [], | |
- linkopts = [], | |
+ linkopts = ['-lrt'], |
<style type="text/css" media="screen"> | |
div { | |
position: absolute; | |
top: 0px; | |
left: 0px; | |
background-color: black; | |
background-blend-mode: multiply; | |
opacity: 0.1; | |
} |