Skip to content

Instantly share code, notes, and snippets.

View Spike-Leung's full-sized avatar
πŸ™ˆ
My other car is cdr

Spike Spike-Leung

πŸ™ˆ
My other car is cdr
View GitHub Profile
@mmarshall540
mmarshall540 / which-key-prefix-descriptions.el
Last active May 27, 2025 15:42
Missing Which-key Prefix descriptions
;; By default, Which-key doesn't give much help for prefix-keys. It
;; either shows the generic description, "+prefix", or the name of a
;; prefix-command, which usually isn't as descriptive as we'd like.
;;
;; Here are some descriptions for the default bindings in `global-map'
;; and `org-mode-map'.
(which-key-add-key-based-replacements
"<f1> 4" "help-other-win"
"<f1>" "help"
@rougier
rougier / nano.el
Created February 4, 2025 18:48
NANO Emacs (minimal version: 256 lines)
;; nano-emacs.el --- NANO Emacs (minimal version) -*- lexical-binding: t -*-
;; Copyright (c) 2025 Nicolas P. Rougier
;; Released under the GNU General Public License 3.0
;; Author: Nicolas P. Rougier <[email protected]>
;; URL: https://github.com/rougier/nano-emacs
;; This is NANO Emacs in 256 lines, without any dependency
;; Usage (command line): emacs -Q -l nano.el -[light|dark]
@mwolson
mwolson / README.md
Last active May 20, 2025 01:21
gptel-manual-complete.el

gptel-manual-complete.el

This is an example of how the existing gptel-rewrite.el file can be used to perform completion on an entire function, replacing what's already written so far in that function.

Setup

To use:

@faustinoaq
faustinoaq / myAngular.html
Last active May 6, 2025 15:35
Front-end libraries (React, Vue, Angular) and the basic principles of how they work, all in a single file using pure JavaScript (VanillaJS).
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Angular from Scratch</title>
<style>
.my-component {
font-family: Arial, sans-serif;
@OrionReed
OrionReed / dom3d.js
Last active May 20, 2025 11:54
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // Β―\\_(ツ)_/Β―
@tangentstorm
tangentstorm / sh.mts
Last active May 14, 2025 20:29
sh.mts: javascript shorthand (mostly for web/dom stuff)
// sh.mts: javascript shorthand
// #region array tools
/** id function (returns first argument) */
export const id=<T,>(x: T): T=>x
/** create an array filled with n copies of x */
export const af=<T,>(n: number, x: T): T[]=>Array(n).fill(x) // TODO: make this 'afl' or 'fil' (aa?)
/** loop i from 0..n, calling f(i) */
export const ii=(n: number, f: (i: number)=>void)=>{for(let i=0;i<n;i++)f(i)}
/** map f over [0..n] */
@Fmajor
Fmajor / vue.ctags
Created June 19, 2019 18:20
A ctags syntax file for vue components
# A ctags syntax file for vue components
--langdef=vue
--langmap=vue:.vue
# vue-commands in <template>
--regex-vue=/^(<template>)$/\1/t,template/{scope=set}{exclusive}
--regex-vue=/^\S*(.*(v-if=|v-for=|v-show=|ref=)("[^"]*"))/\2\3/c,vue-command/{scope=ref}
--regex-vue=/^(<\/template>)$/\1//{scope=pop}{exclusive}{placeholder}
# css in <template>
--regex-vue=/^(<style.*)$/style/s,script/{scope=set}{exclusive}
--regex-vue=/^(<\/style>)$/\1//{scope=clear}{placeholder}
@timvisee
timvisee / falsehoods-programming-time-list.md
Last active May 31, 2025 21:15
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@dannypule
dannypule / json_to_csv.js
Created February 8, 2017 18:40
Export JSON to CSV file using Javascript
function convertToCSV(objArray) {
var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
var str = '';
for (var i = 0; i < array.length; i++) {
var line = '';
for (var index in array[i]) {
if (line != '') line += ','
line += array[i][index];
@rxaviers
rxaviers / gist:7360908
Last active June 1, 2025 09:42
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue: