Skip to content

Instantly share code, notes, and snippets.

Avatar
💥
After over a decade, I think it's time for a new avatar!

Jay Williams jaywilliams

💥
After over a decade, I think it's time for a new avatar!
View GitHub Profile
@randallmlough
randallmlough / hugo-img-srcset.html
Last active Feb 21, 2020
A hugo img srcset partial that auto resizes images
View hugo-img-srcset.html
<style>
img {
max-width: 100%;
}
</style>
<h1>Creating a srcset loop based on Resources</h1>
<!--
NOTE: This requires Hugo 0.32
@jaywilliams
jaywilliams / install-mosh.sh
Last active May 8, 2020 — forked from palexander/gist:2975305
Compiling and running mosh on Dreamhost (Updated - 2018)
View install-mosh.sh
#!/usr/bin/env bash
# Thanks to @samsonjs for the cleaned up version:
# https://gist.github.com/samsonjs/4076746
PREFIX=$HOME/local
VERSION=1.3.2
# Create Source Directory
mkdir -p $PREFIX/src
@jaywilliams
jaywilliams / .htaccess
Last active Jun 7, 2018
Magento 2 SSL Redirect Loop Fix (Apache + Varnish + Nginx)
View .htaccess
# Add this to your the Magento .htaccess file located in your docroot
############################################
## Nginx proxy HTTPS Fix for Magento
## Source: https://www.sonassi.com/blog/magento-kb/magento-https-redirect-loop-2
SetEnvIf X-Forwarded-Proto https HTTPS=on
@Vinai
Vinai / or-example.php
Last active Sep 23, 2020
SearchCriteria OR Example for Magento 2
View or-example.php
<?php
declare(strict_types = 1);
namespace Training5\VendorRepository\Controller\Test;
use Magento\Catalog\Api\Data\ProductInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\Framework\Api\Filter;
use Magento\Framework\Api\FilterBuilder;
@skowron-line
skowron-line / monolog.json
Last active Apr 21, 2020
lnav Monolog format
View monolog.json
{
"monolog": {
"title": "Monolog log file",
"description": "Monolog log format",
"url": "https://github.com/Seldaek/monolog",
"regex": {
"default": {
"pattern": "\\[(?P<timestamp>.*)\\] (?P<logger>\\w+).(?P<level>\\w+): (?P<message>[^\\[\\{]+) (?P<context>[\\[\\{].*[\\]\\}]) (?P<extra>[\\[\\{].*[\\]\\}])"
}
},
@Vestride
Vestride / encoding-video.md
Last active Sep 22, 2020
Encoding video for the web
View encoding-video.md

Encoding Video

Installing

Install FFmpeg with homebrew. You'll need to install it with a couple flags for webm and the AAC audio codec.

brew install ffmpeg --with-libvpx --with-libvorbis --with-fdk-aac --with-opus
@el-rotny
el-rotny / deploy.rb
Last active Dec 18, 2016
Bedrock / Sage Capistrano Deploy
View deploy.rb
set :repo_url, 'git@github.com:Design-Collective/some-repo.git'
set :application, 'the-app-name.com'
set :theme_name, 'sage'
# Branch options
# Prompts for the branch name (defaults to current branch)
#ask :branch, -> { `git rev-parse --abbrev-ref HEAD`.chomp }
# Hardcodes branch to always be master
# This could be overridden in a stage config file
@tegansnyder
tegansnyder / opcache.ini
Last active Mar 12, 2019
OpCache settings for Magento on PHP 5.5.14. Store this file as /etc/php.d/opcache.ini
View opcache.ini
; Enable Zend OPcache extension module
zend_extension=opcache.so
; Determines if Zend OPCache is enabled
opcache.enable=1
; Determines if Zend OPCache is enabled for the CLI version of PHP
;opcache.enable_cli=0
; The OPcache shared memory storage size.
@denisnazarov
denisnazarov / video_convert.sh
Last active Oct 31, 2016
FFMPEG batch convert to h264 mp4 and webm
View video_convert.sh
#! /bin/bash
# Based on Batch Convert Script originally by Beterhans
# Put all video files need to be converted in a folder!
# the name of files must not have " " Space!
# Rename the File if contain space
# Target dir
indir=$1
@larrybotha
larrybotha / A.markdown
Last active Jul 22, 2020
Fix SVGs not scaling in IE9, IE10, and IE11
View A.markdown

Fix SVG in <img> tags not scaling in IE9, IE10, IE11

IE9, IE10, and IE11 don't properly scale SVG files added with img tags when viewBox, width and height attributes are specified. View this codepen on the different browsers.

Image heights will not scale when the images are inside containers narrower than image widths. This can be resolved in 2 ways.

Use sed in bash to remove width and height attributes in SVG files

As per this answer on Stackoverflow, the issue can be resolved by removing just the width and height attributes.

You can’t perform that action at this time.