Skip to content

Instantly share code, notes, and snippets.

DHS / PHP Countries Array
Created November 4, 2011 18:51
PHP array of all country names
View PHP Countries Array
$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
# My solution for
# 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 / trackingPixel.js
Created November 13, 2017 23:23
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:
window.onload = function() {
// Create a function that fetches a given argument from the url
DHS / gist:3035023
Created July 2, 2012 19:08
Plugins in PHP
View gist:3035023
* Plugins in PHP
* First read this:
* The 'mediator' pattern is described as the most ubiquitous so I
* took that, fleshed it out a little, made it compatible with
DHS / gocardless_iframe
Created March 14, 2012 20:38
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 / error-func.php
Created January 23, 2012 15:06 — forked from jamiefdhurst/error-func.php
Awesome error function
View error-func.php
function errorpage($message, $cuscon = false, $goBack = true, $exit = true) {
if (!$cuscon) {
echo "
<table width=\"100%\">
<table width=\"100%\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
DHS / stream.publish dialog in an FBML app
Created July 14, 2010 11:36
stream.publish dialog in an FBML app
View stream.publish dialog in an FBML app
$attachment = array( 'name' => 'Name',
'href' => 'http://...'
$action_links = array( array( 'text' => 'Action link text',
'href' => 'http://'
DHS / Facebook-style buttons
Created July 14, 2010 11:50
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;