Skip to content

Instantly share code, notes, and snippets.

View ctrlaltdylan's full-sized avatar

Dylan Pierce ctrlaltdylan

View GitHub Profile
@ctrlaltdylan
ctrlaltdylan / http-response.js
Last active September 7, 2023 17:12
Pipedream HTTP response component
// To return a custom HTTP response, use $.respond() [requires HTTP trigger]
export default defineComponent({
props: {
body: {
type: 'object',
label: "Body",
description: "The payload to respond with",
default: {}
},
headers: {
@ctrlaltdylan
ctrlaltdylan / CreateRepo.js
Created December 6, 2022 14:12
Create Github Repository from a Pipedream Node.js Code Step
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
github: {
type: "app",
app: "github",
},
repo_name: {
type: "string",
label: "Repository Name",
export default {
name: "Pg Custom Action",
version: "0.0.1",
key: "pg-custom-action",
description: "",
props: {
query: {
type: 'string',
label: 'Query',
},
@ctrlaltdylan
ctrlaltdylan / apache.env.sh
Created June 14, 2022 16:23
Apache ENV file for gitpod
export APACHE_SERVER_NAME=$(gp url 8080 | sed -e s/https:\\/\\/// | sed -e s/\\///)
export APACHE_RUN_USER="gitpod"
export APACHE_RUN_GROUP="gitpod"
export APACHE_RUN_DIR=/var/run/apache2
export APACHE_PID_FILE="$APACHE_RUN_DIR/apache.pid"
export APACHE_LOCK_DIR=/var/lock/apache2
export APACHE_LOG_DIR=/var/log/apache2
@ctrlaltdylan
ctrlaltdylan / apache.conf
Created June 14, 2022 16:16
apache.conf for monorepo
# Apache httpd v2.4 minimal configuration
# see https://wiki.apache.org/httpd/Minimal_Config for documentation
ServerRoot ${GITPOD_REPO_ROOT}
PidFile ${APACHE_PID_FILE}
User ${APACHE_RUN_USER}
Group ${APACHE_RUN_GROUP}
# Modules as installed/activated via apt-get
@ctrlaltdylan
ctrlaltdylan / gist:0677ef8e65efed2140a6df4739cc733f
Created May 5, 2022 18:12
Workflow polling example diagram
sequenceDiagram
participant Workflow
participant Service
autonumber
Workflow-)Service: POST /api/long-running-job
note over Workflow,Service: Create a long running job on the Service
rect rgb(82, 78, 183)
Workflow->Workflow: Delay
note left of Workflow: Delay 1 hour
@ctrlaltdylan
ctrlaltdylan / shopifyGraphqlClient.js
Created January 5, 2022 11:10
Shopify x-request-id logger with Apollo
import {
ApolloClient,
createHttpLink,
InMemoryCache,
ApolloLink,
} from "@apollo/client";
import fetch from "cross-fetch";
/**
* Shopify x-request-id header logger
@ctrlaltdylan
ctrlaltdylan / createSearchIndices.js
Last active April 3, 2021 15:19
Mongo Text Searching (with partial matching)
async function createTextSearchIndex(db) {
db.collection("customers").createIndex({
firstName: "text",
lastName: "text",
email: "text",
phone: "text"
});
}
async function createRegexSearchIndex(db) {
@ctrlaltdylan
ctrlaltdylan / vouchedInit.jsx
Last active March 18, 2021 16:06
Vouched extensions example prototype
const vouched = window.Vouched({
appId: { process.env.VOUCHED_API_KEY },
additionalSteps: [
((priorStep, nextStep)) => {
// priorStep is a callback to go back 1 step
// nextStep is a callback that will go to the next step, if none then vouched.onComplete is called
return (
<div>
<h2>Please provide your signature</h2>
@ctrlaltdylan
ctrlaltdylan / graphql.js
Last active June 26, 2021 18:35
Proxied Shopify GraphQL NextJS API Endpoint Example ( say that 10 times fast )
import withDb from '../../middleware/withDb'
import { get } from 'lodash'
import httpProxyMiddleware from "next-http-proxy-middleware";
import allowCors from "middleware/allowCors";
import jwt from "jsonwebtoken";
export const config = {
api: {
bodyParser: false,
},