Skip to content

Instantly share code, notes, and snippets.

View sam2de's full-sized avatar

Sam Faragalla sam2de

View GitHub Profile
# Add MS code to path https://code.visualstudio.com/docs/setup/mac
cat << EOF >> ~/.zshrc
# Add Visual Studio Code (code)
export PATH="/Applications/Visual Studio Code.app/Contents/Resources/app/bin:$PATH"
EOF
==================
# Add Sublime text to path https://code.visualstudio.com/docs/setup/mac
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime
@simesy
simesy / gist:d4dec3d04ef6909b97a496be4d71182f
Created November 15, 2019 06:40
Quick table rows with drush
for t in $(drush sqlq "show tables"); do echo $(drush sqlq "SELECT '$t' n, COUNT(*) r FROM $t") ; done
@bradtraversy
bradtraversy / docker_wordpress.md
Last active April 23, 2024 20:57
Docker Compose FIle For Wordpress, MySQL & phpmyadmin

Wordpress & Docker

This file will setup Wordpress, MySQL & PHPMyAdmin with a single command. Add the code below to a file called "docker-compose.yaml" and run the command

$ docker-compose up -d

# To Tear Down
$ docker-compose down --volumes
@jimconte
jimconte / seed_derivatives.drush.inc
Last active December 5, 2023 13:23 — forked from typhonius/seed_derivatives.drush.inc
This script can generate image derivatives for Drupal for warming up the filesystem prior to going live. Image derivative generation puts an amount of load on the servers so it images have been migrated from another server with no derivatives, it may be useful to pre-generate using this script.
<?php
use Drupal\Core\Database\Database;
use Drupal\Core\Database\Query\Condition;
use Drupal\image\Entity\ImageStyle;
use Drupal\file\Entity\File;
/**
* ================================================================
* Implements hook_drush_command().
* ----------------------------------------------------------------
@koomai
koomai / email-client-quirks.md
Last active June 30, 2017 19:40
Email Clients quirks

A list of stupid email client quirks as I discover them

TL;DR - Gmail sucks balls.

  • Outlook ignores display:block on inline elements, e.g. span. Use default block elements like div or p.
  • Outlook 2003/2007 doesn't support background-image. Use a fallback colour and make sure the text is still legible.
  • Gmail supports background-image but ignores background-position. Stupid Gmail.
  • Gmail's mobile app ignores media queries. Yes, a mobile app ignores media queries. Did I mention Gmail is stupid?
  • Gmail clips your email if it thinks it's too long. The file size limit is around 100kb but keep it under 80kb to be safe. Images don't count. Minify your HTML.
@hoangthienan
hoangthienan / elasticsearch
Last active September 10, 2018 14:42
Install ElasticSearch on CentOS 6.5
# install missing libraries (if any)
[root@sm ~]# cd ~
[root@sm ~]# sudo yum update
# get and unpack elasticsearch tar file
[root@sm ~]# wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.3.1.tar.gz -O elasticsearch.tar.gz
[root@sm ~]# tar -xvf elasticsearch.tar.gz
[root@sm ~]# mv elasticsearch-* elasticsearch
[root@sm ~]# sudo mv elasticsearch /usr/local/share
function themename_menu_link(&$variables) {
$element = $variables['element'];
$sub_menu = '';
$element['#attributes']['data-menu-parent'] = $element['#original_link']['menu_name'] . '-' . $element['#original_link']['depth'];
if ($element['#below']) {
$sub_menu = drupal_render($element['#below']);
}
@jamesejr
jamesejr / sublime-settings
Last active May 15, 2019 06:16
Personal customized Sublime Text 3 configuration file with Inconsolata font
{
"bold_folder_labels": true,
"caret_extra_width": 1,
"caret_style": "phase",
"close_windows_when_empty": false,
"color_scheme": "Packages/Theme - Spacegray/base16-ocean.dark.tmTheme",
"draw_minimap_border": true,
"enable_tab_scrolling": false,
"font_face": "Inconsolata",
"font_options":
@gagarine
gagarine / template.tpl.php
Created July 29, 2012 21:11
Working with drupal theme_menu_tree
<?php
/**
* Theme_menu_tree doesn't provide any context information
* THIS SUCKS
* But you can use hook_block_view_alter to change the theme wrapper
* OUF!
*/
function MYTHEME_menu_tree(&$variables) {