Skip to content

Instantly share code, notes, and snippets.

View Main
import java.util.List;
sealed interface ListState {}
interface Empty extends ListState { }
interface NonEmpty extends ListState { }
class MyList<ListStatus,E> {
public List<E> getDelegate() {
return delegate;
}
View Untitled.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Whiskey.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View HousePrices.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View keybase.md

Keybase proof

I hereby claim:

  • I am paulk-asert on github.
  • I am paulk_asert (https://keybase.io/paulk_asert) on keybase.
  • I have a public key whose fingerprint is 3444 1E50 4A93 7F43 EB0D AEF9 6A65 176A 0FB1 CD0B

To claim this, I am signing this object:

View keybase.md

Keybase proof

I hereby claim:

  • I am paulk-asert on github.
  • I am paulk_asert (https://keybase.io/paulk_asert) on keybase.
  • I have a public key whose fingerprint is CBCC A1D2 E040 C571 9368 5C76 976A 7A21 D768 D38B

To claim this, I am signing this object:

View gist:ed2f25035f621248ced8
Index: src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>windows-1252
===================================================================
--- src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java (revision 03d9c2673947d44cd01cf1e3ec5bf32459e0b39c)
+++ src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java (revision )
@@ -25,6 +25,7 @@
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.FirstParam;
View gist:5d0ab5c91db3b32cfb22
@groovy.transform.TypeChecked
def myMethod() {
def s = 'The 3 quick\nbrown 4 fox'
def expected = 'The _ QUICK|brown _ FOX|'
def result = ''
new StringReader(s).splitEachLine(~/\d/){ result += "${it[0]}_${it[1].toUpperCase()}|" }
assert result == expected; result = ''
new StringReader(s).splitEachLine(~/\d/){ parts -> result += "${parts[0]}_${parts[1].toUpperCase()}|" }
assert result == expected; result = ''
new StringReader(s).splitEachLine(~/\d/){ List parts -> result += "${parts[0]}_${parts[1].toUpperCase()}|" }
View StructuralTyping.groovy
import groovy.transform.TypeChecked
interface ReadOnlyCollection {
boolean contains(Object o)
boolean isEmpty()
}
@TypeChecked(extensions='StructuralProvider.groovy')
def method() {
def list = ['cat', 'dog']
View StructuralProvider.groovy
import org.codehaus.groovy.ast.expr.*
incompatibleAssignment { lhsType, rhsType, expr ->
if (!(expr instanceof DeclarationExpression)) return
Expression orig = expr.rightExpression
def ce = new CastExpression(lhsType, orig)
ce.coerce = true
expr.setRightExpression(ce)
storeType(expr, lhsType)
handled = true