Skip to content

Instantly share code, notes, and snippets.

View jason-c-child's full-sized avatar
💾
I may be slow to respond.

Jason jason-c-child

💾
I may be slow to respond.
View GitHub Profile
@jason-c-child
jason-c-child / cloud_flare_func.js
Last active December 14, 2023 20:19
An example CloudFlare Function for fetching data from Stargaze GraphQL API
import { error, json, Router, createCors } from 'itty-router';
import { ApolloClient, InMemoryCache, gql } from '@apollo/client';
const { preflight, corsify } = createCors();
const client = new ApolloClient({
uri: 'https://graphql.mainnet.stargaze-apis.com/graphql',
cache: new InMemoryCache(),
});
export const getTraitsAndOwner = (collectionAddr, tokenId) =>
export const checkForSale = (collectionAddr, tokenId) =>
client.query({
query: gql`
query Query {
token(
collectionAddr: "${collectionAddr}"
tokenId: "${tokenId}"
) {
forSale
traits {
1 a small cat playing in a field
2 the sunsetting over a verdant mountain valley
3 calf playing with a baby goat
const { Configuration, OpenAIApi } = require("openai");
const fs = require("fs");
const images = fs.readFileSync("big_list_of_prompts.csv", "utf8").split("\n");
const errors = fs.createWriteStream("errors.txt");
async function main() {
const configuration = new Configuration({
apiKey: "my-cool-api-key",
});
member_full party state phone email
Alexander (R-TN) R TN (202) 224-4944 http://www.alexander.senate.gov/public/index.cfm?p=Email
Baldwin (D-WI) D WI (202) 224-5653 https://www.baldwin.senate.gov/feedback
Barrasso (R-WY) R WY (202) 224-6441 https://www.barrasso.senate.gov/public/index.cfm/contact-form
Bennet (D-CO) D CO (202) 224-5852 https://www.bennet.senate.gov/public/index.cfm/contact
Blackburn (R-TN) R TN (202) 224-3344 https://www.blackburn.senate.gov/email-me
Blumenthal (D-CT) D CT (202) 224-2823 https://www.blumenthal.senate.gov/contact/
Blunt (R-MO) R MO (202) 224-5721 https://www.blunt.senate.gov/public/index.cfm/contact-roy
Booker (D-NJ) D NJ (202) 224-3224 https://www.booker.senate.gov/?p=contact
Boozman (R-AR) R AR (202) 224-4843 https://www.boozman.senate.gov/public/index.cfm/contact
my_dict = {
"rain": "what a drizzly day!",
"shine": "grab the shades!"
}
def condition(state: str) -> str:
result = None
if state in my_dict.keys():
result = my_dict[state]
result = "something else...not rain nor shine..."

the docs https://circleci.com/docs/2.0/local-cli/

Install the CircleCI cli tools on macos:

curl -fLSs https://circle.ci/cli | DESTDIR=/opt/bin bash

From there you can configure the cli and add your CircleCI personal API Token.

circleci setup

- run:
label: Use nvm for a specific node version...
command: |
set +e
# if you need to install it, uncomment the following
# wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash && sudo /opt/circleci/.nvm/nvm.sh
export NVM_DIR="/opt/circleci/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
nvm install v13
npm install -g yarn
import { values } from 'progressive-platform'
import { commonSense } from 'human-experience'
import Candidate from 'democrat-party'
import Nation from 'global-community'
const initiate = candidate =>
mode =>
nation =>
Promise.resolve(nation.change(mode)(candidate))
;; multi-arity function, takes zero or 1 arg...
(defn multiArity
([] (println "no arg!"))
([x] (println "one arg: " x)))
;;user=> (multiArity)
;;no arg!
;;nil
;;user=> (multiArity 11)
;;one arg: 11
;;nil