Skip to content

Instantly share code, notes, and snippets.

View philhawksworth's full-sized avatar
💭
Working remotely from home on St Albans

Phil Hawksworth philhawksworth

💭
Working remotely from home on St Albans
View GitHub Profile
@philhawksworth
philhawksworth / _headers
Last active January 4, 2018 17:17
Simple example of a Netlify _headers file (no file extension in the real world)
# A path:
/assets/*
# Headers for that path:
Cache-Control: public, max-age=360000
/templates/index.html
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
{
me: "lager",
finchy: "lager",
gareth: "lager, sometimes cider",
conclusion: "different people, different drinks"
}
# Site settings
title: Your awesome title
email: your-email@domain.com
description: "Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description."
baseurl: ""
url: "http://yourdomain.com"
# Build settings
markdown: kramdown
@philhawksworth
philhawksworth / sublime-text-packages.md
Last active March 25, 2018 02:20
Useful SublimeText packages
control = {
32 : go_up,
46 : go_down
};
$(document).bind("keydown", function(e) {
console.log("keydown: ", e.keyCode);
if(!control[e.keyCode]) {
return;
}
public static function getConfiguratorProductCategoryMediatorName(productCategory : String) : String {
return productCategory;
}
dynamicLabel = function($input, $label) {
// exit if either element isn't found
if ( !($input[0] && $label[0]) ) { return; }
function hideLabel() {
$label.hide();
}
function showLabelIfInputEmpty() {
@philhawksworth
philhawksworth / gist:1393999
Created November 25, 2011 17:13
centered dynamic menu
<html>
<head>
<title></title>
<style type="text/css">
.primary-nav {
width:1000px;
border:solid 1px red;
text-align:center;
}
require 'base62'
...
# mint a URI for a lolly
post '/mint' do
message = params[:message].gsub(/'/,"''")
db.execute( "insert into lollies (message, image) values ('"+ message +"','#{params[:lolly]}')" )
if request.xhr?
id = db.execute( "SELECT last_insert_rowid() FROM lollies" )[0].to_s()
@philhawksworth
philhawksworth / unicode snowman put to good use
Created November 23, 2010 11:15
Grinning heartily at this.
<style>@font-face{font-family:'OmnesMedium';src:url('/assets/fonts/omnesmed.eot');src:local('☃'),url('/assets/fonts/omnesmed.ttf') format('truetype');font-weight:normal;font-style:normal;}</style>