Skip to content

Instantly share code, notes, and snippets.

View likern's full-sized avatar
👨‍💻
Developing a new web service

Victor Malov likern

👨‍💻
Developing a new web service
  • @relladb
  • 10:59 (UTC +03:00)
View GitHub Profile
@tauoverpi
tauoverpi / Type.zig
Created August 2, 2022 16:42
.Pointer needs to go
// https://github.com/ziglang/zig/issues/10710#issue-1116978295
const std = @import("std");
const assert = std.debug.assert;
const TypeInfo = std.builtin.TypeInfo;
pub fn Type(comptime T: TypeInfo) type {
return comptime switch (T) {
// but what is the type of type?
@floooh
floooh / zig_test_debugging_vscode.md
Last active March 9, 2025 05:21
How to debug Zig tests in VSCode

Tested on macOS:

  1. Install the CodeLLDB VSCode extension. Unlike the debugger in the C/C++ extension, this allows to set breakpoints inside Zig "test" blocks (in the MS C/C++ extension debugger, breakpoints inside test blocks will be disabled once the debugger starts for unknown reasons.
  2. When compiling the test, tell it to also emit a binary: zig test -femit-bin=zig-out/bin/my-test src/bla.zig, otherwise there will be no executable to debug.
  3. The compiled test executable expects the path to the Zig executable as first command line argument, the launch.json file needs to be setup accordingly (note the args item):
@mrousavy
mrousavy / MEMOIZE.md
Last active December 2, 2024 00:15
Memoize!!! 💾 - a react (native) performance guide
In computing, memoization or memoisation
is an optimization technique used primarily
to speed up computer programs by storing
the results of expensive function calls and  
returning the cached result when the same
inputs occur again.                                         
                                                     — wikipedia
usingnamespace @import("std").builtin;
pub const endian = Endian.Little;
pub const output_mode = OutputMode.Obj;
pub const link_mode = LinkMode.Static;
pub const is_test = false;
pub const single_threaded = false;
/// Deprecated: use `std.Target.cpu.arch`
pub const arch = Arch.x86_64;
pub const abi = Abi.gnu;
@greglockwood
greglockwood / no-extra-properties.ts
Last active August 6, 2023 21:18
NoExtraProperties<T> TypeScript type
/*********************************************************************************
Copyright (c) 2019, Greg Lockwood
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
@tanyuan
tanyuan / smart-caps-lock.md
Last active April 22, 2025 09:43
Smart Caps Lock: Remap Caps Lock to Control AND Escape

Smart Caps Lock: Remap to Control AND Escape (Linux, Mac, Windows)

Caps Lock 變成智慧的 Control 以及 Escape

  • 單獨輕按一下就是 Escape
  • 若按下時同時按著其他鍵,就會是 Control

這應該是 Vim 和 Emacs 的最佳解了!(Emacs? Bash 的快捷鍵就是 Emacs 系列的)

  • Send Escape if you tap Caps Lock alone.
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d