Skip to content

Instantly share code, notes, and snippets.

View rudifa's full-sized avatar

Rudolf Farkas rudifa

  • Rudicubes (defunct)
  • Geneva, Switzerland
  • X @rudifa
View GitHub Profile
@rudifa
rudifa / gopro
Last active May 28, 2023 11:34
#!/bin/bash
# Create a new Go project with a main.go file and a Go module
# Option -c, --cobra: Initialize a Cobra CLI project in the module
while getopts ":c" opt; do
case $opt in
c)
c_flag=true
;;
#!/bin/bash
# originally from
# https://gist.github.com/maciekish/66b6deaa7bc979d0a16c50784e16d697
# rudifa: added TARGET logic and kill CoreSimulatorService
killall Xcode
pkill -int com.apple.CoreSimulator.CoreSimulatorService
xcrun -k
xcodebuild -alltargets clean
rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
@rudifa
rudifa / registerXcode.sh
Last active May 17, 2023 09:33
Register Xcode.app
#!/bin/bash
# problem:
# you installed a new version of Xcode, and now the previously installed extensions are
# not visible any more in menus or accessible via custom keyboard shortcuts
# solution:
# https://nshipster.com/xcode-source-extensions/
# ... when multiple copies of Xcode are on the same machine, extensions can stop working completely. In this case, Apple Developer Relations suggests re-registering your main copy of Xcode with Launch Services.
@rudifa
rudifa / registerXcode.sh
Created May 17, 2023 09:28
Register the Xcode.app
‎‎​
@rudifa
rudifa / gopro
Last active May 17, 2023 09:23
#!/bin/bash
# Create a new Go project with a main.go file and a Go module
# Option -c, --cobra: Initialize a Cobra CLI project in the module
while getopts ":c" opt; do
case $opt in
c)
c_flag=true
;;
@rudifa
rudifa / Electron IPC Pattern #3
Last active October 27, 2022 18:50
The Electron IPC DOCS/FIDDLES/IPC/PATTERN-3 (21.2.0) Main to renderer
// 1. Main prepares a Menu that will let the user
// increment/decrement a counter, whose valu will be displayed
// in the rendered page
// On user click, the callback will send a message
// on the channel (update-counter) with the value to add
// 2. Preload defines the function handleCounter
// that will let the renderer to specify the callback
// to be called when a message on the channel (pdate-counter)
// arrives from the main
@rudifa
rudifa / Electron IPC Pattern #2
Last active October 27, 2022 18:32
The Electron IPC DOCS/FIDDLES/IPC/PATTERN-2 (21.2.0) Renderer to main (two-way)
// 1. Renderer defines a listener that will, on the user click,
// call asynchronously window.electronAPI.openFile(),
// which is defined by preload.
// Function openFile returns the data
// (the file path selected by the user) that the handler in main
// obtained from the OS dialog.
// The listener updates the html text with this data.
// 2. Preload defines function openFile that calls invoke(<channel>)
// which will be handled by the main
@rudifa
rudifa / Electron IPC Pattern #1
Last active October 26, 2022 15:53
The Electron IPC DOCS/FIDDLES/IPC/PATTERN-1 (21.2.0), Renderer to main (one-way), with comments
// 1. the renderer attaches a listener to the button defined in the html file
// . on user click, the listener calls the function setTitle passing on the value from the input element
// 2. the preload defines the function that will be called by setTitle and pass on the title sending the event set-title
// 3. the main attaches a listener for the event set-title
// that will get the title an put it into the browser window title
@rudifa
rudifa / Electron IPC pattern #0
Last active October 26, 2022 15:50
A variant of DOCS/FIDDLES/TUTORIAL-PRELOAD (21.2.0)
// 1. in preload, the contextBridge exposes a copy of a process variable for info
// 2. the renderer inserts the info into the view
@rudifa
rudifa / BackupFileTests.xctest
Last active May 22, 2022 13:29
BackupFileTests.xctest passed
Test Suite 'All tests' started at 2022-05-22 15:28:43.735
Test Suite 'BackupFileTests.xctest' started at 2022-05-22 15:28:43.737
Test Suite 'BackupFileTests' started at 2022-05-22 15:28:43.737
Test Case '-[BackupFileTests.BackupFileTests test_BackupFile]' started.
Test Case '-[BackupFileTests.BackupFileTests test_BackupFile]' passed (0.005 seconds).
Test Suite 'BackupFileTests' passed at 2022-05-22 15:28:43.743.
Executed 1 test, with 0 failures (0 unexpected) in 0.005 (0.006) seconds
Test Suite 'BackupFileTests.xctest' passed at 2022-05-22 15:28:43.744.
Executed 1 test, with 0 failures (0 unexpected) in 0.005 (0.007) seconds
Test Suite 'All tests' passed at 2022-05-22 15:28:43.744.