This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Don't remember where I originally got this. | |
# I've expanded the original one liner script to allow a parameter which opens the new window in a specified subfolder (or any folder, just type a relative path if you can be bothered with the fiddly bits). | |
# open a new Terminal window in either the current folder, or a subfolder | |
# if given. | |
if [ -z "$1" ] # No argument passed? | |
then | |
osascript -e "tell application \"Terminal\" to do script \"cd `pwd`\"" | |
else | |
echo $1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$trace = debug_backtrace(); | |
foreach ($trace as $trace_item) { | |
$debug[] = $trace_item['function']; | |
} | |
debug($debug); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Removes an existing Drupal 8 install, then install again. | |
# Requires Drush 7 - https://github.com/drush-ops/drush | |
# | |
# Run this script from the docroot of a Drupal 8 checkout. | |
# Installs to mysql://localhost/drupal, user 1 user/pass is admin/admin. | |
# Variables. | |
# These should be customized to your setup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# go to a drupal module folder, from anywhere in the site hierarchy, | |
# with autocompletion | |
function dm { | |
drroot; | |
cd sites/all/modules; | |
#echo contrib/$1; | |
if [ -d "contrib/$1" ] | |
then | |
cd "contrib/$1"; | |
elif [ -d "custom/$1" ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$selected_sessions = array(); | |
foreach (array_keys($form_state['values']['timeslots']) as $timeslot_id) { | |
foreach (array_keys($form_state['values']['timeslots'][$timeslot_id]['rooms']) as $room_id) { | |
$cell_form_state_value = $form_state['values']['timeslots'][$timeslot_id]['rooms'][$room_id]['session']; | |
if (!empty($cell_form_state_value)) { | |
$selected_sessions[$cell_form_state_value][] = array($timeslot_id, $room_id); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env drush | |
<?php | |
/** | |
* @file | |
* Drush shell script for creating a patch. | |
* Requires the following setup: | |
* - You are on a git feature branch for your issue. | |
* - The branch name is of the format '1234-description-of-feature' where 1234 | |
* is the drupal.org issue number. | |
* - The feature branch is rebased to the major development branch you want to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl -p | |
# show what the hell is happening with line endings | |
s[ (?<! \r ) \n ] | |
[UNIX\n]x; | |
s[ \r\n] | |
[WIN\n]x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fill in the details with your own. | |
// Paste this as the URL of a new Firefox bookmark. | |
// Use the bookmark when on https://secureform.nextbase.co.uk/ | |
javascript: { | |
document.getElementById('signature').value = ''; | |
document.getElementById('name').value = ''; | |
// Doesn't work yet. | |
// document.getElementById('preferredContact').value = '0'; | |
document.getElementById('email').value = ''; | |
document.getElementById('phone').value = ''; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function check($checking_key, $data) { | |
try { | |
serialize($data); | |
} | |
catch (\Throwable $e) { | |
// The data fucked up. Go into it to see where. | |
ddm("CATCH $checking_key"); | |
if (is_array($data)) { | |
foreach ($data as $key => $val) { | |
static::check($key, $val); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Make a POST request to a form. | |
* | |
* @param string $url | |
* @param array $data | |
*/ | |
protected function doPostForm(string $url, array $data = []) { | |
$request = Request::create($url); | |
$response = $this->doRequest($request); | |
$this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); |
OlderNewer