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/bash -euo pipefail | |
if [ ${#} -eq 0 ] | |
then | |
# read from STDIN | |
MAYBE_GIT_HASH=$( cat ) | |
else | |
MAYBE_GIT_HASH="${1}" | |
fi |
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/bash -euo pipefail | |
if [ ${#} -eq 0 ] | |
then | |
# read from STDIN | |
DATE=$( cat ) | |
else | |
DATE="${1}" | |
fi |
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/bash -euo pipefail | |
# When we increment TW_BUNDLE_SHORT_VERSION_STRING | |
# also update TW_BUNDLE_SHORT_VERSION_DATE to the current date/time | |
# we don't have to be very exact, but it should be updated at least | |
# once every 18 months because iTunes requires that a CFBundleVersion | |
# be at most 18 characters long, and DECIMALIZED_GIT_HASH will be | |
# at most 10 characters long. Thus, MINUTES_SINCE_DATE needs to be | |
# at most 7 characters long so we can use the format: | |
# ${MINUTES_SINCE_DATE}.${DECIMALIZED_GIT_HASH} |
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/bash -euo pipefail | |
if [ ${#} -eq 0 ] | |
then | |
# read from STDIN | |
MAYBE_CFBUNDLEVERSION=$( cat ) | |
else | |
MAYBE_CFBUNDLEVERSION="${1}" | |
fi |
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.reflect.Constructor; | |
import java.lang.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Objects; | |
import javax.annotation.Nonnull; |
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 launchBrowser(context: Context, uri: Uri?) { | |
val browserIntent = Intent(Intent.ACTION_VIEW).apply { data = uri } | |
val browseActivities = context.packageManager.queryIntentActivities(browserIntent, PackageManager.MATCH_DEFAULT_ONLY) | |
for (info in browseActivities) { | |
if (info.activityInfo.packageName != context.packageName) { | |
browserIntent.setPackage(info.activityInfo.packageName) | |
try { | |
context.startActivity(browserIntent) | |
break | |
} catch (e: ActivityNotFoundException) { |
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 AssertFailsWith { | |
public interface RunnableThatThrows { | |
void run() throws Throwable; | |
} | |
public static <T extends Throwable> void assertFailsWith(Class<T> throwableClass, RunnableThatThrows runnable) { | |
try { | |
runnable.run(); | |
fail(); | |
} catch (Throwable throwable) { | |
assertTrue(throwableClass.isInstance(throwable)); |
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.icu.text.CompactDecimalFormat; | |
import androidx.test.runner.AndroidJUnit4; | |
import org.junit.Test; | |
import org.junit.runner.RunWith; | |
import java.util.Locale; | |
import static org.junit.Assert.assertEquals; | |
@RunWith(AndroidJUnit4.class) | |
public class CompactDecimalFormatTest { |
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
/* | |
Moves moving_id after reference_id by finding the next row after | |
reference_id and setting moving_id.sort to be the midpoint of | |
reference_id.sort and next_reference_id.sort | |
*/ | |
UPDATE subscription | |
SET sort = ( | |
CASE WHEN ( | |
/* | |
Get the first sort value after the reference_id |
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" encoding="UTF-8"?> | |
<opml version="1.0"> | |
<head> | |
<title>Heath's C, Java, Apple, and Android feeds</title> | |
</head> | |
<body> | |
<outline text="C" title="C"> | |
<outline type="rss" text="zeuxcg.org" title="zeuxcg.org" xmlUrl="http://zeuxcg.org/feed/" htmlUrl="http://zeuxcg.org"/> | |
<outline type="rss" text="Krister Walfridsson’s blog" title="Krister Walfridsson’s blog" xmlUrl="http://kristerw.blogspot.com/feeds/posts/default" htmlUrl="https://kristerw.blogspot.com/"/> |
NewerOlder