Skip to content

Instantly share code, notes, and snippets.

View pdewouters's full-sized avatar
🌄
Working from home

Paul de Wouters pdewouters

🌄
Working from home
View GitHub Profile
@slikts
slikts / advanced-memo.md
Last active April 27, 2024 02:40
Advanced memoization and effects in React

nelabs.dev

Advanced memoization and effects in React

Memoization is a somewhat fraught topic in the React world, meaning that it's easy to go wrong with it, for example, by [making memo() do nothing][memo-pitfall] by passing in children to a component. The general advice is to avoid memoization until the profiler tells you to optimize, but not all use cases are general, and even in the general use case you can find tricky nuances.

Discussing this topic requires some groundwork about the technical terms, and I'm placing these in once place so that it's easy to skim and skip over:

  • Memoization means caching the output based on the input; in the case of functions, it means caching the return value based on the arguments.
  • Values and references are unfortunately overloaded terms that can refer to the low-level implementation details of assignments in a language like C++, for example, or to memory
@bradtraversy
bradtraversy / docker_wordpress.md
Last active June 19, 2024 17:24
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@maxvt
maxvt / infra-secret-management-overview.md
Last active February 28, 2024 20:53
Infrastructure Secret Management Software Overview

Currently, there is an explosion of tools that aim to manage secrets for automated, cloud native infrastructure management. Daniel Somerfield did some work classifying the various approaches, but (as far as I know) no one has made a recent effort to summarize the various tools.

This is an attempt to give a quick overview of what can be found out there. The list is alphabetical. There will be tools that are missing, and some of the facts might be wrong--I welcome your corrections. For the purpose, I can be reached via @maxvt on Twitter, or just leave me a comment here.

There is a companion feature matrix of various tools. Comments are welcome in the same manner.

JedWatson/classnames (2650855 dls, 1465 stars)
yannickcr/eslint-plugin-react (2077066 dls, 710 stars)
rackt/react-router (1833204 dls, 9050 stars)
facebook/react-dom (782024 dls, 33044 stars)
gaearon/react-hot-loader (708042 dls, 3250 stars)
rackt/redux (568969 dls, 10743 stars)
rackt/react-redux (495498 dls, 1509 stars)
jsdf/coffee-react-transform (463488 dls, 380 stars)
JedWatson/react-input-autosize (455277 dls, 107 stars)
reflux/reflux (393281 dls, 4316 stars)
@krogsgard
krogsgard / template-file.php
Last active January 29, 2016 17:21
Stuff for wrangling Jetpack. End result is along these lines: https://cldup.com/8x050WNF_L.png
<?php echo krogs_output_related_posts(); ?>
@ericelliott
ericelliott / essential-javascript-links.md
Last active May 17, 2024 03:38
Essential JavaScript Links
@JustinSainton
JustinSainton / gist:36be9fb9c7d9f55f6e37
Created November 28, 2014 22:34
Scrutinizer CI Config for WP eCommerce
tools:
puppet_lint:
flags: ''
js_hint: true
php_mess_detector:
config:
naming_rules: { boolean_method_name: true }
controversial_rules: { superglobals: false }
php_code_sniffer:
config:
@markjaquith
markjaquith / nginx.conf
Last active December 25, 2022 15:55
My WordPress Nginx setup
upstream phpfpm {
server unix:/var/run/php5-fpm.sock;
}
upstream hhvm {
server unix:/var/run/hhvm/hhvm.sock;
}
# SSL
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
@matgargano
matgargano / test-demo-plugin.php
Created September 22, 2014 15:33
Sample Tests for WordPress Unit Test Tutorial
<?php
class Demo_Test extends WP_UnitTestCase {
/**
* @covers Demo_Plugin::init
*/
function test_init() {
$demo_plugin = $this->getMockBuilder( 'Demo_Plugin' )
@jeremeamia
jeremeamia / min-sdk-instructions.md
Last active August 29, 2015 14:05
Minimal AWS SDK Build

Minimal AWS SDK Build

The AWS SDK for PHP provides API access to 44 of the services offered by Amazon Web Services. It does so by leveraging existing libraries like Guzzle (HTTP client and web service client framework) and the Symfony Event Dispatcher. The best way to install the SDK is using Composer, which helps you install and manage the SDK's dependencies.

However, if you really want to trim down the SDK code for a specific reason, you can download the source of the SDK, and its dependencies using the aws.zip, and remove the parts you don't need. Here is how to do it:

  1. Follow the instructions in the user guide for Installing Via Zip.
  2. Unzip aws.zip.
  3. If you are not using caching features, delete the Doctrine directory.
  4. If you are not using logging features, delete the Monolog and Psr directories.