A collection of Git snippets.
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 android.content.Context | |
import android.content.SharedPreferences | |
import android.preference.PreferenceManager | |
fun Context.getDefaultSharedPreferences(): SharedPreferences { | |
return PreferenceManager.getDefaultSharedPreferences(this) | |
} | |
fun SharedPreferences.clear() { | |
edit().clear().apply() |
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
fun String.plural(size: Int): String { | |
val consonants = "bcdfghjklmnpqrstvwxz" | |
if (size > 1 && this.length > 2) { | |
if ((this.endsWith("o", true) || this.endsWith("s", true)) && | |
consonants.contains(this[this.length - 2], true)) { | |
return this + "es" | |
} | |
if (this.endsWith("y", true) && |
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 net.thauvin.erik.semver.Version; | |
@Version(major = 1, minor = 0, patch = 0, preRelease = "beta") | |
public class SemverExample { | |
// .. | |
} |
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 net.thauvin.erik.semver.Version; | |
@Version(properties = "version.properties") | |
public class SemverExample { | |
// ... | |
} |
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 net.thauvin.erik.semver.Version; | |
@Version(template = "version.mustache") | |
public class SemverExample { | |
// ... | |
} |
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.properties | |
version.major=1 | |
version.minor=0 | |
version.patch=0 | |
version.prerelease=beta |
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 net.thauvin.erik.kobalt.plugin.pom2xml.* | |
val bs = buildScript { | |
plugins("net.thauvin.erik:kobalt-pom2xml:") | |
} | |
val p = project { | |
name = "example" | |
group = "com.example" | |
artifactId = name |
A collection of Ubuntu snippets.
A collection of Linux snipets.
OlderNewer