Skip to content

Instantly share code, notes, and snippets.

@Convly
Convly / strapi-content-api.ts
Last active April 26, 2025 07:12
PoC for dynamic content API response types
import type { Attribute, Common, Utils } from '@strapi/types';
type IDProperty = { id: number };
type InvalidKeys<TSchemaUID extends Common.UID.Schema> = Utils.Object.KeysBy<
Attribute.GetAll<TSchemaUID>,
Attribute.Private | Attribute.Password
>;
export type GetValues<TSchemaUID extends Common.UID.Schema> = {
@MrChocolatine
MrChocolatine / TS - More precise return type method Date#toISOString.d.ts
Last active June 3, 2025 07:09
TypeScript – How to accurately type dates in ISO 8601 format
// In TS, interfaces are "open" and can be extended
interface Date {
/**
* Give a more precise return type to the method `toISOString()`:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
*/
toISOString(): TDateISO;
}
type TYear = `${number}${number}${number}${number}`;
@juniorcesarabreu
juniorcesarabreu / sharing-folder-windows-macos-vmware.md
Created March 30, 2020 22:16
Sharing a folder between windows and mac os x on vmware

You need to follow this procedure in order to share files between Windows 7 and Mac OS X on VMWare :

  1. Go in your virtual machine settings and select 'Options' tab.
  2. Click on 'Folder Sharing' and tick 'Always enabled'.
  3. Click on 'Add' button and select a folder you want to share.
  4. Confirm virtual machine settings.
  5. From 'System preferences' on Mac OS X, select 'Sharing'.
  6. Make sure that 'File Sharing' is enabled.
  7. From top menu bar, select 'Go' and 'Computer'.
  8. You will now see a folder named '/'. This is your shared folder between Windows 7 and Mac OS X.
@teocci
teocci / ffmpeg_install_latest.md
Last active September 13, 2023 02:17
Easy way to convert MKV to MP4 with ffmpeg

How to install FFmpeg on Ubuntu

FFmpeg is a free and open source command line tool for transcoding multimedia files. It contains a set of shared audio and video libraries such as: libavcodec, libavformat, and libavutil. With this tool, you can convert between various video and audio formats, set sample rates and resize videos.

In this document will show you how to install a stable version and the latest version of FFmpeg. This instructions apply for any Ubuntu based distribution, including Linux Mint and Elementary OS.

Prerequisites

In order to be able to add new repositories and install packages on your Ubuntu system, you must be logged in as a user with sudo privileges.

Installing FFmpeg 4.x on Ubuntu

@Isa3v
Isa3v / README.md
Last active January 15, 2025 13:27
Пагинация в мета-тегах и h1 (Bitrix)

Пагинация в мета-тегах, h1 + canonical (Bitrix)

Задача:

*Добавить на страницах пагинации в title, description и h1 приписку с номером страницы

Решение:

*В bitrix/php_interface/init.php (если нет, то создаем) добавляем в конец функцию разбирающая мета-теги и собирающая обратно

Событие "OnEpilog" вызывается в конце визуальной части эпилога сайта. (После того как битрикс получит уже все данные страницы)

@brenopolanski
brenopolanski / export-svg-inkscape.md
Created December 26, 2017 13:29
Exporting an object as svg from inkscape
  1. Select the object(s) to export
  2. Open the document properties window (Ctrl+Shift+D)
  3. Select "Resize page to drawing or selection"
  4. File > Save As Copy...
  5. Select Optimized SVG as the format if you want to use it on the web
@bob-lee
bob-lee / polyfill-ie11-nodelist-foreach.js
Created November 24, 2017 18:41
Polyfill for IE11 missing NodeList.forEach
if ('NodeList' in window && !NodeList.prototype.forEach) {
console.info('polyfill for IE11');
NodeList.prototype.forEach = function (callback, thisArg) {
thisArg = thisArg || window;
for (var i = 0; i < this.length; i++) {
callback.call(thisArg, this[i], i, this);
}
};
}
@meetkabeershah
meetkabeershah / default nginx configuration file
Last active January 11, 2025 12:19
The default nginx configuration file inside /etc/nginx/sites-available/default
# Author: Zameer Ansari
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
@pongo
pongo / .htaccess
Last active March 5, 2020 07:49
serves a .webp image instead of jpg/png
<IfModule mod_rewrite.c>
RewriteEngine On
# serves a .webp image instead of jpg/png
RewriteCond %{HTTP_ACCEPT} image/webp
RewriteCond %{REQUEST_FILENAME} ^(.+)\.(jpe?g|png)$
RewriteCond %1\.webp -f
RewriteRule ^(.+)\.(jpe?g|png)$ $1.webp [T=image/webp,E=accept:1]
</IfModule>
@lucasg
lucasg / dash-doggybag.py
Last active June 11, 2025 03:11
Bulk downloader for dash docsets (official and user contributed)
#!/usr/bin/env python3
import sys
import json
import os
import os.path
import shutil
import logging
import tempfile
import glob
import argparse