Skip to content

Instantly share code, notes, and snippets.

View dansteren's full-sized avatar

Dan Steren dansteren

View GitHub Profile
@dansteren
dansteren / azle_utlities.sh
Created July 31, 2022 00:12
Utility functions for making life easier working in the azle repo
# Changes to the root directory (modify as needed)
# TODO: Consider using cdpath instead: http://romain.bardou.fr/blog/CDPATH.html
alias cdr='cd ~/repos/demergent-labs/azle'
# Comments out the last line in all index.js files in the dfx_generated directory
ma() {
COUNT=0
cd dfx_generated || exit
for directory in */; do
STORED_LAST_LINE=$(tail --lines=1 "$directory"/index.js)
@dansteren
dansteren / deploy.sh
Created July 21, 2022 20:20
Deploys a gzipped azle canister to dfx. Supports arguments
# Deploys a g-zipped wasm file to a canister
deploy() {
dfx canister create "$1"
dfx build "$1"
if [ -z "$2" ]; then
dfx canister install "$1" --wasm "target/wasm32-unknown-unknown/release/$1.wasm.gz"
else
dfx canister install "$1" --argument "$2" --wasm "target/wasm32-unknown-unknown/release/$1.wasm.gz"
fi
}
@dansteren
dansteren / modify_agents.sh
Created July 13, 2022 17:15
Script to modify the dfx_generated_files
#!/bin/bash
# For a given directory, navigate into the dfx_generated folder and loop through
# all agent folders, and comment out the last line in the index.js file.
cd dfx_generated || exit
for directory in */; do
echo "Processing $directory"
STORED_LAST_LINE=$(tail --lines=1 "$directory"/index.js)
echo "The saved text is: $STORED_LAST_LINE"
sed -i '$ d' "$directory"/index.js

Keybase proof

I hereby claim:

  • I am dansteren on github.
  • I am dansteren (https://keybase.io/dansteren) on keybase.
  • I have a public key ASAb6Bj0Cbi9uzbbt13-O9nf1C_j7uWXhApYub-YQiRZAAo

To claim this, I am signing this object:

@dansteren
dansteren / graphcool.yml
Last active February 21, 2018 06:35
Given a senderId, a recipientId, and a message, add the message to a conversation. Possibly creating the conversation if neccesary.
types: ./types.graphql
functions:
sendMessageAndPossiblyStartConversation:
type: resolver
schema: src/sendMessageAndPossiblyStartConversation.graphql
handler:
code: src/sendMessageAndPossiblyStartConversation.ts
@dansteren
dansteren / ParallaxImage.tsx
Created February 19, 2018 01:21
I really want Parallax images to be this simple. This is the interface, and I'll make it when I get a chance.
const MyPage = () => {
<ParallaxImage
className="parallax-image"
width="100%"
height="100%"
style={myStyle}
type="scroll | mousePosition"
>
<Background src="background.png" color="#00FF00FF"/>
<Layer z="1" src="farthestBack.png"/>