Skip to content

Instantly share code, notes, and snippets.


Leland Smith lelandsmith

View GitHub Profile
View amp-update-cache-url-generator.php
function urlsafe_b64encode($string) {
return str_replace(array('+','/','='),array('-','_',''), base64_encode($string));
$ampBaseUrl = "";
$signatureUrl = '/update-cache/c/s/'.$timestamp;
yratof / functions.php
Created Mar 10, 2015
ACF OEmbed with thumbnails
View functions.php
/* Pull apart OEmbed video link to get thumbnails out*/
function get_video_thumbnail_uri( $video_uri ) {
$thumbnail_uri = '';
// determine the type of video and the video id
$video = parse_video_uri( $video_uri );
// get youtube thumbnail
tegansnyder /
Last active May 28, 2019
HHVM Magento Server Setup

I've had the opertunity to try a variety of different server configurations but never really got around to trying HHVM with Magento until recently. I thought I would share a detailed walkthrough of configuring a single instance Magento server running Nginx + Fast CGI + HHVM / PHP-FPM + Redis + Percona. For the purpose of this blog post I'm assuming you are using Fedora, CentOS, or in my case RHEL 6.5.

Please note: I'm 100% open to suggestions. If you see something I did that needs to be done a different way, please let me know. I haven't included my Perconca my.conf file yet. I will shortly. Also I plan on trying this same test with HHVM 3.3 and PHP 7.

Install the EPEL, Webtatic, and REMI repos

rpm -Uvh
rpm -Uvh
rpm -Uvh
ifamily / wp-config.php
Last active Aug 3, 2020
A universal WordPress wp-config.php which works on local development to staging and production server environments.
View wp-config.php
One wp-config for local development to staging to production.
// Define Environments
$environments = array(
hofmannsven /
Last active Jul 1, 2020
Virtual Hosts with MAMP on OS X

Virtual Hosts

Update the hosts file in /etc/hosts to maintain multiple domains/hostnames on a local machine for and setup a VirtualHost container in /Applications/MAMP/conf/apache/extra/httpd-vhost.conf via /Applications/MAMP/conf/apache/httpd.conf for a name-based virtual host.

Only suitable for MAMP users under OS X Lion, OS X Mountain Lion, and OS X Mavericks on Apache-Port 80 and MySQL-Port 3306.

arosenhagen /
Last active Sep 27, 2019
[magento] - code snippets

Magento Code Snippets

Download extension manually using mage

./mage config-set preferred_state stable
./mage clear-cache
./mage sync
./mage download community Module_Name
yokolet / gist:2176753
Created Mar 24, 2012
Rails 3: How to add a new field to an existing database table
View gist:2176753
Existing schema is below:
ActiveRecord::Schema.define(:version => 20120130161449) do
create_table "movies", :force => true do |t|
t.string "title"
t.string "rating"
t.text "description"
t.datetime "release_date"
t.datetime "created_at"
ScottPhillips / .htaccess
Created Feb 2, 2012
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php
#Redirect an entire site:
Redirect 301 /
#Redirect an entire site to a sub folder
Redirect 301 /
You can’t perform that action at this time.