Skip to content

Instantly share code, notes, and snippets.

@J4si3k
J4si3k / useMachine.ts
Created September 17, 2022 08:55 — forked from darrenjennings/useMachine.ts
vue useMachine.ts
import { StateMachine, interpret, EventObject } from '@xstate/fsm'
import { ref, Ref, onBeforeMount } from '@vue/composition-api'
export default function useMachine<TContext, TEvent extends EventObject = EventObject> (
stateMachine: StateMachine.Machine<TContext, TEvent, any>): {
current: Ref<StateMachine.State<TContext, TEvent, any>>,
send: StateMachine.Service<TContext, TEvent>['send'],
service: StateMachine.Service<TContext, TEvent>,
} {
const current = ref(stateMachine.initialState) as Ref<StateMachine.State<TContext, TEvent, any>>
@J4si3k
J4si3k / shake.js
Created December 28, 2021 10:56 — forked from leecrossley/shake.js
Shake gesture detection in PhoneGap / Cordova
/*
THIS GIST IS OUT OF DATE AND NOT MONITORED
PLEASE SEE https://github.com/leecrossley/cordova-plugin-shake-detection
*/
var shake = (function () {
var shake = {},
watchId = null,
options = { frequency: 300 },
previousAcceleration = { x: null, y: null, z: null },
#Reference: https://www.smarthomebeginner.com/traefik-reverse-proxy-tutorial-for-docker
#Requirement: nano .env -> Set environmental variables: ${$USERDIR}, ${PUID}, ${PGID}, ${TZ}, ${DOMAINNAME}, ${CLOUDFLARE_EMAIL}, ${CLOUDFLARE_API_KEY}, ${HTTP_USERNAME}, ${HTTP_PASSWORD}, ${PLEX_CLAIM} etc. as explained in the reference.
version: "3.7"
services:
######### FRONTENDS ##########
# Traefik Reverse Proxy
traefik:
@J4si3k
J4si3k / README.md
Created December 9, 2021 07:53 — forked from Cubixmeister/README.md
Simple Sentry docker-compose.yml
  1. Download docker-compose.yml to dir named sentry
  2. Change SENTRY_SECRET_KEY to random 32 char string
  3. Run docker-compose up -d
  4. Run docker exec -it sentry_sentry_1 sentry upgrade to setup database and create admin user
  5. Run docker exec -it pip install sentry-slack if you want slack plugin, it can be done later
  6. Run docker restart sentry_sentry_1
  7. Sentry is now running on public port 9000