Skip to content

Instantly share code, notes, and snippets.

View sam2de's full-sized avatar

Sam Faragalla sam2de

View GitHub Profile
@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
@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":
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']);
}
@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) {
# 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
@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().
* ----------------------------------------------------------------
@oodavid
oodavid / README.md
Created March 26, 2012 17:05
Backup MySQL to Amazon S3

Backup MySQL to Amazon S3

This is a simple way to backup your MySQL tables to Amazon S3 for a nightly backup - this is all to be done on your server :-)

Sister Document - Restore MySQL from Amazon S3 - read that next

1 - Install s3cmd

this is for Centos 5.6, see http://s3tools.org/repositories for other systems like ubuntu etc