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 org.joda.time.DateTime | |
import org.joda.time.Years | |
def calculateAgeInYears(int year, int monthOfYear, int dayOfMonth) { | |
def yob = new DateTime(year, monthOfYear, dayOfMonth, 0, 0).toDateMidnight() | |
def now = DateTime.now().toDateMidnight() | |
return Years.yearsBetween(yob, now).getYears() | |
} | |
def years = calculateAgeInYears(1983, 12, 10) |
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
/** | |
* I do this often enough to merit a Gist, but not often enough to remember by heart. Maybe someone else has the same problem. | |
* The ".mkstring" part can of course be altered to something else as needed, if you don't want a String | |
*/ | |
import scala.io.Source | |
val jsonMsg: String = Source.fromURL(getClass.getResource("/json/test1.json")).mkString |
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
#!/bin/sh | |
# When the error message says something to the effect of | |
# Offending ECDSA key in /Users/xxx/.ssh/known_hosts:52 | |
# Use the script like this: | |
# > rmhost 52 | |
# to remove line 52 from the known_hosts file | |
# NB! Naturally, make sure to KNOW that the key is ok to be removed. Like the warning says | |
# IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! |
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
<?xml version="1.0"?> | |
<!-- | |
This will convert itt-formatted subtitles to srt-formatted subtitles (or captions, if you prefer that) | |
Use it like so (using xsltproc in this example, feel free to use whatever engine you like): | |
# xsltproc itt-to-srt.xslt input_in_itt.itt > output_in_srt.srt | |
--> | |
<xsl:stylesheet version="1.0" | |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
xmlns:ttp="http://www.w3.org/ns/ttml#parameter" | |
xmlns:tt_feature="http://www.w3.org/ns/ttml/feature/" |
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
FROM hello-world | |
ARG FAKE_VALUE=DEFAULT | |
ENV FAKE_VALUE=$FAKE_VALUE |
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
version = "3.0.6" | |
maxColumn = 100 | |
importSelectors = singleLine | |
includeCurlyBraceInSelectChains = true | |
danglingParentheses.defnSite = true | |
danglingParentheses.callSite = true | |
danglingParentheses.ctrlSite = false |