Skip to content

Instantly share code, notes, and snippets.

View mitranim's full-sized avatar

Nelo Mitranim mitranim

View GitHub Profile
@mitranim
mitranim / elden_ring_backup.go
Created August 2, 2024 11:30
elden_ring_backup
/*
Simple CLI tool for backing up Elden Ring saves. Makes
backups periodically. Interval is configurable, see
constants below. Avoids redundant backups by checking
file modification timestamps.
Requires Go. To install Go on Windows, use any of the following,
depending on your preference:
* Official download: https://go.dev/dl/
@mitranim
mitranim / 0_render.go
Last active October 20, 2023 22:12
Watches templates and reinitializes them on changes without fully restarting the app (excerpt from real app)
package main
import (
"fmt"
"html/template"
"time"
"github.com/pkg/errors"
"github.com/rjeczalik/notify"
)
@mitranim
mitranim / sublime-eslint.py
Last active November 9, 2018 11:42
SublimeLinter eslint_d plugin. Uses the eslint_d daemon as it's meant to be used.
from os import path
import socket
import json
import re
import sublime
import sys
import uuid
from SublimeLinter.lint import NodeLinter
from SublimeLinter.lint.linter import LintMatch
@mitranim
mitranim / sublime_gen.py
Last active April 30, 2020 06:52
Sublime Text plugin for inserting IDs and sequences
import sublime_plugin
import uuid
import random
import datetime
class gen_uuid(sublime_plugin.TextCommand):
def run(self, edit):
for region in self.view.sel():
self.view.replace(edit, region, str(uuid.uuid4()))
@mitranim
mitranim / flat-block-macros.clj
Last active June 7, 2021 11:49
Clojure macros for writing flat blocks with early returns, avoiding the let/if-pyramid
(defmacro return-or [sym expr] {:pre [(symbol? sym)]}
`(if (reduced? ~sym) (unreduced ~sym) ~expr))
(defn imp-block [[expr & tail-exprs]]
(match expr
(('let pattern init) :seq)
(if-not tail-exprs
(list init)
(match (imp-block tail-exprs)
@mitranim
mitranim / gist:f8638d0d4d10f775a1cb
Last active August 29, 2015 14:18
Suggestion for two-way binding shortcut in angular2
<!-- Current -->
<input bind-style.color="mycolor"
on-change="mycolor = $event.target.value"
on-custom-event="mycolor = $event.target.value">
<input [style.color]="mycolor"
(change)="mycolor = $event.target.value"
(custom-event)="mycolor = $event.target.value">
<!-- Maybe consider -->
<input bind-style.color:change:custom-event="mycolor">
@mitranim
mitranim / pr.jisp
Last active August 29, 2015 14:03
printing in node in jisp
(= util (require "util")) ; node built-in
(def pr ...things
(do (for thing things
(process.stdout.write (util.format thing))) ())) ; `do` and () avoid unnecessary collection of `for` results
; (= prn console.log) ; unnecessary in jisp 0.2.11
@mitranim
mitranim / private.xml
Last active August 29, 2015 14:01
KeyRemap4MacBook private settings xml
<?xml version="1.0"?>
<root>
<item>
<name>Control+L to Forward Delete</name>
<identifier>private.control_l_to_forward_delete</identifier>
<autogen>__KeyToKey__ KeyCode::L, ModifierFlag::CONTROL_L, KeyCode::FORWARD_DELETE</autogen>
</item>
<item>
<name>Control+K to Shift_L+Return</name>