Skip to content

Instantly share code, notes, and snippets.

View snikch's full-sized avatar
🎛️

Mal Curtis snikch

🎛️
  • inMusic
  • Auckland, New Zealand
  • 05:28 (UTC +12:00)
  • X @snikchnz
View GitHub Profile
@snikch
snikch / gist:3661188
Created September 6, 2012 23:16
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@snikch
snikch / test.rb
Last active January 6, 2022 13:18
Convert a UUID to UTF-8 encoding to visually shorten.
>> code = Urlcode.uuid_to_code("4c3559f0-cd95-482f-a27d-b2bbc68523ef")
=> "䰵姰축䠯ꉽ늻욅⏯"
>> Urlcode.code_to_uuid(code)
=> "4c3559f0-cd95-482f-a27d-b2bbc68523ef"
@snikch
snikch / .env.example
Last active May 20, 2021 12:46
Chia Network Docker Compose
PLOTS_TMP_DIR=/mnt/scratch/plots
PLOTS_FINAL_DIR=/mnt/storage/plots
@snikch
snikch / machine.js
Created March 9, 2021 19:45
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@snikch
snikch / machine.js
Last active March 1, 2021 01:34
Generated by XState Viz: https://xstate.js.org/viz
const mergeTrust = (key) => ({
// id: 'mergeTrust'+key,
initial: "checkSuperseded",
context: {},
states: {
checkSuperseded: {
// always: [
// { target: "ignore", cond: "checkSuperseded" },
// { target: "checkTrust" }
// ],
@snikch
snikch / machine.js
Last active December 3, 2020 04:55
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@snikch
snikch / machine.js
Last active November 30, 2020 04:26
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@snikch
snikch / machine.js
Last active November 2, 2020 04:08
Generated by XState Viz: https://xstate.js.org/viz
const defEmit = {
initial: 'awaitingEvent',
states: {
awaitingEvent: {
on: {
EMIT_EVENT: 'emitting',
}
},
@snikch
snikch / machine.js
Last active November 1, 2020 21:52
Generated by XState Viz: https://xstate.js.org/viz
const defProcessed = {
saving: {
invoke: {
src: 'saveEvent',
onDone: {
target: 'saved'
},
onError: {
target: 'error'
}