Skip to content

Instantly share code, notes, and snippets.

View splorp's full-sized avatar
🎧

Grant Hutchinson splorp

🎧
View GitHub Profile
@good
good / article.text.php
Created March 20, 2014 17:02
Custom meta description based on page content for Kirby
<?php snippet('header', array('section' => 'journal', 'title' => $page->title(), 'customdesc' => $page->text())); ?>
@mathiasbynens
mathiasbynens / Slightly optimized version of the ‘Device Scale UI elements in iOS Mobile Safari’ script by 37signals
Created June 16, 2010 06:54 — forked from sstephenson/gist:439777
Slightly optimized version of the ‘Device Scale UI elements in iOS Mobile Safari’ script by 37signals
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
// Slightly optimized by Mathias Bynens <http://mathiasbynens.be/>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
#!/usr/bin/env perl
# Description: http://daringfireball.net/2010/08/open_urls_in_safari_tabs
# License: See below.
# http://gist.github.com/507356
use strict;
use warnings;
use URI::Escape;
@kylefox
kylefox / haircut.py
Created October 29, 2010 18:43
Test
# test
# A script to calculate some basic stats on Grant Hutchinson's haircuts.
# See http://splorp.com/about/haircut/
#
# Sample output:
# Number of haircuts since December 22, 1998: 53
# Average days between haircuts: 77
# Shortest time between haircuts was April 10, 1999 to May 25, 1999 (45 days)
# Longest time between haircuts was August 11, 2007 to December 09, 2007 (120 days)
# You'll probably want a haircut in about 63 days (March 08, 2010)
<meta name="description" content="<?php echo $page->description()->or($site->description()) ?>">
@morgant
morgant / mirror_homepage.mac.com_sites_instructions.txt
Created June 18, 2012 18:23
Notes/instructions for how I've been mirroring homepage.mac.com sites to mirrors.unna.org
Mirroring homepage.mac.com sites to mirrors.unna.org:
1) Use `wget` to pull down a copy of the site. If pulling down a single file & all its prerequisites, use the following:
/usr/local/bin/wget -p --mirror -k -t 30 -w 5 -e robots=off -o homepage.mac.com-splorp.$(date +%Y-%m-%d-%H%M).log "http://homepage.mac.com/splorp/PhotoAlbum3.html" &
Alternatively, if pulling down an entire directory, use the following (Note: _make sure_ you include the trailing slash on the directory name!):
/usr/local/bin/wget --mirror -k -t 30 -w 5 -e robots=off -o homepage.mac.com-splorp.$(date +%Y-%m-%d-%H%M).log "http://homepage.mac.com/splorp/" &
@gollum23
gollum23 / gist:0b861de47ced51f8a50e
Last active July 6, 2019 20:24
Get last part URL with php
function uf_getLastDir($sUrl)
{
$sPath = parse_url($sUrl, PHP_URL_PATH); // parse URL and return only path component
$aPath = explode('/', trim($sPath, '/')); // remove surrounding "/" and return parts into array
end($aPath); // last element of array
if (is_dir($sPath)) // if path points to dir
return current($aPath); // return last element of array
if (is_file($sPath)) // if path points to file
return prev($aPath); // return second to last element of array
return false; // or return false
@javan
javan / gist:1168475
Created August 24, 2011 16:32
Fix iPhone home button
Found this tip in comment here: http://www.tipb.com/2011/01/04/tipb-bug-home-button-working-iphone/
1.) Open any application
2.) Press and hold the power button until the slide to shutdown swipe bar appears.
3.) Release Power button
4.) Press and hold Home button Lightly
until screen returns to icon screen
@frankrolf
frankrolf / arrange_stickies.scpt
Last active May 7, 2020 22:00
Applescript: distribute all stickies evenly on the main screen, with optional padding
# Distribute all stickies evenly on the main screen, with optional padding
# how many columns?
set num_columns to 7
# how many pixels of padding between the stickies?
set padding to 20
# Find the dimensions of the main screen
# https://stackoverflow.com/questions/1866912/applescript-how-to-get-current-display-resolution
@scottboms
scottboms / kirby__config.php
Last active December 11, 2020 01:41
Example Kirby 3 recipe for creating a JSON Feed representation of a page with custom route
<?php
// Kirby site config file
// site/config/config.php
return [
'routes' => [
[
// This sets up two different URLs as an array that will
// return the JSON Feed representation of a page in Kirby
'pattern' => ['feed', 'some-other-path/feed'],
'action' => function() {