Skip to content

Instantly share code, notes, and snippets.

@Shelob9
Shelob9 / 1.php
Last active December 4, 2020 09:48
These are step by step examples for converting a WordPress shortcode to a Gutenberg block. Read the tutorial here: https://calderaforms.com/2019/01/convert-shortcode-gutenberg-block/ Completed example here: https://github.com/caldera-learn/basic-blocks/tree/master/blocks/post-title
<?php
/**
* Handler for [cl_post_title] shortcode
*
* @param $atts
*
* @return string
*/
function caldera_learn_basic_blocks_post_title_shortcode_handler($atts)
{
@DavidKuennen
DavidKuennen / minimal-analytics-snippet.js
Last active October 24, 2024 18:10
Minimal Analytics Snippet
(function (context, trackingId, options) {
const history = context.history;
const doc = document;
const nav = navigator || {};
const storage = localStorage;
const encode = encodeURIComponent;
const pushState = history.pushState;
const typeException = 'exception';
const generateId = () => Math.random().toString(36);
const getId = () => {
@gaearon
gaearon / prepack-gentle-intro-1.md
Last active May 3, 2024 12:56
A Gentle Introduction to Prepack, Part 1

Note:

When this guide is more complete, the plan is to move it into Prepack documentation.
For now I put it out as a gist to gather initial feedback.

A Gentle Introduction to Prepack (Part 1)

If you're building JavaScript apps, you might already be familiar with some tools that compile JavaScript code to equivalent JavaScript code:

  • Babel lets you use newer JavaScript language features, and outputs equivalent code that targets older JavaScript engines.
@webdados
webdados / bpinet_clean_iban.js
Last active October 7, 2017 14:23
Clean whitespaces from IBAN when pasting it on BPINet
//Add as many IBAN / NIB field IDs as you want
var ibanFields = [
"LT_BPINet_wt1_block_wtMainContent_CS_ClienteCanais_wt42_block_WebPatterns_wt581_block_wtContent_LT_BPI_Patterns_wtDadosBeneficiarioNacional_block_wtForm_LT_BPI_Patterns_wtRowIBAN_block_wtRow_LT_BPI_Patterns_wtIBAN_block_wtInput_wtTxtIBAN",
"LT_BPINet_wt20_block_wtMainContent_CS_Transferencias_wt12_block_wt3_WebPatterns_wt820_block_wtContent_LT_BPI_Patterns_wtfmFomularioDadosTranferencia_block_wtForm_LT_BPI_Patterns_wttxtIBAN_block_wtRow_LT_BPI_Patterns_wt652_block_wtInput_wttxtIBAN2",
"LT_BPINet_wt60_block_wtMainContent_CS_Transferencias_wt68_block_WebPatterns_wt273_block_wtContent_LT_BPI_Patterns_wt999_block_wtForm_LT_BPI_Patterns_wt442_block_wtRow_LT_BPI_Patterns_wt55_block_wtInput_wttxtContaIBANDestinatario"
];
//Add the event listener
for (var i = 0, len = ibanFields.length; i < len; i++) {
if ( el=document.getElementById(ibanFields[i]) ) el.addEventListener('paste', cleanIban);
/* Courtesy of Steve Souders, #ImageCon17, San Francisco, US */
/* Details: https://developer.mozilla.org/en-US/docs/Web/API/Performance */
<link rel="stylesheet" href="/huge-slow.css">
<img src="hero.jpg"
onload="performance.clearMeasures('hero');
performance.measure('hero')">
<script>
@agirlandhermac
agirlandhermac / gravity-forms-material-design.css
Last active November 1, 2023 10:43
Styling Gravity Forms with Material Design Look
/*** MAIN WRAPPER ***/
.gform_wrapper {
background: #6000AA;
padding: 5%;
}
/*** REMOVE LABEL FOR PLACEHOLDER ONLY ***/
.gform_wrapper .top_label .gfield_label,
.gform_wrapper .field_sublabel_below .ginput_complex.ginput_container label {
display: none;
@inetbiz
inetbiz / site.conf
Last active March 25, 2023 18:56 — forked from paskal/site.conf
Nginx configuration for best security and modest performance. Full info on https://terrty.net/2014/ssl-tls-in-nginx/
# read more at https://terrty.net/2014/ssl-tls-in-nginx/
# latest version on https://gist.github.com/paskal/628882bee1948ef126dd/126e4d1daeb5244aacbbd847c5247c2e293f6adf
# security test score: https://www.ssllabs.com/ssltest/analyze.html?d=terrty.net
# your nginx version might not have all directives included, test this configuration before using in production against your nginx:
# $ nginx -c /etc/nginx/nginx.conf -t
server {
# public key, contains your public key and class 1 certificate, to create:
# (example for startssl)
# $ (cat example.com.pem & wget -O - https://www.startssl.com/certs/class1/sha2/pem/sub.class1.server.sha2.ca.pem) | tee -a /etc/nginx/ssl/domain.pem > /dev/null
@kitzy
kitzy / RemoveTransmissionVulnerablity.sh
Created August 30, 2016 17:54
A script to remove the OSX/Keydnap vulnerability distributed through Transmission.app
#!/bin/bash
#################
### Variables ###
#################
# Items at the system level to be removed
systemItems=(
/Applications/Transmission.app
/Library/Application\ Support/com.apple.iCloud.sync.daemon/
@mrkdevelopment
mrkdevelopment / In your social icons file
Last active July 15, 2024 01:05
Divi social icons extension
<?php if ( 'on' === et_get_option( 'divi_show_linkedin_icon', 'on' ) ) : ?>
<li class="et-social-icon et-social-linkedin">
<a href="<?php echo esc_url( et_get_option( 'divi_linkedin_url', '#' ) ); ?>" class="icon">
<span><?php esc_html_e( 'Linked In', 'Divi' ); ?></span>
</a>
</li>
<?php endif; ?>
<?php if ( 'on' === et_get_option( 'divi_show_youtube_icon', 'on' ) ) : ?>
<li class="et-social-icon et-social-youtube">
@rgl
rgl / acmetool.txt
Last active June 27, 2016 20:13
Automate letsencrypt SSL certificate generation using acmetool
See https://hlandau.github.io/acme/userguide
Install acmetool:
add-apt-repository ppa:hlandau/rhea
apt-get update
apt-get install acmetool
See the default status and create the state directory: