Skip to content

Instantly share code, notes, and snippets.

@timplunkett
timplunkett / setupd8
Last active January 7, 2019 21:02
Reinstall D8
#!/bin/bash
PROFILE="standard"
DB="d8"
UI=false
NO_DEV=false
OPTS=`getopt -o h --longoptions db:,profile:,ui,no-dev -- "$@"`
eval set -- "$OPTS"
while true; do
<?php
/**
* Constructs a new context definition object.
*
* @param array $values
* An associative array with the following keys:
* - value: The required data type.
* - required: (optional) Whether the context definition is required.
* - multiple: (optional) Whether the context definition is multivalue.
function drupal-install() {
# Remove existing database
drush sql-drop -y;
# Remove existing install
sudo rm -rf sites/default;
# Restore the sites/default/default.settings.php file
sudo git checkout -- sites/default;
# Temporarily make the sites/default writable by anyone
sudo chmod -R 777 sites/default;
# Ensure the owner is the current user, not root user
@timplunkett
timplunkett / gist:1894660
Created February 23, 2012 19:43
PHP 5.3 object passing
<?php
function pass_by_pointer($obj = NULL) {
$obj->value = 5;
}
function pass_by_reference(&$obj = NULL) {
$obj->value = 4;
}
@timplunkett
timplunkett / gist:867699
Created March 12, 2011 23:33
Interpolation and foreach
// Sass
$selectors: {foo, bar, baz};
foreach $selectors as $selector {
.#{$selector} { background-image: url("../images/#{$selector}/background.png"); }
}
// CSS
.foo {
background-image: url("../images/foo/background.png");
}