Type | Description | Recommended Suffix | Sample Name | Sample Printed Value |
---|---|---|---|---|
Instant | A date-time without time-zone, fixed to UTC | timestamp | created_timestamp | 1970-01-01T00:00:00Z |
ZonedDateTime | A date-time with time-zone specified | date_time | start_date_time | 1970-01-01T00:00:00-06:00 |
LocalDate | A date without time-zone | date | birth_date | 2000-01-29 |
LocalTime | A time without time-zone | time | start_time | 08:34 AM |
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.time.LocalDate | |
import java.time.temporal.TemporalAdjusters | |
LocalDate localDate = LocalDate.now() | |
println localDate // 2016-04-12 | |
println localDate.plusMonths(1).withDayOfMonth(1) // 2016-05-01 | |
println localDate.minusMonths(1).with(TemporalAdjusters.lastDayOfMonth()) // 2016-03-31 |
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
// a config class with a default value | |
class LogConfig { | |
boolean logRequestBody = false | |
} | |
// in ratpack, the LogConfig is bound with a prefix of `/logging` | |
Ratpack.groovy { | |
bindings { | |
bindInstance(serverConfig.get('/logging', LogConfig)) | |
} |
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 groovy.json.JsonSlurper | |
dataSource { | |
// most properties are directly set | |
pooled = true | |
// ... | |
// the url is retrieved from etcd...make sure the etcd resource is properly protected | |
def jsonSlurper = new JsonSlurper() | |
def catalogUrlConfig = jsonSlurper.parseText(new URL("http://etcdlocation:2379/v2/keys/dataSource/url").text) |
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
#include <stdio.h> | |
#include <math.h> | |
#include <string.h> | |
#define NUMCARDS 9 | |
#define PRODUCTION 1 /** 0=debug-mode | 1=production mode **/ | |
int getCards(int *); | |
void displayCards(int *, int); | |
int getSuit(int codedNumber); |
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.lang.Math.ceil | |
import java.lang.Math.pow | |
import kotlin.math.log2 | |
fun main() { | |
println("\n Welcome to Up-To-9-Cards Game!") | |
println("\n================================\n") | |
displayCards(getCards()) | |
println("\n\nDone!\n") |
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 __future__ import print_function | |
from math import ceil, log | |
print("\n Welcome to Up-To-9-Cards Game!") | |
print("\n================================\n") | |
def get_cards(): | |
valid_count = 0 |
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
class Test { | |
void method1() { | |
println 'In method1' | |
} | |
void method1(String foo) { | |
println "In method1 with String param of $foo" | |
} | |
static method2(String foo) { |
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
/Applications/Arduino.app/Contents/Java/arduino-builder -dump-prefs -logger=machine -hardware /Applications/Arduino.app/Contents/Java/hardware -hardware /Users/dan/Library/Arduino15/packages -tools /Applications/Arduino.app/Contents/Java/tools-builder -tools /Applications/Arduino.app/Contents/Java/hardware/tools/avr -tools /Users/dan/Library/Arduino15/packages -built-in-libraries /Applications/Arduino.app/Contents/Java/libraries -libraries /Users/dan/Documents/Arduino/libraries -fqbn=adafruit:nrf52:feather52832:softdevice=s132v6,debug=l0 -vid-pid=0000_0000 -ide-version=10813 -build-path /var/folders/sc/42wc3xvs0jj_vp49xs3rvd8d5hhbjh/T/arduino_build_612855 -warnings=none -build-cache /var/folders/sc/42wc3xvs0jj_vp49xs3rvd8d5hhbjh/T/arduino_cache_42512 -prefs=build.warn_data_percentage=75 -prefs=runtime.tools.nrfjprog.path=/Users/dan/Library/Arduino15/packages/adafruit/tools/nrfjprog/9.4.0 -prefs=runtime.tools.nrfjprog-9.4.0.path=/Users/dan/Library/Arduino15/packages/adafruit/tools/nrfjprog/9.4.0 -prefs=runtime |
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
/* | |
The https://trails.morcmtb.org/ site has way too much crap that I don't care about. | |
I just want to quickly see what trails are open. | |
This is a cloudflare worker that hits the trails API and builds a concise HTML view of the conditions. | |
It could just be statically hosted javascript, but this was also an excuse to try out workers. | |
*/ | |
addEventListener("fetch", event => { | |
return event.respondWith(handleRequest()) | |
}) |