Skip to content

Instantly share code, notes, and snippets.

View K3TH3R's full-sized avatar

Kether Saturnius K3TH3R

View GitHub Profile
@K3TH3R
K3TH3R / machine.js
Created March 25, 2021 21:16
Generated by XState Viz: https://xstate.js.org/viz
const drawingStateMachineDef = Machine({
id: 'appDrawing',
initial: 'inactive',
states: {
inactive: {
on: {
START_DRAW: 'drawing',
}
},
drawing: {
@K3TH3R
K3TH3R / schema.js
Created November 5, 2020 08:06
Loads/updates the schema in a Fauna database.
// Required packages: faunadb, dotenv.
// FAUNA_SECRET: should be the secret of an admin key in the target DB.
const fs = require("fs");
const https = require("https");
const path = require("path");
const { Client, query: q } = require("faunadb");
require('dotenv').config({ path: path.join(__dirname, '.env') });
@K3TH3R
K3TH3R / machine.js
Last active October 28, 2020 09:17
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
import createAuth0Client from '@auth0/auth0-spa-js'
import { computed, reactive, watchEffect } from 'vue'
let client
const state = reactive({
loading: true,
isAuthenticated: false,
user: {},
popupOpen: false,
error: null,
@K3TH3R
K3TH3R / auth0Wrapper-vue2.js
Last active October 3, 2020 01:32
A gist for the Medium article on asynchronous plugins in Vue: https://medium.com/@iamkether/provide-inject-async-plugins-with-vue3-e424525af6ae
import Vue from "vue";
import createAuth0Client from "@auth0/auth0-spa-js";
/** Define a default action to perform after authentication */
const DEFAULT_REDIRECT_CALLBACK = () =>
window.history.replaceState({}, document.title, window.location.pathname);
let instance;
/** Returns the current instance of the SDK */
@K3TH3R
K3TH3R / iterm2.zsh
Created December 28, 2016 21:50 — forked from wadey/iterm2.zsh
Change iTerm2 tab color when using SSH
# Usage:
# source iterm2.zsh
# iTerm2 window/tab color commands
# Requires iTerm2 >= Build 1.0.0.20110804
# http://code.google.com/p/iterm2/wiki/ProprietaryEscapeCodes
tab-color() {
echo -ne "\033]6;1;bg;red;brightness;$1\a"
echo -ne "\033]6;1;bg;green;brightness;$2\a"
echo -ne "\033]6;1;bg;blue;brightness;$3\a"
@K3TH3R
K3TH3R / example_syntax.vue
Last active October 25, 2016 23:49
VueJS Styleguides
The basic idea is to add one more template tag to Vue-Loader's interpreter:
<styleguide lang="markdown">
This area would allow virtually any kind of markdown text, comments, etc.
</styleguide>
<template>
// ...
</template>
@K3TH3R
K3TH3R / App.js
Last active October 1, 2017 21:56
ES6 Inheritance from ES5 Classes with EaselJS
// EaselJS still has some problems compiling with Webpack/CommonJS as of this
// publishing (01/23/2016), which makes it difficult to write modularity
// in ES6 for it. However, it's not that hard to work around:
import { Car, Mustang } from './Cars';
let createjs = window.createjs; // local reference to createjs and bypasses the current module issues
let stage = new createjs.Stage('car_canvas');
let car = new Car({
color: '#0081c9',
id: 'car1',
@K3TH3R
K3TH3R / app.go
Created January 1, 2016 23:36
Golang App Engine - Using Echo router with Appstats (for fixing/optimizing queries)
// +build appengine
package main
import (
"github.com/labstack/echo"
"github.com/mjibson/appstats"
"golang.org/x/net/context"
"net/http"
)
@K3TH3R
K3TH3R / .node-version
Last active December 28, 2015 10:20
Installing NVM with automatic node version switching on `cd` into a directory for Mac OS X
4