Skip to content

Instantly share code, notes, and snippets.

Avatar

Lukas Eder lukaseder

View GitHub Profile
@lukaseder
lukaseder / SimplifyThis.java
Last active Sep 8, 2020
SimplifyThis.java
View SimplifyThis.java
List<MappedTable> mappedTables1() {
if (mappedTables == null) {
mappedTables = T_BOOK
.getSchema()
.getTables()
.stream()
.map(t -> {
Table<?> l = lookupTable(t.getName());
return l == null ? null : new MappedTable().withInput(t.getName()).withOutput(l.getName());
})
View TwoMains.java
public class TwoMains {
public static void main(String[] args) {
System.out.println("main");
mаin(args);
}
public static void mаin(String[] args) {
System.out.println("other mаin");
}
}
View ListSurprise.java
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
public class ListSurprise {
public static void mаin(String[] args) {
System.setSecurityManager(new SecurityManager());
List<Integer> numbers = new ArrayList<>();
Collections.addAll(numbers, 3, 1, 4, 1, 5, 5, 9);
View gist:1bc2ea085a36d275b7e2df3f1ab1ce17
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import sun.misc.Unsafe;
View ApiDiff.java
/*
* Copyright (c) 2009-2015, Data Geekery GmbH (http://www.datageekery.com)
* All rights reserved.
*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
View Dafuq.java
import static java.lang.System.exit;
import static java.lang.System.out;
public class Dafuq {
/**
* This does not do what you think it does.
* <p>
* You think code is documentation? No! Documentation is code!
\u002a\u002f
View Dafuq.java
import static java.lang.System.*;
public class Dafuq {
public static void main(String[] args) {
/*
\u002a\u002f
\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u004e\u006f\u0022\u0029\u003b
\u000d\u000a\u0065\u0078\u0069\u0074\u0028\u0030\u0029\u003b
\u002f\u002a
View count-asterisk-vs-count-1-oracle.sql
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
View count-asterisk-vs-count-1-mysql.sql
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@lukaseder
lukaseder / count-asterisk-vs-count-1-postgres.sql
Created Sep 19, 2019
COUNT(*) vs COUNT(1) in PostgreSQL
View count-asterisk-vs-count-1-postgres.sql
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
You can’t perform that action at this time.