Skip to content

Instantly share code, notes, and snippets.

View dominikwilkowski's full-sized avatar
🤖
Working

Dominik Wilkowski dominikwilkowski

🤖
Working
View GitHub Profile
@Dan-Q
Dan-Q / _no_code_page_.php
Last active December 28, 2023 18:01
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@0xabad1dea
0xabad1dea / copilot-risk-assessment.md
Last active September 11, 2023 10:21
Risk Assessment of GitHub Copilot

Risk Assessment of GitHub Copilot

0xabad1dea, July 2021

this is a rough draft and may be updated with more examples

GitHub was kind enough to grant me swift access to the Copilot test phase despite me @'ing them several hundred times about ICE. I would like to examine it not in terms of productivity, but security. How risky is it to allow an AI to write some or all of your code?

Ultimately, a human being must take responsibility for every line of code that is committed. AI should not be used for "responsibility washing." However, Copilot is a tool, and workers need their tools to be reliable. A carpenter doesn't have to

@sindresorhus
sindresorhus / esm-package.md
Last active April 19, 2024 10:56
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@LeZuse
LeZuse / 00_README.md
Last active April 12, 2024 12:56
Install node on Apple Silicon M1 both ARM and x86 (Rosetta)

Node.js on Apple Silicon

Node Version Manager (https://github.com/nvm-sh/nvm) works perfectly across native node installations as well as emulated Rosetta installations. The trick I am using here is to install one LTS version of node under Rosetta and another stable version as native binary.

TODO

  • find a way how to run the same node version on both platforms
@dominikwilkowski
dominikwilkowski / README.md
Created September 5, 2020 02:57
ANSI codes for cli controled output

ANSI escape codes

ANSI escape codes can be printed to a shell to as instructions. The below is a list of codes I have used often in my CLI programs and I find myself looking up over and over again.

A great article about it can be found here.

Content

@surpher
surpher / rust_to_swift.md
Last active April 19, 2024 13:55
Building binaries from Rust to iOS/macOS (PactSwift specific)
@dominikwilkowski
dominikwilkowski / README.md
Last active November 19, 2021 23:26
Signed git commits with Git Tower on Catalina and Monterey
@rohan-deshpande
rohan-deshpande / CONDITIONALLY_ASYNC_LOAD_BY_VIEWPORT_SIZE.md
Last active June 23, 2020 23:34
What is the best way to conditionally async load components based on initial viewport size?

Question:

Thinking about this in a nextjs context, let's say we have two components Video and AnimatedGif. For larger screens, we want to load the video, but for smaller screens, and perhaps slower devices, we want to show the gif. We also want to async load these, because they shouldn't block the rest of the page. They are media items so they don't need to be SSR'd, and also it would be good if this could be done with Suspense in mind. Any ideas?

Answer:

Create a custom hook, something like useDeviceAndViewport() that returns the relevant info. You need to know the network status, the viewport dimensions and whether the element is within the viewport.

@jackdomleo7
jackdomleo7 / Useful_global_CSS.css
Last active October 24, 2023 08:49
A set of useful global CSS defaults to add to your site alongside a reset stylesheet (with explanations)
/*! NOTE: These are just recommended default global styles, edit as required */
@import ('Import reset stylesheet here, (I recommend modern-normalize) or even better, import the reset stylesheet in the HTML as the first imported stylesheet');
::selection { /* Optional */
/* It can be really hard to read highlighted text with a text-shadow, it should be removed when selected */
text-shadow: none;
/* NOTE: Using this means the color and background-color are set to transparent for selected text... */
/* So you can customise your styles below */
@fnky
fnky / ANSI.md
Last active April 18, 2024 15:47
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27