Skip to content

Instantly share code, notes, and snippets.

View davetron5000's full-sized avatar

David Copeland davetron5000

View GitHub Profile
class PublicClassPeopleUse
def initialize
# whatever
@real_instance = SetupOnly.new
end
def setup
after_setup_instance = @real_instance.setup
@real_instance = after_setup_instance
end
require "rspec"
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
mocks.verify_partial_doubles = true
end
end
Is it try that if P -> Q, then ~Q -> ~P always?
Let's see!
Background: A -> B is an abbreviation for ~A OR B. See https://mathworld.wolfram.com/Implies.html
| P | Q | ~P | ~Q | ~P OR Q = P->Q | ~~Q | ~~Q OR ~P = ~Q -> ~P | Same?
-----------------------------------------------------------------------
| T | T | F | F | F OR T = T | T | T OR F = T | ✅
| T | F | F | T | F OR F = F | F | F OR F = F | ✅
This is the error produced from a system test where the rails server raised an exception:
---
Traceback (most recent call last):
20: from /usr/dependencies-cache/bundler/ruby/2.7.0/gems/minitest-5.14.0/lib/minitest.rb:68:in `block in autorun'
19: from /usr/dependencies-cache/bundler/ruby/2.7.0/gems/minitest-5.14.0/lib/minitest.rb:138:in `run'
18: from /usr/dependencies-cache/bundler/ruby/2.7.0/gems/activesupport-6.0.2.2/lib/active_support/testing/parallelization.rb:74:in `start'
17: from /usr/dependencies-cache/bundler/ruby/2.7.0/gems/activesupport-6.0.2.2/lib/active_support/testing/parallelization.rb:74:in `map'
class BasicObject
def or_else(value, &block)
if self.nil?
if block.nil?
value
else
block.()
end
else
self
diff --git a/babel.config.js b/babel.config.js
index b8b230b..f930f3e 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -30,7 +30,6 @@ module.exports = function(api) {
{
forceAllTransforms: true,
useBuiltIns: 'entry',
- corejs: 3,
modules: false,
{
"name": "shine",
"private": true,
"dependencies": {
"@angular/common": "^4.2.4",
"@angular/compiler": "^4.2.4",
"@angular/core": "^4.2.4",
"@angular/forms": "^4.2.4",
"@angular/http": "^4.2.4",
"@angular/platform-browser": "^4.2.4",
@davetron5000
davetron5000 / verbose.rb
Created February 14, 2017 16:40
DRY Madness
# This is DRY run amok. There is no reason to create an abstraction around
# loading all the notes when we have it already: Note.all
# The private methods add no value.
class NotesController < ApplicationController
def index
load_notes
end
def show
load_note
{
"name": "shine",
"version": "0.0.1",
"license": "MIT",
"dependencies": {
"stats-webpack-plugin": "^0.2.1",
"webpack": "^1.9.11",
"webpack-dev-server": "^1.9.0",
"css-loader": "^0.23.1",
"file-loader": "^0.9.0",
class MarketResearch
# Assume we parsed some file or fetched an HTTP endpoint and
# got this JSON
DATA = [
{age: 19, smoker: false, income: 10_000, education: :high_school},
{age: 49, smoker: true, income: 120_000, education: :bachelors},
{age: 55, smoker: false, income: 400_000, education: :masters},
{age: 23, smoker: true, income: 10_000, education: :bachelors},
{age: 70, smoker: false, income: 70_000, education: :phd },