Skip to content

Instantly share code, notes, and snippets.

View iamstoick's full-sized avatar

Stoick The Vast iamstoick

  • Philippines
View GitHub Profile
@iamstoick
iamstoick / gist:5b70d0befdaa045cc10fefc610352f2c
Created January 3, 2020 09:30 — forked from mloberg/gist:2852153
MySQL Slow Query Log Analyzer
#!/usr/bin/php
<?php
/**
* The Analyzer class.
*/
class Analyzer {
private $fp;
$modules = array();
$status = array('rc', 'dev', 'alpha', 'beta',);
foreach (system_rebuild_module_data() as $module) {
// We deal only with enabled modules.
if ($module->status != 1) {
continue;
}
// We deal only with contrib modules.
(function ($) {
Drupal.behaviors.collapsibleTable = {
attach: function(settings, content) {
$('tr.collapsitablesection').toggle(
function() {
$(this).nextUntil('tr.collapsitablesection').hide();
},
function() {
$(this).nextUntil('tr.collapsitablesection').show();
}
Drupal.equalHeight = function(group) {
if ($(group).length > 0) {
var tallest = 0, thisHeight = 0;
$(group).each(function() {
thisHeight = $(this).height();
if (thisHeight > tallest) {
tallest = thisHeight;
}
});
@iamstoick
iamstoick / plot.p
Created May 12, 2016 05:13 — forked from tejesh0/plot.p
Graphing apache benchmark results with gnuplot
# Output to a jpeg file
set terminal jpeg size 1280,720
# Set the aspect ratio of the graph
set size 1, 1
# The file to write to
set output "timeseries.jpg"
# The graph title
@iamstoick
iamstoick / .htaccess
Created May 12, 2016 05:07 — forked from khoipro/.htaccess
Optimization: Add Expires headers in .htaccess
<IfModule mod_expires.c>
# Enable expirations
ExpiresActive On
# Default directive
ExpiresDefault "access plus 1 month"
# My favicon
ExpiresByType image/x-icon "access plus 1 year"
# Images
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
@iamstoick
iamstoick / .htaccess
Created May 12, 2016 05:07 — forked from khoipro/.htaccess
CSS Fonts missing - No Access-Control-Allow-Origin header
# ----------------------------------------------------------------------
# CORS-enabled images (@crossorigin)
# ----------------------------------------------------------------------
# Send CORS headers if browsers request them; enabled by default for images.
# developer.mozilla.org/en/CORS_Enabled_Image
# blog.chromium.org/2011/07/using-cross-domain-images-in-webgl-and.html
# hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/
# wiki.mozilla.org/Security/Reviews/crossoriginAttribute
<IfModule mod_setenvif.c>
<IfModule mod_headers.c>
try {
function foo() {
foo();
}
foo();
} catch(e) {
window.location.href="http://stackoverflow.com/search?q=[js]+" + e.message || e;
}