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
with vars as (select | |
date_trunc('hour', localtimestamp - | |
'24 hours'::interval) as start, -- how far back to start the chart | |
'30 minutes'::interval as bin_width -- width of time slices | |
), | |
data as ( | |
select | |
created_at as "timestamp", -- column to use as timestamp of the record | |
1 as "value" -- use 1 to just count records, or specify a column to aggregate (by sum currently, can be changed below) | |
from users -- table to query; can add where clause here to restrict results |
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
#! /usr/bin/env zsh | |
[[ -n $1 ]] || { echo "Usage: $(basename $0) <gem_name>"; exit 1; } | |
url=$(gem info $1 | sed -En '/ *Homepage: (.*)/{s//\1/p; q;}') | |
[[ -n $url ]] || { echo "Couldn't find homepage for $1"; gem info $1; exit 2; } | |
echo "Opening $url" | |
open $url # if not using macOS, replace open with xdg-open or whatever |
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/sh | |
STAGED_FILES=$(git diff-index HEAD --name-only --cached) | |
if [[ -z $STAGED_FILES ]] | |
then | |
exit # no staged files, no need to run rubocop | |
fi | |
# Checks if any staged files have unstaged changes | |
# otherwise rubocop isn't running on what is actually |
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 SwiftUI | |
typealias IsLoadingBool = Bool // To help remember which way the bool goes (false means ready to display) | |
protocol LoadedView { | |
func load() -> Binding<IsLoadingBool> | |
} | |
// LoadingView is an existing full-screen UIView in my codebase. | |
// This could be replaced by any custom View |
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
if [ -d "$2" ]; then | |
( set -x | |
tar -cz "$2" | keybase encrypt -bs $1 -o "$2".tgz.gpg | |
) | |
elif [ -f "$2" ]; then | |
( set -x | |
keybase encrypt -bs $1 $2 | |
) | |
else | |
echo "Usage: encrypto keybaseuser path" |
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
/** | |
* Copyright 2015 SmartThings | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at: | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | |
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License |
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
/** | |
* Copyright 2015 SmartThings | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at: | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | |
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License |
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
/** | |
* Copyright 2015 SmartThings | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
* in compliance with the License. You may obtain a copy of the License at: | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed | |
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License |
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
/** | |
* Aeon Siren with Sound Commands + revert to default | |
* | |
* Author: SmartThings | |
* Date: 2014-07-15 | |
*/ | |
metadata { | |
definition (name: "Aeon Siren", namespace: "smartthings", author: "SmartThings") { | |
capability "Actuator" | |
capability "Alarm" |
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
metadata { | |
// Automatically generated. Make future change here. | |
definition (name: "Accessory Switch", namespace: "mckeed", author: "Duncan") { | |
capability "Switch" | |
capability "Switch Level" | |
capability "Sensor" | |
command "associate" | |
fingerprint deviceId: "0x12" |
NewerOlder