Skip to content

Instantly share code, notes, and snippets.

View vowellator.py
# 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 Nov 13, 2017
Extract a url parameter and pass it into a tracking pixel url
View trackingPixel.js
// 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 Jul 2, 2012
Plugins in PHP
View gist:3035023
<?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 Mar 14, 2012
Using GoCardless within an iframe
View gocardless_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 Jan 23, 2012 — forked from jamiefdhurst/error-func.php
Awesome error function
View error-func.php
<?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 Nov 4, 2011
PHP array of all country names
View PHP Countries Array
<?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 Jul 14, 2010
How to style buttons like Facebook
View Facebook-style buttons
/* 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 Jul 14, 2010
stream.publish dialog in an FBML app
View stream.publish dialog in an FBML app
<?php
$attachment = array( 'name' => 'Name',
'href' => 'http://...'
);
$action_links = array( array( 'text' => 'Action link text',
'href' => 'http://'
)
);
You can’t perform that action at this time.