Skip to content

Instantly share code, notes, and snippets.

@btoone
btoone / curl.md
Last active February 25, 2026 14:37
A curl tutorial using GitHub's API

Introduction

An introduction to curl using GitHub's API.

The Basics

Makes a basic GET request to the specifed URI

curl https://api.github.com/users/caspyin
@peterherrmann
peterherrmann / gist:2700284
Last active March 25, 2025 15:16
GASRetry - Exponential backoff JavaScript implementation for Google Apps Script (Library project key: "MGJu3PS2ZYnANtJ9kyn2vnlLDhaBgl_dE")
/**
* Invokes a function, performing up to 5 retries with exponential backoff.
* Retries with delays of approximately 1, 2, 4, 8 then 16 seconds for a total of
* about 32 seconds before it gives up and rethrows the last error.
* See: https://developers.google.com/google-apps/documents-list/#implementing_exponential_backoff
<h3>Examples:</h3>
<pre>//Calls an anonymous function that concatenates a greeting with the current Apps user's email
var example1 = GASRetry.call(function(){return "Hello, " + Session.getActiveUser().getEmail();});
</pre><pre>//Calls an existing function
var example2 = GASRetry.call(myFunction);
@thomasgriffin
thomasgriffin / gist:7308584
Created November 4, 2013 20:17
Blank canvas for styling a Soliloquy slider.
<?php
add_action( 'tgmsp_before_slider_output', 'tgm_custom_slider_theme' );
function tgm_custom_slider_of_madness( $id ) {
// If not the proper slider ID, do nothing. Change to match your slider ID.
if ( '324' !== $id ) return;
// Dequeue the default styles.
wp_dequeue_style( 'soliloquy-style' );
@milannankov
milannankov / metaslider-filter.php
Last active June 16, 2022 02:56
How to add a filter for FlexSlider with Meta Slider
<?php //functions.php
add_filter('metaslider_flex_slider_parameters', 'metaslider_flex_params', 10, 3);
function metaslider_flex_params($options, $slider_id, $settings)
{
$options['after'][] = "onHomePageSlideChanged(slider);";
return $options;
}
@pixeline
pixeline / ajax-handler-wp.php
Last active October 5, 2022 13:09
Custom ajax handler for Wordpress. Using admin-ajax.php, as is usually recommended, is very slow and does not allow the use of plugin shortcodes. Using a custom ajax handler like this bypasses that. http://wordpress.stackexchange.com/questions/170808/the-content-shows-shortcode-instead-of-parsing-it
<?php
/*
WORDPRESS SPECIFIC AJAX HANDLER (because admin-ajax.php does not render plugin shortcodes).
by alexandre@pixeline.be
credits: Raz Ohad https://coderwall.com/p/of7y2q/faster-ajax-for-wordpress
*/
//mimic the actual admin-ajax
define('DOING_AJAX', true);
if (!isset( $_REQUEST['action']))
@bhubbard
bhubbard / archive-wpseo_locations.php
Last active July 2, 2025 15:11
WordPress Templates for Local SEO by Yoast Multiple Locations CPT
<?php
/*
Our Template Page for Single Locations created with Local SEO by Yoast
Local SEO is good at at formatting this data use the schema format, please make sure you continue to support it.
*/
get_header(); ?>
<h1>Locations</h1>
@Cheffheid
Cheffheid / gf-event-ajax.jquery.js
Last active July 1, 2022 12:11
Simple Universal Analytics event trigger for Gravity Forms (AJAX)
// Can be added on any page with a gravity form, it will hook into GF's own event that triggers when the confirmation is loaded (confirmed conversion).
(function($) {
$(document).bind("gform_confirmation_loaded", function(e, form_id) {
// Send event with category 'Form', action 'Submit', label 'Contact Us', and value 100.
ga('send', 'event', 'Form', 'Submit', 'Contact Us', 100);
});
})(jQuery);
@Spencer-Easton
Spencer-Easton / exportSpreadsheet.gs
Last active July 8, 2025 10:31
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@solepixel
solepixel / jquery.script.js
Last active June 15, 2022 02:24
Vertically and horizontally center Soliloquy slides while still keeping proportions. Emulating the "background-size: cover" with a standard slider. Slider configuration looks like this: Slider Dimensions: Full Width, Slider Position: Center, Use Adaptive Height: Yes, Crop Images in Slider: Yes
(function( $ ){
'use strict';
function auto_fit_soliloquy( parent_selector ){
// resize the slider container
var $soliloquy = $( parent_selector + ' .soliloquy-container'),
$all_items = $('.soliloquy-slider,.soliloquy-viewport,.soliloquy-item', $soliloquy ),
$container = $('.soliloquy-item', $soliloquy ),
window_height = $(window).height();