Skip to content

Instantly share code, notes, and snippets.

@jakebellacera
jakebellacera / ICS.php
Last active June 2, 2024 02:20
A convenient script to generate iCalendar (.ics) files on the fly in PHP.
<?php
/**
* This is free and unencumbered software released into the public domain.
*
* Anyone is free to copy, modify, publish, use, compile, sell, or
* distribute this software, either in source code form or as a compiled
* binary, for any purpose, commercial or non-commercial, and by any
* means.
*
@pamelafox
pamelafox / showspreadsheet.php
Created January 8, 2011 05:47
PHP for parsing the JSON output a published Google spreadsheet and displaying columns from each row.
<?php
// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json';
$file= file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
foreach($rows as $row) {
echo '<p>';
@Yaffle
Yaffle / URLUtils.js
Last active September 5, 2022 02:19
parse URL + absolutize URL in javascript (URLUtils shim - http://url.spec.whatwg.org/#url)
/*jslint regexp: true, maxerr: 50, indent: 2 */
(function (global) {
"use strict";
function URLUtils(url, baseURL) {
var m = String(url).replace(/^\s+|\s+$/g, "").match(/^([^:\/?#]+:)?(?:\/\/(?:([^:@\/?#]*)(?::([^:@\/?#]*))?@)?(([^:\/?#]*)(?::(\d*))?))?([^?#]*)(\?[^#]*)?(#[\s\S]*)?/);
if (!m) {
throw new RangeError();
}
@taylor
taylor / README.md
Created November 17, 2011 11:09
wrapper to support SSH SRV records

Introduction

ssh-srv-wrapper is bash shell script which tries to find a SSH SRV record for the first host and uses what is found rather than what was passed (if a valid record is found).

Install

Run the script directly or feel free to rename or symlink to the name ssh. It will look for another ssh in your path to execute.

@luetkemj
luetkemj / wp-query-ref.php
Last active May 25, 2024 10:56
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/
@pamelafox
pamelafox / zepto.js
Created April 17, 2012 05:04
Zepto Port (Bootstrap-friendly, Plugin-friendly, etc)
// Zepto.js
// (c) 2010, 2011 Thomas Fuchs
// Zepto.js may be freely distributed under the MIT license.
(function(undefined){
if (String.prototype.trim === undefined) // fix for iOS 3.2
String.prototype.trim = function(){ return this.replace(/^\s+/, '').replace(/\s+$/, '') };
// For iOS 3.x
// from https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/reduce
@liamcurry
liamcurry / gist:2597326
Created May 4, 2012 19:56
Vanilla JS vs jQuery

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@spivurno
spivurno / gw-gravity-forms-list-field-rows-by-field-value.php
Last active July 27, 2020 20:07
Gravity Wiz // Set Number of List Field Rows by Field Value
<?php
/**
* Gravity Wiz // Gravity Forms // Set Number of List Field Rows by Field Value
*
* Add/remove list field rows automatically based on the value entered in the specified field. Removes the add/remove
* that normally buttons next to List field rows.
*
* @version 1.3
* @author David Smith <david@gravitywiz.com>
* @license GPL-2.0+
@spivurno
spivurno / gw-dynamic-populate-with-merge-tags.php.php
Last active June 13, 2022 20:12
Gravity Wiz // Merge Tags as Dynamic Population Parameters
<?php
/**
* Merge Tags as Dynamic Population Parameters
* http://gravitywiz.com/dynamic-products-via-post-meta/
* @version 1.3
*/
add_filter( 'gform_pre_render', 'gw_prepopluate_merge_tags' );
function gw_prepopluate_merge_tags( $form ) {
global $gw_filter_names;
@spivurno
spivurno / gw-gravity-forms-email-domain-validator.php
Last active September 16, 2021 13:05
Gravity Wiz // Gravity Forms // Email Domain Validator // Ban/Limit Email Domains for Gravity Form Email Fields
<?php
/**
* WARNING! THIS SNIPPET MAY BE OUTDATED.
* The latest version of this snippet can be found in the Gravity Wiz Snippet Library:
* https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-email-domain-validator.php
*/
/**
* Gravity Wiz // Gravity Forms // Email Domain Validator
*
* This snippets allows you to exclude a list of invalid domains or include a list of valid domains for your Gravity Form Email fields.