Skip to content

Instantly share code, notes, and snippets.

# My solution for https://github.com/DHS/vowellator
# Assumptions
#
# No names contain spaces
# All names contain vowels
# Names with same first vowel should be returned in same order as inputted
# Additional test cases
#
@DHS
DHS / trackingPixel.js
Created November 13, 2017 23:23
Extract a url parameter and pass it into a tracking pixel url
// This script extracts a url parameter (transactionId) and passes it into a tracking pixel url (trackingPixelUrl)
// It is designed to be added to a squarespace custom js block
//
// References:
// https://github.com/moonclerk/developer/blob/master/integration.md
// https://answers.squarespace.com/questions/78841/can-a-text-field-be-pre-filled-based-on-a-url-parameter.html
window.onload = function() {
// Create a function that fetches a given argument from the url
@DHS
DHS / gist:3035023
Created July 2, 2012 19:08
Plugins in PHP
<?php
/*
* Plugins in PHP
*
* First read this:
* http://blog.ircmaxell.com/2012/03/handling-plugins-in-php.html
*
* The 'mediator' pattern is described as the most ubiquitous so I
* took that, fleshed it out a little, made it compatible with
@DHS
DHS / gocardless_iframe
Created March 14, 2012 20:38
Using GoCardless within an iframe
<!-- iframe tag, replace {{ connect_url }} with a url generated by one of our libraries -->
<iframe src="{{ connect_url }}" width="960" height="865" scrolling="auto" frameborder="0"></iframe>
<!-- Javascript to include on the page set as your Redirect URI (as configured in your Developer dashboard) so that when it loads within the iframe it actually redirects the parent -->
<script type="text/javascript">
<!--
if (top.location != self.location) {
@DHS
DHS / error-func.php
Created January 23, 2012 15:06 — forked from jamiefdhurst/error-func.php
Awesome error function
<?php
function errorpage($message, $cuscon = false, $goBack = true, $exit = true) {
if (!$cuscon) {
echo "
<table width=\"100%\">
<tr>
<td>
<table width=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
@DHS
DHS / PHP Countries Array
Created November 4, 2011 18:51
PHP array of all country names
<?php
$countries = array("Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua and Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia and Herzegowina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (Keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, the Democratic Republic of the", "Cook Islands", "Costa Rica", "Cote d'Ivoire", "Croatia (Hrvatska)", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Island
@DHS
DHS / Facebook-style buttons
Created July 14, 2010 11:50
How to style buttons like Facebook
/* Facebook-style buttons by @DHS */
.inputbutton {
background: #3b5998;
color: white;
padding: 2px 18px 3px 18px;
border-top: 1px white solid;
border-left: 1px white solid;
border-right: 1px #000033 solid;
border-bottom: 1px #000033 solid;
@DHS
DHS / stream.publish dialog in an FBML app
Created July 14, 2010 11:36
stream.publish dialog in an FBML app
<?php
$attachment = array( 'name' => 'Name',
'href' => 'http://...'
);
$action_links = array( array( 'text' => 'Action link text',
'href' => 'http://'
)
);