Skip to content

Instantly share code, notes, and snippets.

@clayallsopp
clayallsopp / gist:f372530d2e4459fd9d031d56106306b0
Created August 28, 2025 14:47
Shell functions for worktrees
# S/o @amazure
# https://plaidchat.slack.com/archives/C08DR1W3P4Y/p1750771726729969?thread_ts=1750699090.902789&cid=C08DR1W3P4Y
gwtb() {
if [ $# -ne 1 ]; then
echo "Usage: gwtb <worktree_dir>"
return 1
fi
local WORKTREE_NAME="$1"
local BRANCH_NAME="$USER-$WORKTREE_NAME"
**/*.{js,_js,bones,es,es6,frag,gs,jake,jsb,jscad,jsfl,jsm,jss,mjs,njs,pac,sjs,ssjs,xsjs,xsjslib,jsx,ts,tsx,json,json5,geojson,JSON-tmLanguage,topojson,css,pcss,postcss,less,scss,graphql,gql,md,markdown,mdown,mdwn,mkd,mkdn,mkdown,ron,workbook,vue}
#!/usr/bin/env bash
set -o xtrace -o errexit -o pipefail -o nounset
########################################################################################
# CircleCI's current recommendation for roughly serializing a subset
# of build commands for a given branch
#
# circle discussion thread - https://discuss.circleci.com/t/serializing-deployments/153
# Code from - https://github.com/bellkev/circle-lock-test
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testappmaster"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.testapp"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="22" />
import { GraphQLIncludeDirective, GraphQLSkipDirective } from 'graphql/type/directives';
const schema = new GraphQLSchema({
directives: [
InstrumentDirective,
GraphQLIncludeDirective,
GraphQLSkipDirective
],
query: RootQueryType
});
const resolveWithInstrumentation = (resolve) => {
return (source, args, context, info) => {
const directives = info.fieldASTs[0].directives;
const instrumentDirective = directives.filter(d => d.name.value === InstrumentDirective.name)[0];
if (!instrumentDirective) {
return resolve(source, args, context, info);
}
const start = new Date();
return Promise.resolve(resolve(source, args, context, info)).then((result) => {
const resolveWithInstrumentation = (resolve) => {
return (source, args, context, info) => {
const directives = info.fieldASTs[0].directives;
const instrumentDirective = directives.filter(d => d.name.value === InstrumentDirective.name)[0];
if (!instrumentDirective) {
return resolve(source, args, context, info);
}
// instrument the resolve
};
const resolveWithInstrumentation = (resolve) => {
return (source, args, context, info) => {
// logic
};
};