This file contains hidden or 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
| /** | |
| * Simple program to use -verbose:class | |
| */ | |
| public class Hello { | |
| public static void main(final String[] args) { | |
| System.out.println("Hello, world!"); | |
| } | |
| } | |
| /* |
This file contains hidden or 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.*; | |
| /** | |
| * Hello, world! program using Optional monad | |
| */ | |
| public class HelloWorld { | |
| public static void main(final String[] args) { | |
| Optional.of("Hello, world!").ifPresent(System.out::println); | |
| } | |
| } |
This file contains hidden or 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 works but requires four lines of code | |
| function wrong() { | |
| if (Math.random() > 0.5) | |
| return true | |
| else | |
| return false; | |
| } | |
| // Same result in a single line of code | |
| function right() { |
This file contains hidden or 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 List<String> imperative(List<String> terms) { | |
| List<String> result = new ArrayList<String>(terms.size()); | |
| for(term : terms) { | |
| if(term.length > 3) { | |
| restult.add(term.toUpperCase()); | |
| } | |
| } | |
| return result; |
This file contains hidden or 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 * as Immutable from 'immutable'; | |
| interface Place { | |
| country: string; | |
| stateOrProvince: string; | |
| city: string; | |
| } | |
| const list: Immutable.List<Place> = Immutable.List<Place>([ | |
| {country: 'USA', stateOrProvince: 'Michigan', city: 'Petoskey'}, |
This file contains hidden or 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
| const serviceUuid = 0xFFE0, characteristicUuid = 0xFFE1; | |
| document.addEventListener('DOMContentLoaded', () => { | |
| document.getElementById('connect').addEventListener('click', (event) => { | |
| event.target.style.display = 'none'; | |
| navigator.bluetooth.requestDevice({ | |
| filters: [{name: 'HMSoft', services: [serviceUuid]}], | |
| }).then((device) => { | |
| document.getElementById('form').style.display = 'block'; |
This file contains hidden or 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
| const luhn: (candidate: string) => boolean = (candidate: string) => | |
| parseInt(candidate[candidate.length - 1]) === candidate. | |
| slice(0, candidate.length - 1). | |
| split(''). | |
| map((c: string) => parseInt(c)). | |
| reverse(). | |
| map((n: number, index: number) => index % 2 === 0 ? 2 * n : n). | |
| map((n: number) => n > 9 ? n - 9 : n). | |
| reduce((a: number, b: number) => a + b) | |
| * 9 % 10 |
This file contains hidden or 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
| body { | |
| border-top: solid 10px; | |
| border-image: repeating-linear-gradient( -75deg, yellow, yellow 10px, black 10px, black 20px) 20; | |
| } |
This file contains hidden or 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
| const path = require('path'); | |
| module.exports = function override(config, env) { | |
| config.plugins.find(plugin => plugin.constructor.name === 'ForkTsCheckerWebpackPlugin').memoryLimit = 4096; | |
| return config; | |
| }; |
This file contains hidden or 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
| #!/bin/bash | |
| jshell -<<EOF | |
| System.out.println("Hello, world!"); | |
| /exit | |
| EOF |