Skip to content

Instantly share code, notes, and snippets.

View samuelint's full-sized avatar

Samuel Richard Magny samuelint

View GitHub Profile
function svg_to_icns(){
# Dependencies
# $ brew install png2ico
# $ brew install svg2png
#
# Usage example
# $ svg2png -V
# 0.1.3
#
# $ png2ico -V
@samuelint
samuelint / main.rs
Created June 27, 2024 17:31
Tauri Sidecar Lifecycle & Forward stderr
// Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
pub mod sidecar_lifecycle_service;
use std::sync::Mutex;
use tauri_plugin_log::LogTarget;
use tauri::{Manager, State, WindowEvent};
use sidecar_lifecycle_service::SidecarLifeCycleService;
@samuelint
samuelint / macos_dev_setup.sh
Last active May 27, 2024 20:17
New macOS setup script
#!/bin/bash
set -e
##########################
# New macOS setup script #
##########################
USER_EMAIL="<YOUR EMAIL>"
USER_NAME="<YOUR_NAME>"
# SSH
@samuelint
samuelint / client-side-component.tsx
Created February 2, 2024 15:09
use-hydrate-example--client-side-component.tsx
'use client';
import { useHydrate } from 'use-hydrate';
import { setData } from './redux/my.slice';
import { selectData } from './redux/data.selector';
interface Props {
existing?: MyData[]
}
import React, { ReactNode, use } from 'react';
interface Props {
params: {
id: string;
},
children: ReactNode;
}
import { ActionCreatorWithPayload } from '@reduxjs/toolkit';
import { useEffect } from 'react';
import { useDispatch, useSelector } from 'react-redux';
interface Props<
TValue,
TAction extends ActionCreatorWithPayload<TValue>,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
TSelector extends (state: any) => TValue