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 NullOnEmptyConverterFactory : Converter.Factory() { | |
override fun responseBodyConverter(type: Type, annotations: Array<Annotation>, retrofit: Retrofit): Converter<ResponseBody, *> { | |
val delegate: Converter<ResponseBody, Any> = retrofit.nextResponseBodyConverter(this, type, annotations) | |
return Converter { body -> if (body.contentLength() == 0L) null else delegate.convert(body) } | |
} | |
} |
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
# Create a folder and write a simple script to open a file. | |
$> mkdir /Journal && cd /Journal && touch writer.sh && chmod u+rwx writer.sh` | |
# Here's `writer.sh` | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
#!/bin/zsh | |
# create a folder with today's date if it does not exist | |
folder=`date +%Y_%m_%d` | |
mkdir -p $folder |
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 class Ping { | |
private String message = ""; | |
public String getMessage() { | |
return message; | |
} | |
public void setMessage(String message) { | |
this.message = message; | |
} |
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
# Original script at https://gist.github.com/SamuelMarks/7961833 | |
# This one has a few more videos, though it might be a bit out of order. | |
""" | |
Simple algorithm to download all the egghead.io videos in highest-quality from YouTube. | |
Run from the directory you want the videos to appear. Renames them so that they have the video number + omit the repetitive "Egghead.io - AngularJS -" text. | |
Installing dependency: | |
$ pip install git+https://github.com/NFicano/pytube#egg=pytube | |
""" |
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
private static void printThreadInformation() { | |
ThreadGroup threadGroup = Thread.currentThread().getThreadGroup(); | |
ThreadGroup parent; | |
while ((parent = threadGroup.getParent()) != null) { | |
threadGroup = parent; | |
Thread[] threads = new Thread[threadGroup.activeCount()]; | |
threadGroup.enumerate(threads); | |
for (Thread thread : threads) { | |
String identity = thread.getThreadGroup().getName() + "::" + thread.getName(); | |
System.out.println(identity + ", Priority: " + thread.getPriority() + ", Daemon: " + thread.isDaemon()); |
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
// Before | |
@Id | |
@Column(name = "entity_id") | |
@GeneratedValue(generator = "system-uuid") | |
@GenericGenerator(name = "system-uuid", strategy = "uuid2") | |
private String entityId; | |
// After | |
@Id | |
@Column(name = "entity_id") |