Skip to content

Instantly share code, notes, and snippets.

View snikch's full-sized avatar
🎛️

Mal Curtis snikch

🎛️
  • Kolatr
  • Auckland, New Zealand
  • 10:02 (UTC +13:00)
  • X @snikchnz
View GitHub Profile
@snikch
snikch / resque.rake
Created April 12, 2012 21:46 — forked from kenmazaika/Console Output
Start and Stop tasks for resque workers the intelligent way, forking the process for speed and reduced load.
require 'resque/tasks'
namespace :resque do
task :setup => :environment
# From https://gist.github.com/1870642
desc "Restart running workers"
task :restart_workers => :environment do
Rake::Task['resque:stop_workers'].invoke
Rake::Task['resque:start_workers'].invoke
end
@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',
}
},