I hereby claim:
- I am benoitduffez on github.
- I am bduffez (https://keybase.io/bduffez) on keybase.
- I have a public key ASCGN0rZCXTbxEmeZTl7PnO9UFjMJpE-SrwMk4Zny0WxUQo
To claim this, I am signing this object:
import 'package:flutter_test/flutter_test.dart'; | |
extension Let<T extends Object> on T? { | |
R let<R>(R Function(T) callback, {R Function()? or}) { | |
var self = this; | |
if (self != null) { | |
return callback(self); | |
} | |
if (or != null) { | |
return or(); |
O let<I extends Object, O>( | |
I? value, | |
O Function(I) cb, | |
{O Function()? or}) { | |
if (value != null) { | |
return cb(value); | |
} | |
if (or != null) { | |
return or(); | |
} |
I hereby claim:
To claim this, I am signing this object:
/** | |
* This Google Sheets script keeps data in the specified column sorted any time | |
* the data changes. | |
* | |
* After much research, there wasn't an easy way to automatically keep a column | |
* sorted in Google Sheets, and creating a second sheet to act as a "view" to | |
* my primary one in order to achieve that was not an option. Instead, I | |
* created a script that watches for when a cell is edited and triggers | |
* an auto sort. | |
* |
#!/bin/bash | |
# Clean up on exit | |
function finish { | |
rm -f expected found | |
} | |
trap finish EXIT | |
# How to parse JSON | |
JQ="jq --sort-keys" |
#!/bin/sh | |
MYSQL="mysql" # add -u xyz -pabcd or export MYSQL_PWD, etc | |
echo "Init" | |
$MYSQL -e "drop database if exists test" | |
$MYSQL -e "create database test" | |
$MYSQL test -e 'delimiter $$ | |
create function func() returns int(10) | |
begin |
CREATE TABLE `agency` ( | |
transit_system VARCHAR(50) NOT NULL, | |
agency_id VARCHAR(100), | |
agency_name VARCHAR(255) NOT NULL, | |
agency_url VARCHAR(255) NOT NULL, | |
agency_timezone VARCHAR(100) NOT NULL, | |
agency_lang VARCHAR(100), | |
agency_phone VARCHAR(100), | |
agency_fare_url VARCHAR(100), | |
PRIMARY KEY (agency_id) |
#!/bin/bash | |
. mysql.ini | |
schema_url="https://raw.githubusercontent.com/mauryquijada/gtfs-mysql/master/gtfs-sql.sql" | |
mysqlexec="mysql -h $host -u $user -p${pass} $name" | |
datafolder="./data" | |
provider_url="http://www.data.gouv.fr/en/dataset/offre-transport-de-la-ratp-format-gtfs-ratp" | |
# List files that are available from the provider | |
files=`curl -s $provider_url | egrep -o 'data-url="[^"]+"' | awk -F\" '{print $2}'` |
watch -n 60 "curl -s https://play.google.com/store/devices?hl=en | tr '<' '\n' | tr '\240' ' ' | grep 'cover-image' | grep -oE 'alt=\"[^\"]+\"' | cut -c6\- | sed -e 's/.$//' | sort" |
public static String getDeltaDateText(Context context, Calendar date) { | |
final String formattedDate; | |
if (date != null && date.getTimeInMillis() > 10000) { | |
long delta = (new GregorianCalendar().getTimeInMillis() - date.getTimeInMillis()) / 1000; | |
if (delta < 60) { | |
formattedDate = context.getString(R.string.time_delay_moments); | |
} else if (delta < 3600) { | |
formattedDate = MessageFormat.format(context.getString(R.string.time_delay_minutes), (int) (delta / 60)); | |
} else if (delta < 3600 * 24) { | |
formattedDate = MessageFormat.format(context.getString(R.string.time_delay_hours), (int) (delta / 3600)); |