Skip to content

Instantly share code, notes, and snippets.

View leolandotan's full-sized avatar

Leolando Tan leolandotan

View GitHub Profile
@seanhandley
seanhandley / docker-compose.yml
Last active April 9, 2024 04:05
How To Set Up Docker For Mac (Mojave) with Native NFS
version: '2'
services:
api:
volumes:
- "nfsmount:${CONTAINER_DIR}"
volumes:
nfsmount:
driver: local
driver_opts:
name: Modal Form Example
type: module
description: 'Modal Form Example module'
package: Example
version: VERSION
core: 8.x
@slivorezka
slivorezka / get_image_path_with_image_style.php
Created November 8, 2016 10:40
Drupal 8: Get Image URL / URI with Image Style
<?php
use Drupal\file\Entity\File;
use Drupal\image\Entity\ImageStyle;
// File ID.
$fid = 123;
// Load file.
$file = File::load($fid);
// Get origin image URI.
$image_uri = $file->getFileUri();
// Load image style "thumbnail".
@Luukyb
Luukyb / gist:dfa4322bbf00b44ef128
Created May 4, 2015 09:22
Create lighter sql dump files with drush using this drushrc.php file
<?php
/**
* @file
* Example of a drushrc.php file with cache tables setup.
*
* This setup will allow you to create smaller sql dump files by excluding the
* cache tables.
* drushrc.php can be placed in ~/.drush/ or inside your sites/default.
* Then you can use something like:
@mglaman
mglaman / hook_fix_media_2194821.php
Created January 15, 2015 21:47
Fix Media WYSIWYG filter embeds to pre-alpha4
<?php
/**
* Implements hook_media_wysiwyg_token_to_markup_alter().
*/
function mymodule_media_wysiwyg_token_to_markup_alter(&$element, $tag_info, $settings) {
// Undo the damage done by #2194821
if (isset($element['content']['#type']) && $element['content']['#type'] == 'container') {
unset($element['content']['#type']);
unset($element['content']['#theme']);
@rrosiek
rrosiek / install_mysql.sh
Last active June 5, 2023 07:08
Vagrant provision script for php, Apache, MySQL, phpMyAdmin, Laravel, and javascript helpers. Tested with Ubuntu 16.04.
#! /usr/bin/env bash
###
#
# install_mysql.sh
#
# This script assumes your Vagrantfile has been configured to map the root of
# your application to /vagrant and that your web root is the "public" folder
# (Laravel standard). Standard and error output is sent to
# /vagrant/vm_build.log during provisioning.
@chrisyip
chrisyip / vagrant-lamp.sh
Created May 8, 2013 11:58
Vagrant shell script for LAMP.
#!/usr/bin/env bash
apt-get update
echo mysql-server-5.5 mysql-server/root_password password PASSWORD | debconf-set-selections
echo mysql-server-5.5 mysql-server/root_password_again password PASSWORD | debconf-set-selections
apt-get install -y mysql-common mysql-server mysql-client
apt-get install -y apache2