This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Unless { | |
def unless[T](test:Boolean)(code: => T) = { if (!test) code } | |
} | |
import Unless._ | |
unless(seq.isEmpty) { | |
println("We gots us some stuff!") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PublicClassPeopleUse | |
def initialize | |
# whatever | |
@real_instance = SetupOnly.new | |
end | |
def setup | |
after_setup_instance = @real_instance.setup | |
@real_instance = after_setup_instance | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BasicObject | |
def or_else(value, &block) | |
if self.nil? | |
if block.nil? | |
value | |
else | |
block.() | |
end | |
else | |
self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
NewerOlder