Skip to content

Instantly share code, notes, and snippets.

View sashadev-sky's full-sized avatar

sashadev-sky

  • New York, NY
View GitHub Profile
@sashadev-sky
sashadev-sky / vgoget.sh
Created August 4, 2023 07:07 — forked from rogpeppe/vgoget.sh
go get binary@version
#!/bin/sh
# This command installs binaries at specified versions
# into $GOBIN, $GOPATH/bin or $HOME/bin.
# It assumes Go 1.11.
if [ $# = 0 ]; then
usage: vgoget cmdpackage[@version]... >&2
exit 2
fi
d=`mktemp -d`
cd "$d"
@sashadev-sky
sashadev-sky / - useWhyDidYouUpdateKeys.tsx
Last active December 1, 2022 03:17
This hook makes it easy to see which prop changes are causing a component to re-render.
/**
* Prints out the keys that changed and their old and new values. Useful for deeply
* nested objects.
* Bare minimum Typescript annotations to pass compiling
**/
import _ from 'lodash';
import { useEffect, useRef } from 'react';
const isObject = (v: any) => v && typeof v === 'object';
@sashadev-sky
sashadev-sky / script.sh
Last active April 29, 2022 22:36
Setup Workflow Service quickly using Mac Terminal
#!/bin/bash
tabname() {
printf "\e]1;$1\a"
}
new_tab() {
TAB_NAME=$1
COMMAND=$2
osascript \
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/security/PausableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC1155/extensions/ERC1155SupplyUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
@sashadev-sky
sashadev-sky / enumerating_2_els.md
Last active March 19, 2022 11:03
Enumerating over a list with both the current and next value in Python
value = [3, 4, 5, 6]
longer_value = [3, 4, 5, 6, 8]
iter_value = iter(value)

print([*value])
# >>> [3, 4, 5, 6]
print([*value]*2)
# >>> [3, 4, 5, 6, 3, 4, 5, 6]
print([*iter(value)]*2)
@sashadev-sky
sashadev-sky / About.vue
Last active April 29, 2022 22:39
Using beforeRouteEnter with Vue Router
<template>
<div>Hi I am the about page {{ info }}</div>
</template>
<script>
export default {
props: {
info: String
},
beforeRouteEnter(to, from, next) {
import { GtmInstance } from './types'
// will need this for multiple container environments
export default ({ $gtm }: { $gtm: GtmInstance }) => {
const gtagId = process.env.GOOGLE_TAG_MANAGER_ID
if (gtagId) {
$gtm.init(gtagId)
$gtm.push({ event: 'gtm.js', 'gtm.start': new Date().getTime() })
}
}
@sashadev-sky
sashadev-sky / setup-vagrant-macosx.md
Created June 10, 2021 16:11 — forked from tomysmile/setup-vagrant-macosx.md
How to Install Virtualbox and Vagrant on MacOSX

Install Virtualbox && Vagrant for MacOSX

Vagrant uses Virtualbox to manage the virtual dependencies. You can directly download virtualbox and install or use homebrew for it.

$ brew cask install virtualbox

Now install Vagrant either from the website or use homebrew for installing it.

@sashadev-sky
sashadev-sky / README.md
Created May 15, 2021 05:17 — forked from Tynael/README.md
How to use npx to run gist based scripts
@sashadev-sky
sashadev-sky / launch.json
Last active May 4, 2021 22:09
VSCODE project instance python configurations
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",