Skip to content

Instantly share code, notes, and snippets.

@Noitidart
Noitidart / _git-submodule-tips.md
Last active March 29, 2024 22:43
Tips for working with git submodules

Tips for Working With git Submodules

Cloning Repo with Submodules

  1. Use the --recursive flag:

     git clone https://github.com/aikiframework/json.git --recursive
    

    However if you cannot, as Github desktop app on clone does not use this flag, then do this after clone:

@Noitidart
Noitidart / _ff-addon-snippet-WinAPI_resultHexToStr.js
Last active October 18, 2023 07:42
_ff-addon-snippet-WinAPI_resultHexToStr - Convert hex error to str.
var WIN32_ERROR_STR = {
HRESULT: {
'STG_S_CONVERTED': 0x00030200,
'STG_S_BLOCK': 0x00030201,
'STG_S_RETRYNOW': 0x00030202,
'STG_S_MONITORING': 0x00030203,
'STG_S_MULTIPLEOPENS': 0x00030204,
'STG_S_CONSOLIDATIONFAILED': 0x00030205,
'STG_S_CANNOTCONSOLIDATE': 0x00030206,
'OLE_S_USEREG': 0x00040000,
function useRenderCounter(label) {
const ref = React.useRef();
React.useEffect(() => {
ref.current.textContent = [
parseInt(ref.current.textContent || "0", 10) + 1,
label
]
.filter(Boolean)
.join(" - ");
});
{
"editor.inlineSuggest.enabled": true,
"github.copilot.enable": {
"*": false,
"plaintext": false,
"markdown": false,
"scminput": false,
"ts": true,
"js": true,
"jsx": true,
@Noitidart
Noitidart / Beamoff Tool.iso
Last active October 20, 2022 12:21
Shows how to install OSX 10.10.1 onto Oracle VirtualBox on AMD
@Noitidart
Noitidart / bootstrap.js
Created January 31, 2014 08:26
Bootstrap addon demo. Shows how to add a sidebar to all browsing windows. More specifically, a sidebar which allows HTML content.
const {interfaces: Ci, utils: Cu} = Components;
Cu.import('resource://gre/modules/Services.jsm');
/*start - windowlistener*/
var windowListener = {
//DO NOT EDIT HERE
onOpenWindow: function (aXULWindow) {
// Wait for the window to finish loading
let aDOMWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow);
aDOMWindow.addEventListener("load", function () {

Commit

Add changed files to last commit - (first git add the files you want to add to last commit, ie: git add .) - git commit --amend --no-edit

Branches

List local branches and filter by word in it - git branch -l *foo* (include -r) to do for remote

Push up origin with remote name being local branch name - git push -u origin HEAD (do this instead of git push -u origin NAME_OF_BRANCH_HERE)

@Noitidart
Noitidart / about.md
Last active April 13, 2022 17:52 — forked from antichris/about.md
Adds a fully functional "Fork" button to your own Gist.

Fork your own Gist

This is a script that adds a fully functional Fork button to your own Gist.

If a Fork button is already present in the page, this bookmarklet will set focus to it instead of adding another one.

The change is temporary and the button will disappear as soon as you navigate away from that Gist (clicking the Fork button does this for you as well). Meaning you will have to run the script every new page load.

Firefox

Copy the contents from bookmarklet.js, open Scracthpad (Ctrl+F4), paste it there. Back in browser, swwitch to tab with your Gist you want to fork. Back in Scratchpad, "Run" it. Save and/or bookmark the Scratchpad file for future use.

@Noitidart
Noitidart / _js-findClosestLocale.js
Last active April 12, 2022 04:59
_js-findClosestLocale - Gets the closest locale from the available locales
// rev3 - https://gist.github.com/Noitidart/110c2f859db62398ae76069f4a6c5642
/**
* Selects the closest matching locale from a list of locales.
*
* @param aLocales
* An array of available locales
* @param aMatchLocales
* An array of prefered locales, ordered by priority. Most wanted first.
* Locales have to be in lowercase.
* @return the best match for the currently selected locale
@Noitidart
Noitidart / useRadio.ts
Created April 8, 2022 23:49
maybe useful maybe not. i made but never used it.
import { useMemo, useRef } from 'react';
import { useMemoizedFn } from 'ahooks';
import { noop } from 'lodash';
type UseRadioInputs = {
// Defaults to undefined
defaultValue?: any;
onChange?: (value: any) => void;