Skip to content

Instantly share code, notes, and snippets.

View whirlwin's full-sized avatar

Øyvind Ødegård whirlwin

View GitHub Profile

Keybase proof

I hereby claim:

  • I am whirlwin on github.
  • I am whirlwin (https://keybase.io/whirlwin) on keybase.
  • I have a public key ASAHf7FG0pWrwmFize6hIMSTeUhxXCkubnn0Q30mlMo4SQo

To claim this, I am signing this object:

@whirlwin
whirlwin / VavrOptionalExample.java
Created July 28, 2017 09:15
vavr-optional-example
// Imperativt
Person person = new Person("John Doe");
Optional<Person> maybePerson = getPersonFromCache(); // Option<Person>
if (!maybePersonFromCache.isPresent()) {
Optional<Person> maybePersonFromRepo = getPersonFromRepo();
if (!maybePersonFromRepo.isPresent()) {
Optional<Person> maybePersonFromApi = getFromAPI();
if (maybePersonFromApi.isPresent()) {
person = person.get();
}
@whirlwin
whirlwin / gist:5347275
Created April 9, 2013 16:41
footballmanagement.ecore
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="footballmanagement" nsURI="http://footballmanagement/1.0" nsPrefix="footballmanagement">
<eClassifiers xsi:type="ecore:EClass" name="Individual" abstract="true">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="firstName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="surName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="salary" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDouble"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Coach" eSuperTypes="#//Individual">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="experience" eType="ecore:EDataType http://www.ecli
<?xml version="1.0" encoding="UTF-8"?>
<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmi:id="_USSIMKEVEeKbCZIuEpFUWA" type="EcoreTools" name="footballmanagement" measurementUnit="Pixel">
<children xmi:type="notation:Node" xmi:id="_cIG_gKEWEeKbCZIuEpFUWA" type="1001">
<children xmi:type="notation:Node" xmi:id="_cII0sKEWEeKbCZIuEpFUWA" type="4001"/>
<children xmi:type="notation:Node" xmi:id="_cII0saEWEeKbCZIuEpFUWA" type="5001">
<children xmi:type="notation:Node" xmi:id="_WTgioKEhEeKbCZIuEpFUWA" type="2001">
<element xmi:type="ecore:EAttribute" href="footballmanagement.ecore#//FootballTeam/name"/>
<layoutConstraint xmi:type="notation:Location" xmi:id="_WTgioaEhEeKbCZIuEpFUWA"/>
</children>
<children xmi:type="notation:Node" xmi:id="_nnhoIKEhEeKbCZIuEpFUWA" type="2001">
@whirlwin
whirlwin / anagram-solver.rb
Created May 7, 2012 21:07
Simple Ruby script for finding anagrams within a list of words
# encoding: utf-8
# Simple Ruby script for finding anagrams in a list
# Tested with ruby 1.9.3
words = ['alt', 'altfor', 'andre', 'at', 'bar', 'bra', 'bry', 'byr', 'dem',
'den', 'denne', 'dra', 'drev', 'drikke', 'dro', 'ende', 'enden', 'engang',
'ens', 'etter', 'gangen', 'gift', 'gikk', 'gilde', 'hellestein', 'hun', 'hus',
'kisten', 'krok', 'lovt', 'lysnet', 'lysten', 'løst', 'med', 'mor', 'navn',
'ned', 'nede', 'niste', 'ord', 'ordet', 'rad', 'rette', 'ristet', 'rod', 'rokk',