Skip to content

Instantly share code, notes, and snippets.

View greylabel's full-sized avatar

Grant Gaudet greylabel

View GitHub Profile
@greylabel
greylabel / block-annotation-with-context.php
Created January 3, 2018 16:25 — forked from dsnopek/block-annotation-with-context.php
Drupal 8 block annotation with context example
/**
* @Block(
* id = "my_block",
* context = {
* "node" = @ContextDefinition("entity:node")
* }
* )
*/
@greylabel
greylabel / 9191_config.php
Created December 21, 2016 00:03
This is a sample addition to the config.php for SimpleSAMLphp for Acquia Cloud.
<?php
// All custom changes below. Modify as needed.
// Defines account specific settings.
// $ah_options['database_name'] should be the Acquia Cloud workflow database name which
// will store SAML session information.set
// You can use any database that you have defined in your workflow.
// Use the database "role" without the stage ("dev", "stage", or "test", etc.)
//This file was last modified on Nov 4, 2015.
$ah_options = array(
'database_name' => 'mydatabasename',
@greylabel
greylabel / PhpVariableTask.php
Created December 23, 2015 07:20 — forked from grasmash/PhpVariableTask.php
This Phing tasks will read a PHP variable from a PHP file, allowing it to be output as a Phing property.
<?php
/**
* Class PhpVariableTask
*
* This task allows php variables from php files to be output into Phing
* properties.
*/
class PhpVariableTask extends Task {
@greylabel
greylabel / main.js
Last active August 29, 2015 14:23 — forked from coorasse/main.js
$(function() {
var bitbucket_project_name = 'YOUR_PROJECT_NAME LIKE coorasse/airesis';
var codeship_project_code = 'YOUR CODESHIPO PROJECT UUID CODE (look for it in the badge instructions page or general settings page)';
var regexp = new RegExp("^https://bitbucket.org/" + bitbucket_project_name + "/pull-request/","g");
if ((regexp).test(window.location.href)) {
var branch = $('dd.unabridged a').first().html();
var url = 'https://codeship.com/projects/'+codeship_project_code+'/status?branch='+branch;
var row = $('<div></div>')
var column1 = $('<dt>Codeship</dt>');
@greylabel
greylabel / force_fct.drush.inc
Created June 9, 2015 17:12
Provides a drush command to trim specific number of expired items on cache_form table
<?php
/**
* @file
* Provides a drush command to trim specific number of expired items on cache_form table
*/
define("FORCE_FCT_DEFAULT_LIMIT", 1000);
/**
@greylabel
greylabel / keybase.md
Created April 11, 2015 17:09
keybase.md

Keybase proof

I hereby claim:

  • I am greylabel on github.
  • I am bonus (https://keybase.io/bonus) on keybase.
  • I have a public key whose fingerprint is 9D32 3318 E0A2 A503 3902 A0A0 EE43 15AF AB51 4196

To claim this, I am signing this object:

@greylabel
greylabel / varnish_v3_5xx-error-page.vcl
Created November 26, 2014 17:34
Varnish config for 500-505 status codes to show the default error page
sub vcl_fetch {
# 500-505 status should be shown the default error page
if (beresp.status >= 500 && beresp.status <= 505) {
error beresp.status beresp.response;
}
}
sub vcl_error {
# In the event of an error, show friendlier messages.
set obj.http.Content-Type = "text/html; charset=utf-8";
/**
* @mixin child-behind-parent()
*
* Moves a child img behind it's a parent. Apply to parent div. Markup: div > a > img
* Useful for putting a hover image on the a tag wrapping an image
*
*/
@mixin child-overlay($image){
position: relative;
z-index: 1;
@greylabel
greylabel / height-lineheight.scss
Created October 16, 2013 15:10
height-lineheight.scss
/**
* @mixin height-lineheight($height)
*
* Allows single-line vertical centering of text
*
* @param: $height
* height of element, text will centern vertically within
*/
@mixin height-lineheight($height){
height: $height;
@greylabel
greylabel / get_attr_value.php
Created February 25, 2013 23:41
regex to get html tag attribute value
<?php
/**
* regex to get html tag attribute value
*/
function get_attribute_value($attrib, $tag){
//get attribute from html tag
$re = '/' . preg_quote($attrib) . '=([\'"])?((?(1).+?|[^\s>]+))(?(1)\1)/is';
if (preg_match($re, $tag, $match)) {
return urldecode($match[2]);