Skip to content

Instantly share code, notes, and snippets.

@macbookandrew
macbookandrew / merge-minify-refresh-async.php
Last active December 26, 2024 16:08
Force merged scripts created by “Merge + Minify + Refresh” to load asynchronously to improve site performance
<?php
/*
* Plugin Name: Merge + Minify + Refresh: Force Async Scripts
* Plugin URL: https://gist.github.com/macbookandrew/0bb0c29b2321c166845cea0b7cdb5d15
* Description: Forces merged scripts created by “Merge + Minify + Refresh” to load asynchronously to improve site performance
* Version: 1.0.0
* Author: AndrewRMinion Design
* Author URI: https://andrewrminion.com
*/
@charrondev
charrondev / tauri_traffic_light_positioner_plugin.rs
Last active December 26, 2024 16:06
This code describes a mechanism to adjust traffic light positioning on MacOS with Tauri 2.x
use objc::{msg_send, sel, sel_impl};
use rand::{distributions::Alphanumeric, Rng};
use tauri::{
plugin::{Builder, TauriPlugin},
Manager, Runtime, Window,
}; // 0.8
const WINDOW_CONTROL_PAD_X: f64 = 15.0;
const WINDOW_CONTROL_PAD_Y: f64 = 23.0;
@RonanGil
RonanGil / Conventions_WinForms.txt
Created July 24, 2023 15:48
Naming Conventions - winForms
# Componentes Windows Forms
Common Controls:
----------------
btn Button chk CheckBox ckl CheckedListBox
cmb ComboBox dtp DateTimePicker lbl Label
llb LinkLabel lst ListBox lvw ListView
mtx MaskedTextBox cdr MonthCalendar icn NotifyIcon
nud NumeircUpDown pic PictureBox prg ProgressBar
rdo RadioButton rtx RichTextBox txt TextBox
@yifanzz
yifanzz / code-editor-rules.md
Created December 17, 2024 00:01
EP12 - The One File to Rule Them All

[Project Name]

Every time you choose to apply a rule(s), explicitly state the rule(s) in the output. You can abbreviate the rule description to a single word or phrase.

Project Context

[Brief description ]

  • [more description]
  • [more description]
  • [more description]
@FreddieOliveira
FreddieOliveira / docker.md
Last active December 26, 2024 15:51
This tutorial shows how to run docker natively on Android, without VMs and chroot.

Docker on Android 🐋📱

Edit 🎉

All packages, except for Tini have been added to termux-root. To install them, simply pkg install root-repo && pkg install docker. This will install the whole docker suite, left only Tini to be compiled manually.


Summary

// page.tsx
import PaginationControls from '@/components/PaginationControls'
import Image from 'next/image'
const data = [
'entry 1',
'entry 2',
'entry 3',
'entry 4',
#include <stdio.h>
#include <stdlib.h>
#define da_append(xs, x) \
do { \
if ((xs)->count >= (xs)->capacity) { \
if ((xs)->capacity == 0) (xs)->capacity = 256; \
else (xs)->capacity *= 2; \
(xs)->items = realloc((xs)->items, (xs)->capacity*sizeof(*(xs)->items)); \
} \
@karpathy
karpathy / min-char-rnn.py
Last active December 26, 2024 15:44
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@tclementdev
tclementdev / libdispatch-efficiency-tips.md
Last active December 26, 2024 15:43
Making efficient use of the libdispatch (GCD)

libdispatch efficiency tips

The libdispatch is one of the most misused API due to the way it was presented to us when it was introduced and for many years after that, and due to the confusing documentation and API. This page is a compilation of important things to know if you're going to use this library. Many references are available at the end of this document pointing to comments from Apple's very own libdispatch maintainer (Pierre Habouzit).

My take-aways are:

  • You should create very few, long-lived, well-defined queues. These queues should be seen as execution contexts in your program (gui, background work, ...) that benefit from executing in parallel. An important thing to note is that if these queues are all active at once, you will get as many threads running. In most apps, you probably do not need to create more than 3 or 4 queues.

  • Go serial first, and as you find performance bottle necks, measure why, and if concurrency helps, apply with care, always validating under system pressure. Reuse