Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* @file
* Definition of Drupal\Core\Cache\ArrayBackend.
*/
namespace Drupal\Core\Cache;
/**
@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
*/
# ██╗ ██╗██████╗ ██████╗ ███╗ ██╗ ██████╗
@wimleers
wimleers / AFTER.txt
Last active December 16, 2015 16:10
(Assuming jQuery is loaded anyway, i.e. excluding jQuery.) BEFORE: Edit (custom code) + deps: VIE, Create.js, Backbone, Underscore, jQuery UI Widget, jQuery UI Core AFTER: Edit (custom code) + deps: Backbone, Underscore
$ grunt
Running "concat:edit" (concat) task
File "build/edit.js" created.
Running "min:edit" (min) task
File "build/edit.min.js" created.
Uncompressed size: 83949 bytes.
Compressed size: 7684 bytes gzipped (29545 bytes minified).
Running "min:backbone" (min) task
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@wimleers
wimleers / .htaccess
Created November 15, 2011 06:37
.htaccess file to only allow downloads from Amazon CloudFront.
Options +FollowSymLinks -MultiViews
RewriteEngine On
SetEnvIf User-Agent ^Amazon Cloudfront$ cdn
Order Deny,Allow
Deny from all
Allow from env=cdn
@wimleers
wimleers / php-codesize.py
Created August 10, 2011 21:59
Calculates the size of the PHP codebase of all sites.
#!/usr/bin/env python
# Calculates the size of the PHP codebase of all sites.
import os
import optparse
import subprocess
def calculate(http_root_dir):
sites = list_sites(http_root_dir)
@wimleers
wimleers / output.txt
Created May 23, 2011 19:17
Master thesis working! This is some sample output.
mining association rules complete, # association rules: 166
(
{episode:css(0), ua:WinXP:Firefox(60)} => {duration:slow(16)} (conf=0.280632)
{episode:css(0), ua:WinXP:Firefox(60), ua:WinXP:Firefox:3(61)} => {duration:slow(16)} (conf=0.290043)
{episode:css(0), ua:WinXP:Firefox:3(61)} => {duration:slow(16)} (conf=0.290043)
{episode:pageready(39)} => {duration:slow(16)} (conf=0.398305)
{location:AS(3), episode:css(0)} => {duration:slow(16)} (conf=0.216981)
{location:AS(3), episode:pageready(39)} => {duration:slow(16)} (conf=0.639344)
{location:AS(3), episode:totaltime(40)} => {duration:slow(16)} (conf=0.639344)
{location:AS(3), ua:WinXP:IE(8), episode:frontend(19)} => {duration:slow(16)} (conf=0.468927)
@wimleers
wimleers / weird.cpp
Created May 23, 2011 18:29
Note that the array index that is used goes beyond the array's capacity. And thus it modifies the next variable in memory…
#include <stdio.h>
#define uint unsigned int
#define TTW_NUM_GRANULARITIES 5
class Weird {
public:
Weird() {
this->lastUpdate = 0;
for (int g = 0; g < TTW_NUM_GRANULARITIES; g++)
@wimleers
wimleers / mysql-slow-log-analytics.sh
Created April 26, 2011 22:28
Script to automatically analyze slow queries of last hour and last 24 hours, using mk-query-digest.
#!/bin/sh
INPUT=/var/log/mysql/mysql-slow.log
OUTPUT_1H=/data/www/wimleers.com/status/mysql-slow-1h.txt
OUTPUT_24H=/data/www/wimleers.com/status/mysql-slow-24h.txt
# Perform the analytics, overwriting the previous results.
../scripts/mk-query-digest --since 1h $INPUT > $OUTPUT_1H
../scripts/mk-query-digest --since 24h $INPUT > $OUTPUT_24H
<?php
$host="https://bodega.fogbugz.com/api.asp";
$user="rick@madefresh.ca";
$password = "********";
$query = 'project:"Bodega Application" milestone:"1.4.0" status:"Active"';
$cols = "ixBug";
$tokenCommand = "curl \"$host?cmd=logon&email=$user&password=$password\" | perl -ne 'print if s/.*\\[CDATA\[(.*)\\]\\].*/\\1/'";