Skip to content

Instantly share code, notes, and snippets.

View K3TH3R's full-sized avatar

Kether Saturnius K3TH3R

View GitHub Profile
@K3TH3R
K3TH3R / .zshrc
Created May 3, 2015 20:13
Quickly setup Bitbucket/Github repos from your command line
# New Github repo
# -----------------------------
# Make sure to replace the "USERNAME" portion with your own
# GitHub username. To start a new public GitHub repo,
# simply do this from your command line:
# newgh REPO_NAME
function newgithub(){
curl -u 'USERNAME' https://api.github.com/user/repos -d "{\"name\":\"$1\"}";
git init;
git remote add origin [email protected]:USERNAME/$1.git;
@K3TH3R
K3TH3R / fat_arrow_binding.js
Created July 25, 2015 23:26
Using arrow functions to easily bind functions for use inside of React Components
// This is how you might traditionally bind component
// functions to make sure you're accessing the right scope
class OldButton extends React.Component {
handleClick (e){ /* ... */ }
render() {
return <button onClick={this.handleClick.bind(this)} />;
}
}
@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
@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 / 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 / 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 / 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 / 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 */
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 / 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