Skip to content

Instantly share code, notes, and snippets.

View ethangardner's full-sized avatar

Ethan Gardner ethangardner

View GitHub Profile
@mvital
mvital / excerpt-as-instant-article-subtitle.php
Created January 11, 2017 15:42 — forked from webdados/excerpt-as-instant-article-subtitle.php
Use WordPress post excerpt as Facebook Instant Article subtitle
<?php
/* Instant Articles (https://wordpress.org/plugins/fb-instant-articles/) - Use post excerpt as subtitle */
add_filter( 'instant_articles_subtitle', 'hf_instant_articles_subtitle' );
function hf_instant_articles_subtitle( $subtitle ) {
$excerpt = get_the_excerpt();
if ( trim($excerpt)!='' ) $subtitle = trim($excerpt);
return $subtitle;
}
@milon
milon / elasticsearch_on_homestead.md
Last active November 23, 2022 15:18
Install Elasticsearch on Laravel Homestead

Install Elasticsearch on Laravel Homestead

Install Java

sudo apt-get install openjdk-7-jre-headless -y

Download & install the Public Signing Key

wget -qO - http://packages.elasticsearch.org/GPG-KEY-elasticsearch | sudo apt-key add -
@mdesanti
mdesanti / build-and-deploy.sh
Created February 14, 2016 18:24
Build and upload code to lambda
#!/bin/bash
echo 'Zipping folders for save function'
zip -r Save.zip node_modules save.js
echo 'Zipped... uploading to AWS'
aws lambda update-function-code --region us-east-1 --function-name saveEmailSubscriptor --zip-file fileb://./Save.zip --profile your-profile
echo 'Zipping folders for list function'
zip -r List.zip node_modules list.js
echo 'Zipped... uploading to AWS'
aws lambda update-function-code --region us-east-1 --function-name listEmailSubscriptors --zip-file fileb://./List.zip --profile your-profile
@jakub-g
jakub-g / _1_"script async defer" blocks "load" event.md
Last active August 22, 2023 10:10
Beware of "script async defer" blocking HTML "load" event

Beware of <script async defer> blocking HTML "load" event

2015.10.07 t

On the importance of simulated latency testing, and bulletproofing your page from the third-party JS load failures

TL;DR

@paulirish
paulirish / what-forces-layout.md
Last active June 18, 2025 11:23
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@salcode
salcode / .gitignore
Last active February 19, 2025 22:44
Please see https://salferrarello.com/wordpress-gitignore/ for the canonical version of this WordPress .gitignore file. Note: I do not receive notifications for comments here (because GitHub does not send notifications on Gists)
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20180808
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@lologhi
lologhi / 1.How to easily implement a REST API with oAuth2 presentation.md
Last active April 4, 2024 22:13
Symfony2 : How to easily implement a REST API with oAuth2 (for normal guys)

It's still a work in progress...

Intro

As William Durand was recently explaining in his SOS, he "didn't see any other interesting blog post about REST with Symfony recently unfortunately". After spending some long hours to implement an API strongly secured with oAuth, I thought it was time for me to purpose my simple explanation of how to do it.

Ok, you know the bundles

You might have already seen some good explanation of how to easily create a REST API with Symfony2. There are famous really good bundles a.k.a. :

@archangel-irk
archangel-irk / grunt-hash.js
Last active December 23, 2015 21:29
grunt hash (.md5) checksum file for uglify.
uglify: {
production: {
options: {
report: 'min'
},
files: [{
expand: true,
cwd: '<%= dir.tempJS %>/',
src: '*.js',
dest: '<%= dir.publicJS %>',
@cheeaun
cheeaun / js-error-logging-services.md
Last active October 24, 2024 17:13
JavaScript error logging services