Skip to content

Instantly share code, notes, and snippets.

View jbergstroem's full-sized avatar

Johan Bergström jbergstroem

View GitHub Profile

Drupal 7 runtime optimizations

Here's a couple of ideas for increasing Drupal runtime speeds I picked up while digging trough the code.

array_key_exists -> isset

replace array_key_exists($name,$array) with isset($array[$key]);

diff --git a/_pylibmcmodule.c b/_pylibmcmodule.c
index 6c8fd5e..e5eaab8 100644
--- a/_pylibmcmodule.c
+++ b/_pylibmcmodule.c
@@ -1715,7 +1715,7 @@ static PyObject *_PylibMC_GetPickles(const char *attname) {
static PyObject *_PylibMC_Unpickle(const char *buff, size_t size) {
PyObject *pickle_load;
PyObject *retval = NULL;
-
+
diff --git a/world.py b/world.py
index 131cfce..99728c1 100644
--- a/world.py
+++ b/world.py
@@ -299,6 +299,11 @@ def get_worlds():
"Returns {world # : level.dat information}"
ret = {}
save_dir = get_save_dir()
+
+ # No dirs found - most likely not running from inside minecraft-dir
@jbergstroem
jbergstroem / fix-old-htdocs.diff
Created April 15, 2011 06:20
removes reference to old httpd dir
diff --git a/configure.ac b/configure.ac
index c873775..7e0500b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,7 +27,6 @@ AC_CONFIG_FILES([
Makefile
src/Makefile
include/Makefile
- htdocs/Makefile
third-party/Makefile
@jbergstroem
jbergstroem / pep8.patch
Created April 28, 2011 10:06
PEP8 fixes
diff --git a/spritecss/__init__.py b/spritecss/__init__.py
index 9cf604a..8e2881a 100644
--- a/spritecss/__init__.py
+++ b/spritecss/__init__.py
@@ -15,6 +15,7 @@ generator
references to sprites that have been mapped.
"""
+
class SpriteMap(list):
@jbergstroem
jbergstroem / pylibmc-nosetests-setup.cfg.diff
Created October 26, 2011 21:28
nose.config.ConfigError: Error reading config file 'setup.cfg': no such option 'with-info'
commit 5cad76ab11f00cf203a94520cbd5f4be43f37957
Author: jbergstroem
Date: Mon Oct 24 19:26:38 2011 +0200
nose.config.ConfigError: Error reading config file 'setup.cfg': no such option 'with-info'
diff --git a/setup.cfg b/setup.cfg
index 7dcc168..187daf2 100644
--- a/setup.cfg
+++ b/setup.cfg
@jbergstroem
jbergstroem / node-python3.diff
Created November 15, 2011 11:55
Node/gyp: Add support for python3
diff --git a/configure b/configure
index 0ec745c..3296c10 100755
--- a/configure
+++ b/configure
@@ -211,7 +211,7 @@ def configure_openssl(o):
o['variables']['node_use_system_openssl'] = 'false'
-print "configure options:", options
+print("configure options:", options)
@jbergstroem
jbergstroem / json-to-pprint.patch
Created November 30, 2011 17:05
s/json/pprint/
diff --git a/configure b/configure
index d767508..dd50189 100755
--- a/configure
+++ b/configure
@@ -2,7 +2,7 @@
import optparse
import os
-import json
+from pprint import pprint
@jbergstroem
jbergstroem / stdout.log
Created June 12, 2012 08:20
node 517cea36
ϟ ps aux | grep node
buildbot 10384 0.0 0.3 25824 6172 ? Sl Apr25 4:00 /usr/bin/python2.7 /usr/bin/twistd --no_save --logfile=/var/lib/build/node/twistd.log --pidfile=/var/lib/build/node/buildslave.pid --python=/var/lib/build/node/buildbot.tac
buildbot 13155 96.2 5.3 124476 83672 ? Rl 16:49 85:46 /var/lib/build/node/linux32/build/out/Release/node --debug-brk /var/lib/build/node/linux32/build/test/fixtures/empty.js
buildbot 13156 96.2 5.3 124476 83612 ? Rl 16:49 85:49 /var/lib/build/node/linux32/build/out/Release/node --debug-brk=5959 /var/lib/build/node/linux32/build/test/fixtures/empty.js
ϟ date
Tue Jun 12 18:18:26 EST 2012
@jbergstroem
jbergstroem / mariadb-55-gentoo-patches.diff
Created July 26, 2012 02:33
mariadb-55-gentoo-patches.diff
commit 9632d4be9621323afbb7c16524c272dc3641a4d4
Author: jbergstroem <bugs@bergstroem.nu>
Date: Thu Jul 26 10:26:12 2012 +1000
Version bump
diff --git a/dev-db/mariadb/mariadb-5.5.23.ebuild b/dev-db/mariadb/mariadb-5.5.23.ebuild
deleted file mode 100644
index 36e417b..0000000