Skip to content

Instantly share code, notes, and snippets.

View tloudon's full-sized avatar

tloudon

View GitHub Profile
@tloudon
tloudon / .gitignore
Created May 11, 2017 15:52
sample wp gitignore
*.log
.DS_Store
wp-config-sample.php
wp-config.php
wp-content/backupwordpress*
wp-content/advanced-cache.php
wp-content/backup-db/
wp-content/backups/
wp-content/blogs.dir/
wp-content/cache/
> bufferutil@1.1.0 install /var/www/codecombat/node_modules/bufferutil
> node-gyp rebuild
make: Entering directory `/var/www/codecombat/node_modules/bufferutil/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
In file included from ../src/bufferutil.cc:16:0:
../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) {
^
@tloudon
tloudon / i_can_has_api.php
Created October 6, 2015 22:40
example api check
$api_check = FALSE;
$headers = getallheaders();
foreach($headers as $key => $value) {
if (stripos($key, 'X-API') !== FALSE) {
$api_check = TRUE;
}
}
// you get the idea ^
// so contrib modules can get patches to opt-out of expensive hook_init/hook_boot or whatever rendering
// needs that may be horribly expensive and unnecessary for an API call
@tloudon
tloudon / bootstrap.php
Created October 6, 2015 22:27
bootstrap drupal, just to see how long it takes to load files, db, sessions, etc. no render
<?php
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
@tloudon
tloudon / -
Created August 18, 2015 22:48
[OK] Logged in using credentials from debian maintenance account.
>> MySQLTuner 1.5.0 - Major Hayden <major@mhtx.net>
>> Bug reports, feature requests, and downloads at http://mysqltuner.com/
>> Run with '--help' for additional options and output filtering
[OK] Currently running supported MySQL version 5.5.44-MariaDB-1ubuntu0.14.04.1
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -------------------------------------------
[--] Status: +ARCHIVE +Aria +BLACKHOLE +CSV +FEDERATED +InnoDB +MRG_MYISAM +SPHINX 
[--] Data in MEMORY tables: 125K (Tables: 1)
; Start a new pool named 'www'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
[www]
; Per pool prefix
; It only applies on the following directives:
; - 'slowlog'
; - 'listen' (unixsocket)
; - 'chroot'
@tloudon
tloudon / gist:5447808
Created April 23, 2013 22:04
old Harvest ruby client, just used for example and simplicity. Harvest has a newer, more robust, (official?) client @ https://github.com/zmoazeni/harvested available as the harvested gem.
# Insert your subdomain i.e. subdomain.harvestapp.com
SUBDOMAIN = 'mycompany'
# Your email. Note that features hidden from non-administrator
# accounts on the WEB UI will be inaccessible in the API as well. The
# full API is available to users with admin privileges only!
ACCOUNT_EMAIL = 'tim@example.com'
# Your password. Harvest uses HTTP Basic Auth.
ACCOUNT_PASSWORD = 'correcthorsebatterystaple'
20 function mongodb_session_user_update($edit, $account) {
21 // Update field values for changed values of the user.
22 $roles = _mongodb_session_get_roles($account);
23 // If mongodb_field_storage is enabled it will take care of creating
24 // initial user entry just add roles to it.
25 if (module_exists('mongodb_field_storage')) {
26 $wrote = &drupal_static('mongodb_field_storage_field_storage_write', array());
27 $wrote['user'][$account->uid] = TRUE;