Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* Minifies and removes unneeded cache tags.
*
* @param array $cache_tags
* List of cache tags.
*
* @return array
* Shortened and cleaned up cache tag list.
@larowlan
larowlan / core-process.md
Created October 11, 2014 00:17
Thoughts on core process and roadmaps

My thoughts on core process and roadmaps

Prelude

Much of what is proposed here is a large shift from Drupal's traditional feature addition process which has been largely informal. In the past because of our long release cycles consideration of such a process would have been foolish and this degree of formality would only have discouraged involvement. Now that we're moving towards semantic versioning, the release of Drupal 8 and a move to regular six-monthly minor releases means we're now in a position to consider this kind of formal process. Its a sign that we're maturing as an open source community. Parts of the process, in particular the voting, are modelled on other successful open-source projects that have the same level of maturity as ours. The thoughts proposed here are just that, thoughts. They've been influenced by core conversations at Drupalcon Amsterdam as well as a significant twitter thread on the topic. Please read the whole thing before comme

# swith to sudo
sudo -i
# create swap
touch /2GiB.swap
chattr +C /2GiB.swap
fallocate -l 2048m /2GiB.swap
chmod 600 /2GiB.swap
mkswap /2GiB.swap
@mundry
mundry / Makefile
Created May 9, 2014 18:23
A Makefile to build SASS files with automatically generated dependencies from a target's imports.
OUTPUT_DIR := build
SOURCES_DIR := styles
DEPS_DIR := .deps
RM := rm -rf
RUBY := ruby
SASS := scss
SASS_OPTIONS := --unix-newlines
SASS_OPTIONS += --style compressed
SASS_OPTIONS += --precision 8
@magnetikonline
magnetikonline / README.md
Last active April 30, 2024 00:45
Setting Nginx FastCGI response buffer sizes.
@lox
lox / Makefile
Last active March 28, 2018 12:55
Replaced Grunt/Gulp with a Makefile
SASSC = sass --style compact
COMPSDIR = resources/assets/components
SASSDIR = resources/assets/css
JSDIR = resources/assets/js
DISTDIR = web/dist
CSSDIR = $(DISTDIR)/css
SASSINC = $(SASSDIR) \
$(COMPSDIR)/asimov/src/scss \
$(COMPSDIR)/asimov-contests/src/scss \
$(COMPSDIR)/asimovicons/src/scss
@sun
sun / reinstall.php
Last active December 31, 2015 06:39
D8 reinstall.php
<?php
/**
* This gist is no longer maintained - it is a proper repo now:
*
* @see https://github.com/sun/drupal-reinstall
*/
# ██╗ ██╗██████╗ ██████╗ ███╗ ██╗ ██████╗
@sdboyer
sdboyer / AssetGraph.php
Last active December 23, 2015 00:19
new grouper
<?php
/**
* @file
* Contains \Drupal\Core\Asset\AssetGraph.
*/
namespace Drupal\Core\Asset;
use Gliph\Graph\DirectedAdjacencyGraph;
@geerlingguy
geerlingguy / SonarDrupalKeyGenerator.php
Last active January 30, 2024 16:47
A simple PHP script to generate the XML necessary for Sonar to detect the Drupal Coder module's sniffs. See: https://drupal.org/node/2082563
<?php
/**
* @file
* Generate rules for Drupal Coding Standards Sniffs.
*
* SonarQube requires manually-entered PHP CodeSniffer rules if you use anything
* outside of the standard set of rules. In this case, there are a bunch of
* Drupal-specific sniffs that we'd like to use.
*
@nikic
nikic / objects_arrays.md
Last active April 12, 2024 17:05
Post explaining why objects often use less memory than arrays (in PHP)

Why objects (usually) use less memory than arrays in PHP

This is just a small post in response to [this tweet][tweet] by Julien Pauli (who by the way is the release manager for PHP 5.5). In the tweet he claims that objects use more memory than arrays in PHP. Even though it can be like that, it's not true in most cases. (Note: This only applies to PHP 5.4 or newer.)

The reason why it's easy to assume that objects are larger than arrays is because objects can be seen as an array of properties and a bit of additional information (like the class it belongs to). And as array + additional info > array it obviously follows that objects are larger. The thing is that in most cases PHP can optimize the array part of it away. So how does that work?

The key here is that objects usually have a predefined set of keys, whereas arrays don't: