Skip to content

Instantly share code, notes, and snippets.

@raynimmo
raynimmo / gist:0fdc1d61d55282d061a3
Last active September 14, 2016 05:13
humans.txt
/* the humans responsible & colophon */
/* humanstxt.org */
/* TEAM */
Developer: Ray Nimmo
Site: http://www.junglecreative.com
Twitter: @raynimmo
Location: Koh Phangan, Thailand
@raynimmo
raynimmo / drupal-captcha-style-partial.scss
Created July 29, 2014 19:01
styling hooks for default drupal image captcha
fieldset .captcha{
legend{
.fieldset-legend{
}
}
.fieldset-wrapper{
.fieldset-description{
addLoadEvent(setSidebarNav);
function addLoadEvent(func) {
if (window.addEventListener)
window.addEventListener("load",func,false);
else if (document.addEventListener)
document.addEventListener("load",func,false);
@raynimmo
raynimmo / gist:e9a4cad9b64a86c9fcec
Created August 27, 2014 17:44
screen reorientation hack
$(document).ready(function () {
function reorient(e) {
var portrait = (window.orientation % 180 == 0);
$("body > div").css("-webkit-transform", !portrait ? "rotate(-90deg)" : "");
}
window.onorientationchange = reorient;
window.setTimeout(reorient, 0);
});
@raynimmo
raynimmo / s9y-to-drupal.php
Last active September 14, 2016 05:10
Import blog posts from Serendipity to Drupal. Quick and dirty import direct from database.
<?php
//create temporary data store
/*
CREATE TABLE blogdata (
id int(11),
title varchar(200),
timestamp int(10),
body text,
done int(3) default '0'
);
@raynimmo
raynimmo / gist:6c85acf28f2c9a747764
Created October 11, 2014 16:46
initialise fittext.js
(function($) {
// fittext.js plugin
$.fn.fitText = function(kompressor, options){
var compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);
return this.each(function(){
@raynimmo
raynimmo / gist:7f7521e6104b3f96ec85
Created October 11, 2014 16:48
detect iOS and do something
(function($) {
//check for iOS
var is_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent);
var is_safari_or_uiwebview = /(iPhone|iPod|iPad).*AppleWebKit/i.test(navigator.userAgent);
if(is_uiwebview || is_safari_or_uiwebview) {
console.log("iphone/ipad/ipod detected");
//do something such as..
Verifying that +raynimmo is my openname (Bitcoin username). https://onename.io/raynimmo
@raynimmo
raynimmo / PHP country dropdown
Created January 7, 2015 07:48
simple PHP country name SELECT element
function displayCountryList() {
$countries = array("AF" => "Afghanistan",
"AX" => "Åland Islands",
"AL" => "Albania",
"DZ" => "Algeria",
"AS" => "American Samoa",
"AD" => "Andorra",
"AO" => "Angola",
"AI" => "Anguilla",
"AQ" => "Antarctica",
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.