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 / BackupFileTests.swift
Created May 21, 2022 21:18
BackupFileTests.swift
//
// BackupFileTests.swift
// BackupFileTests
//
// Created by Rudolf Farkas on 21.05.22.
//
@testable import BackupFile
import XCTest
@rudifa
rudifa / .xcode_open_vscode_here
Created May 21, 2022 21:58
~/.xcode/.xcode_open_vscode_here
#! /bin/bash
/usr/local/bin/code `pwd`
@rudifa
rudifa / BackupFile.swift
Last active May 21, 2022 22:30
BackupFile.swift
//
// BackupFile.swift
// BackupFile
//
// Created by Rudolf Farkas on 21.05.22.
//
import Foundation
// a wrapper struct that backs up the wrapped struct in an iOS file
@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.
@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 / 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 #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 #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 / 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 / registerXcode.sh
Created May 17, 2023 09:28
Register the Xcode.app
‎‎​