Skip to content

Instantly share code, notes, and snippets.

View matzeeable's full-sized avatar
💭
Looking for improvements!

Matthias Günter matzeeable

💭
Looking for improvements!
View GitHub Profile
@jbroadway
jbroadway / Slimdown.md
Last active February 5, 2024 10:43
Slimdown - A simple regex-based Markdown parser.
@mekwall
mekwall / bandwidth.js
Created January 4, 2013 22:50
How to measure bandwidth of a server in Node.js (and some other statistics)
const net = require("net");
var server = net.createServer(function (c) {
var oldWrite = c.write;
c.write = function(d) {
if (!Buffer.isBuffer(d)) {
d = new Buffer(d);
}
oldWrite.call(this, d);
server.bytesSent += d.length;
@JustThomas
JustThomas / wordpress-multisite-internal-redirect-loop.md
Last active March 27, 2024 14:45
WordPress Multisite: How to fix error "too many redirects"

WordPress Multisite: How to fix error "Request exceeded the limit of 10 internal redirects"

I am running a WordPress multisite network with sub-directory setup. When I check my error.log file, it is full of entries like this one:

Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'Limit InternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.

The problem was, in my case, one specific rewrite rule in the .htaccess file.

Problem description

How you can help reduce node_modules bloat

This recent reddit thread reveals discontent among the web development community about the sheer volume of stuff in a typical node_modules dir. 140MB in this case!

Is it a design flaw in npm?

Opinions in the thread varied from "I'm surprised npm even works" to "everything is fine". I'm not going to offer an opinion, just these two observations:

  1. node_modules dirs typically do contain lots of stuff that doesn't need to be there.
  2. The latest version mitigates overall size by flattening the dependency tree, but some of the bloat is beyond npm's control.
# Extension package to add on Ubuntu 14.04
sudo apt-get install libxml2-dev libbz2-dev libmcrypt-dev libreadline-dev libxslt1-dev autoconf -y
# Extension package to add on Ubuntu 18.04
sudo apt-get install libssl-dev
# Extension package to add on Ubuntu 20.04
sudo apt install -y pkg-config libssl-dev libsqlite3-dev libbz2-dev libxml2-dev libcurl4-openssl-dev libonig-dev libpq-dev libreadline-dev libxslt1-dev libzip-dev libsodium-dev libwebp-dev
# +apxs2
sudo apt-get install apache2-dev -y
@heiswayi
heiswayi / repo-reset.md
Created February 5, 2017 01:32
GitHub - Delete commits history with git commands

First Method

Deleting the .git folder may cause problems in our git repository. If we want to delete all of our commits history, but keep the code in its current state, try this:

# Check out to a temporary branch:
git checkout --orphan TEMP_BRANCH

# Add all the files:
git add -A
@ahmadawais
ahmadawais / .babelrc
Last active August 2, 2020 00:55
Basic Gutenberg Custom Block with ESNext, Webpack, BabelJS— https://github.com/ahmadawais/Gutenberg-Boilerplate/tree/master/block/02-basic-esnext
{
"presets": [
[ "env", {
"modules": false,
"targets": {
"browsers": [
"last 2 Chrome versions",
"last 2 Firefox versions",
"last 2 Safari versions",
"last 2 iOS versions",
@spacedmonkey
spacedmonkey / Function.txt
Last active February 17, 2020 11:58
WordPress core private Functions and Classes.
Functions
startElement
endElement
_wp_menu_output
_add_themes_utility_last
_wp_ajax_delete_comment_response
_wp_ajax_add_hierarchical_term
wp_link_manager_disabled_message
_wp_credits_add_profile_link
@frafra
frafra / .gitlab-ci.yml
Created November 6, 2020 15:46
Build containers with GitLab CI without root nor daemons by using buildkit
build-container:
stage: build
image:
name: moby/buildkit:rootless
entrypoint: [ "sh", "-c" ]
variables:
BUILDKITD_FLAGS: --oci-worker-no-process-sandbox
before_script:
- |
mkdir ~/.docker
@Raistlfiren
Raistlfiren / Dockerfile
Last active August 14, 2023 19:02
XDebug 3 and Docker Reference
FROM php:7.4-cli-alpine
# Install xdebug
RUN apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS \
&& pecl install xdebug \
&& docker-php-ext-enable xdebug \
&& apk del .phpize-deps
WORKDIR /var/www/html