Skip to content

Instantly share code, notes, and snippets.

function button(parent_id, params = {}) {
const container = document.getElementById(parent_id);
const options = {
type: 'standard',
theme: 'outline',
size: 'medium',
shape: 'pill',
...params,
async function on_response(response) {
if (response && response.credential) {
const rawdata = jwt_decode(response.credential);
const user = (({ email, family_name, given_name, picture, name }) => ({ email, family_name, given_name, picture, name}))(rawdata);
window.localStorage.setItem('gothic-id', 'loaded');
}
// leverage user object or move on to next step.
}
function onetap(cb) {
function _handle_prompt_events(event) {
if (event.isNotDisplayed()) {
if (event.getNotDisplayedReason() === 'suppressed_by_user') {
window.localStorage.removeItem('gothic-id');
cb('onetap-suppressed');
}
}
if (event.isSkippedMoment()) {
function authorize_api_usage(client_id, scope, user) {
return new Promise((res,rej) => {
const token_client = google.accounts.oauth2.initTokenClient({
client_id,
scope,
hint: user.email,
callback: (response) => {
if (!response.access_token) {
return rej('authorization-failed');
}
@bluejack
bluejack / lsync
Last active February 27, 2025 21:03
Sync local directory to S3 bucket
#!/bin/bash
## Conventions:
##
## Working directory has the same name as the s3 bucket.
## Script is executed from the parent of this directory.
##
#!/bin/bash
@bluejack
bluejack / gist:e98a931a6d2f1de17b8ca1f5db7bbd40
Created July 22, 2024 16:29
zsh function for removing local branches that are no longer in the remote repository
gitclean () {
for branch in `git branch -vv | grep ': gone]' | awk '{print $1}'`
do
git branch -D $branch
done
}