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
import com.squareup.javapoet.* | |
import java.util.* | |
import javax.lang.model.element.Modifier | |
private fun generateIndexOfTriple(typeName: TypeName): List<MethodSpec> { | |
val arrayTypeName = ArrayTypeName.of(typeName) | |
val indexOf4 = indexOf4(arrayTypeName, false) | |
val indexOf2 = indexOf2(arrayTypeName, indexOf4, false) | |
val lastIndexOf4 = indexOf4(arrayTypeName, true) | |
val lastIndexOf2 = indexOf2(arrayTypeName, lastIndexOf4, true) |
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
<?php | |
class EAN13render | |
{ | |
// These are the different barcode patterns for each digit (7 bit each). | |
// '1' represents a black line, '0' represents white (no line). | |
static $Rcodes = array('1110010', '1100110', '1101100', '1000010', '1011100', | |
'1001110', '1010000', '1000100', '1001000', '1110100'); | |
// The EAN13 defines three groups of bit patterns. |
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
package be.tjoener.test; | |
@SuppressWarnings("PointlessArithmeticExpression") | |
public final class Feistel { | |
/** | |
* Sets the number of rounds, security/speed trade-off | |
*/ | |
private static final int ROUNDS = 16; |
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
package com.example.demo; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import lombok.Data; | |
import lombok.Getter; | |
import lombok.NoArgsConstructor; | |
import org.hibernate.annotations.CreationTimestamp; | |
import org.springframework.boot.CommandLineRunner; | |
import org.springframework.boot.SpringApplication; | |
import org.springframework.boot.autoconfigure.SpringBootApplication; |
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
public final class Person { | |
private final String firstName; | |
private final String lastName; | |
private Person(String firstName, String lastName) { | |
this.firstName = firstName; | |
this.lastName = lastName; | |
} |
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
@Component | |
@Order(Ordered.HIGHEST_PRECEDENCE) | |
@SuppressWarnings({"unchecked", "rawtypes"}) | |
static final class StringToEnumConverterFactory implements ConverterFactory<String, Enum> { | |
@Override | |
public <T extends Enum> Converter<String, T> getConverter(Class<T> targetType) { | |
return new StringToEnum(getEnumType(targetType)); | |
} |
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
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; | |
public class LargestNumber | |
{ | |
public static void main(String[] args) | |
{ | |
String number = IntStream.range(1, 31) | |
.mapToObj(String::valueOf) |
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
using System.IO; | |
public static class Misc | |
{ | |
/// <summary> | |
/// Calculates the checksum on a v0.90 MD superblock. | |
/// Don't ask me why I needed it. | |
/// </summary> | |
/// <param name="filename"> |
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
public sealed class UnionFind<T> | |
{ | |
private sealed class Link<TLink> | |
{ | |
public TLink parent; | |
public int rank = 0; | |
public Link(TLink parent) | |
{ | |
this.parent = parent; |
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
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Linq; | |
namespace Util | |
{ | |
public struct Position | |
{ |