Skip to content

Instantly share code, notes, and snippets.

View joelpittet's full-sized avatar

Joel Pittet joelpittet

View GitHub Profile
@joelpittet
joelpittet / perf.php
Last active February 2, 2016 04:03
uasort vs uasort vs SortArray::suasort performance
<?php
// Run in your Drupal 8 root with `drush scr perf.php`
use Drupal\Component\Utility\SortArray;
$data[] = [
0 => [
'#type' => 'checkbox',
'#title' => 'A',
],
1 => [
@joelpittet
joelpittet / blueprint.css
Created January 6, 2016 20:42
Drupal Blueprint in CSS
/**
* Tweaked from http://lea.verou.me/css3patterns/#blueprint-grid
*/
background-color:#0678BE;
background-image: linear-gradient(#2A9CE2 1px, transparent 1px),
linear-gradient(90deg, #2A9CE2 1px, transparent 1px),
linear-gradient(#198BD1 1px, transparent 1px),
linear-gradient(90deg, #198BD1 1px, transparent 1px);
background-size:50px 50px, 50px 50px, 25px 25px, 25px 25px;
background-position:-1px -1px, -1px -1px, -1px -1px, -1px -1px
@joelpittet
joelpittet / custom.cnf
Created November 10, 2015 17:29
MySQL configuration tweaks
[mysqld]
max_connections = 200
# https://docs.google.com/presentation/d/1AgnurTWsWdMAFjfFmSU7mk2zfJu8jG_KmVdZ7-o6Pok/edit#slide=id.g38a438822_1330
# query_cache_size = 42M
query_cache_size = 0
query_cache_type = 0
tmp_table_size = 100M
@joelpittet
joelpittet / charset-converter.php
Last active August 10, 2016 11:50
Drupal MySQL character set converter to utf8mb4
<?php
// Helper for https://www.drupal.org/node/2488180
// Run: drush src charset-converter.php
class CharsetConverter {
/**
* Character set.
* @var string
@joelpittet
joelpittet / mysql-utf8mb4-barracuda
Created November 7, 2015 01:26 — forked from v1nc3ntlaw/mysql-utf8mb4-barracuda
MySQL using utf8mb4 and innodb_file_format Barracuda settings
[mysqld]
init_connect='SET collation_connection = utf8mb4_unicode_ci'
init_connect='SET NAMES utf8mb4'
character-set-server = utf8mb4
character-set-client = utf8mb4
collation-server = utf8mb4_unicode_ci
skip-character-set-client-handshake
innodb_file_format = Barracuda
#page-container {
background: transparent linear-gradient(to bottom,rgba(0,0,0,.5), rgba(0,0,0,0)) repeat-x fixed left top;
}
#everything {
box-shadow: 0 0 50px rgba(0,0,0,.15);
}
#sidebar-right, .right-sidebar {
padding: 20px;
@joelpittet
joelpittet / confirm.js
Last active October 30, 2015 16:37
Capture and release events.
function triggerEvents(events, e) {
$.each(events, function() {
this.handler.apply(e.currentTarget, [e]);
});
}
function confirmDialog(e) {
e.preventDefault();
e.stopPropagation();
var events = $(this).data('originalEvents');
@joelpittet
joelpittet / modules.txt
Last active October 29, 2015 21:38
enabled modules
# drush pml --status=enabled
Package Name Type Version
Access control Nodeaccess (nodeaccess) Module 7.x-1.4+6-dev
Administration Administration menu (admin_menu) Module 7.x-3.0-rc5
Administration Administration menu Adminimal Theme (adminimal_admin_menu) Module 7.x-1.6
Administration Administration views (admin_views) Module 7.x-1.5
Administration Coffee (coffee) Module 7.x-2.2+7-dev
Administration Filter permissions (filter_perms) Module 7.x-1.0+0-dev
Administration Module filter (module_filter)
@joelpittet
joelpittet / SassMeister-input.scss
Created October 13, 2015 18:50
Generated by SassMeister.com.
// ----
// libsass (v3.2.5)
// ----
.component {
.svg {
// Default Nested.
color: pink;
}
}