Skip to content

Instantly share code, notes, and snippets.

View anthonygore's full-sized avatar

Anthony Gore anthonygore

View GitHub Profile
@anthonygore
anthonygore / slack.js
Last active August 12, 2017 04:05
Send users a welcome message (IM) from the slackbot when they join your Slack team. Uses https://github.com/smallwins/slack so look at that first. Load this somewhere in a running Node JS app.
var slack = require('slack');
var bot = slack.rtm.client();
var token = "your_slack_token";
bot.team_join(function(obj) {
console.log("Team join triggered");
slack.chat.postMessage(
{
token: token,
channel: obj.user.id,
@anthonygore
anthonygore / printgitremote.sh
Created November 9, 2020 02:31
Bash script to print out the git remote of every subdirectory in the folder
find . -maxdepth 1 -mindepth 1 -type d | while read dir; do
if [ -e $dir/.git ];
then
git -C $dir remote -v
fi
done
@anthonygore
anthonygore / snipcart-ga4.gtm.js
Created April 22, 2021 10:42
Snipcart - Google Tag Manager - Google Analytics 4
function formatItems (items) {
return items.map(function (item, index) {
return {
item_name: item.name,
item_id: item.id,
price: `${item.totalPriceWithoutDiscountsAndTaxes}`,
quantity: `${item.quantity}`,
index: index+1
};
});
@anthonygore
anthonygore / Counter.vue
Last active June 9, 2021 05:50
Vue Composition API + RxJS counter
<template>
<div>
<input v-model="input" type="number" />
<h1>{{ output }}</h1>
</div>
</template>
<script>
import { ref, watch, onUnmounted } from 'vue';
import { timer, Subject } from 'rxjs';