Skip to content

Instantly share code, notes, and snippets.

View davetron5000's full-sized avatar

David Copeland davetron5000

View GitHub Profile
@davetron5000
davetron5000 / Checkstyle pre-commit hook
Created December 18, 2008 02:40
Pre Commit Hook for running checkstyle on changed files
#!/usr/bin/perl
#
# Pre-commit hook for running checkstyle on changed Java sources
#
# To use this you need:
# 1. checkstyle's jar file somewhere
# 2. a checkstyle XML check file somewhere
# 3. To configure git:
# * git config --add checkstyle.jar <location of jar>
# * git config --add checkstyle.checkfile <location of checkfile>
object Unless {
def unless[T](test:Boolean)(code: => T) = { if (!test) code }
}
import Unless._
unless(seq.isEmpty) {
println("We gots us some stuff!")
}
@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
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 | ✅
#include <stdio.h>
/* vvv----pass a pointer to the int */
int doit(int *result) {
*result = 42; /* <-- change the value of it so the caller can see it */
return 1; /* return 0 for OK, and an error code if a failure happened */
}
int main(int argc, char **argv) {
int output = 0;
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,