Skip to content

Instantly share code, notes, and snippets.

View xixiaofinland's full-sized avatar

Xi Xiao xixiaofinland

View GitHub Profile
@aidan-harding
aidan-harding / MultiMap.cls
Created August 30, 2024 15:22
A MultiMap for Salesforce Apex
/**
* @author [email protected]
* @date 29/08/2024
* @description A map where the items are lists of items and you can provide a function for how values map to keys.
* Oh, if we had generics....
*/
public class MultiMap {
private Map<Object, List<Object>> theMap;
private Type listType;
@hroi
hroi / fish_jj_prompt.fish
Last active November 17, 2025 17:13
Jujutsu (jj) prompt for fish-shell
# Place me in ~/.config/fish/functions
# Then add me to `fish_vcs_prompt`: `funced fish_vcs_prompt` and save it to
# your personal config: `funcsave fish_vcs_prompt;`
function fish_jj_prompt --description 'Write out the jj prompt'
# Is jj installed?
if not command -sq jj
return 1
end
@LukeMathWalker
LukeMathWalker / audit.yml
Last active December 3, 2025 21:09
GitHub Actions - Rust setup
name: Security audit
on:
schedule:
- cron: '0 0 * * *'
push:
paths:
- '**/Cargo.toml'
- '**/Cargo.lock'
jobs:
security_audit:
@Mefistophell
Mefistophell / RUST.MD
Last active August 29, 2025 16:15
How to Compile a Rust Program on Mac for Windows

Question: I want to compile my Rust source code for the Windows platform but I use macOS.

Solution:

  1. Install target mingw-w64: brew install mingw-w64
  2. Add target to rustup: rustup target add x86_64-pc-windows-gnu
  3. Create .cargo/config
  4. Add the instructions below to .cargo/config
[target.x86_64-pc-windows-gnu]
@tstachl
tstachl / .eslintrc.json
Last active April 24, 2018 12:41
Sane default eslintrc close to Salesforce DX.
{
"env": {
"browser": true
},
"parserOptions": {
"ecmaVersion": 5
},
"globals": {
"$A": true,
"AuraContext": true,
@9bitbear
9bitbear / _MONERO-mining-ubuntu16.04.md
Last active March 22, 2021 10:45
XMR mining on Ubuntu
export ORG_ALIAS='DummyScratchOrg'
export PROJECT_NAME='DummyProject'
export PERMISSION_SET='DummyPermSet'
export IMPORT_PLAN='Dummy-plan.json'
# Create a Salesforce DX project
sfdx force:project:create -n $PROJECT_NAME
# Regist development/sandbox org
sfdx force:auth:web:login [-d] -a $ORG_ALIAS
@tobias
tobias / setjdk.fish
Created July 12, 2016 18:16
Manage multiple java versions on the mac from the fish shell
function setjdk
if test -n "$JAVA_HOME"
removeFromPath "$JAVA_HOME/bin"
end
set -gx JAVA_HOME (/usr/libexec/java_home -v $argv[1])
set -gx PATH $JAVA_HOME/bin $PATH
end
function removeFromPath
set -l idx 0
@TheBB
TheBB / loading.org
Last active January 4, 2025 09:25
Loading in Spacemacs

Emacs packages, features, files, layers, extensions, auto-loading, require, provide, use-package… All these terms getting you confused? Let’s clear up a few things.

Files

Emacs files contains code that can be evaluated. When evaluated, the functions, macros and modes defined in that file become available to the current Emacs session. Henceforth, this will be termed as loading a file.

One major problem is to ensure that all the correct files are loaded, and in the

@nolanlawson
nolanlawson / protips.js
Last active November 1, 2025 03:20
Promise protips - stuff I wish I had known when I started with Promises
// Promise.all is good for executing many promises at once
Promise.all([
promise1,
promise2
]);
// Promise.resolve is good for wrapping synchronous code
Promise.resolve().then(function () {
if (somethingIsNotRight()) {
throw new Error("I will be rejected asynchronously!");