Skip to content

Instantly share code, notes, and snippets.

Avatar

Leland Smith lelandsmith

View GitHub Profile
View amp-update-cache-url-generator.php
<?php
function urlsafe_b64encode($string) {
return str_replace(array('+','/','='),array('-','_',''), base64_encode($string));
}
$timestamp=time();
$ampBaseUrl = "https://www-domain-com.cdn.ampproject.org";
$signatureUrl = '/update-cache/c/s/www.domain.com/amp/page-url?amp_action=flush&amp_ts='.$timestamp;
@yratof
yratof / functions.php
Created Mar 10, 2015
ACF OEmbed with thumbnails
View functions.php
<?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
tegansnyder / hhvm_magento_setup.md
Last active May 28, 2019
HHVM Magento Server Setup
View hhvm_magento_setup.md

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 http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
@ifamily
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
<?php
/*
One wp-config for local development to staging to production.
*/
// Define Environments
$environments = array(
View README.md
@hofmannsven
hofmannsven / README.md
Last active Jul 1, 2020
Virtual Hosts with MAMP on OS X
View README.md

Virtual Hosts

Update the hosts file in /etc/hosts to maintain multiple domains/hostnames on a local machine for 127.0.0.1 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
arosenhagen / magento-code-snippets.md
Last active Sep 27, 2019
[magento] - code snippets
View magento-code-snippets.md

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
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
ScottPhillips / .htaccess
Created Feb 2, 2012
Common .htaccess Redirects
View .htaccess
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
You can’t perform that action at this time.