Skip to content

Instantly share code, notes, and snippets.

@welly
welly / ComboForm.php
Created April 28, 2021 14:46 — forked from Eyal-Shalev/ComboForm.php
An example form object (Drupal 8) that combines multiple forms into itself.
<?php
namespace Drupal\sandbox\Form;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormInterface;
use Drupal\Core\Form\FormState;
use Drupal\Core\Form\FormStateInterface;
use Drupal\node\Entity\Node;
use Drupal\user\Entity\User;
@welly
welly / docker_for_mac_disk_default_size.md
Created December 17, 2018 12:12 — forked from stefanfoulis/docker_for_mac_disk_default_size.md
How to resize Docker for Mac Disk image and set the default size for new images

Set the default size for new Docker for Mac disk images

UPDATE: The instructions here are no longer necessary! Resizing the disk image is now possible right from the UI since Docker for Mac Version 17.12.0-ce-mac49 (21995).

If you are getting the error: No space left on device

Configuring the qcow2 size cap is possible in the current versions:

# my disk is currently 64GiB
@welly
welly / xdebug.ini
Created January 3, 2016 22:25 — forked from larowlan/xdebug.ini
vagrant@d8:~$ cat /etc/php5/conf.d/20-xdebug.ini
xdebug.max_nesting_level=200 ; Fixes debugging for D8.
xdebug.remote_host=10.0.2.2
xdebug.remote_enable=1
xdebug.remote_handler=dbgp
xdebug.remote_mode=req
xdebug.remote_port=9000
xdebug.remote_connect_back=1
xdebug.auto_start=true
zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so
@welly
welly / osx-elcapitan.sh
Created November 11, 2015 07:10
OS X El Capitan setup
#!/bin/sh
# Command Line Tools
xcode-select --install
# Sudo
sudo -v
while true; do sudo -n true; sleep 60; kill -0 $$ || exit; done 2>/dev/null &
# Homebrew
function distanceGeoPoints ($long1, $lat1, $long2, $lat2) {
$lat = deg2rad($lat2 - $lat1);
$long = deg2rad($long2 - $long1);
$a = sin($lat/2) * sin($lat/2) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * sin($long/2) * sin($long/2);
$c = 2 * atan2(sqrt($a), sqrt(1 - $a));
$d = 6371 * $c;
return $d;
}
<?php
$adam = array(
'remote-host' => 'adammalone.net',
'root' => '/var/www/html/adammalone/docroot',
'uri' => 'adammalone.net',
'strict' => 0,
'path-aliases' => array(
'%dump-dir' => '/home/adammalone/.drush/dumps',
'%files' => 'sites/default/files',
@welly
welly / demo.module
Last active August 29, 2015 14:18 — forked from pascalduez/demo.module
<?php
/**
* @file
* Demo module, Basic Ajax form submit (Ajax framework).
*/
/**
* Implements hook_menu().
*/
server {
server_name [host];
root /var/www/[document_root]; ## <-- Your only path reference.
# Enable compression, this will help if you have for instance advagg module
# by serving Gzip versions of the files.
gzip_static on;
location = /favicon.ico {
<?php
/**
* @file
* local.settings.php (Drupal 6.x)
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom:
<?php
/**
* @file
* local.settings.php
*
* This settings file is intended to contain settings specific to a local
* development environment, by overriding options set in settings.php.
*
* Include this file from your regular settings.php by including this at the
* bottom: