Skip to content

Instantly share code, notes, and snippets.

View johandouma's full-sized avatar
😄

Johan Douma johandouma

😄
  • Aberfoyle Park, SA
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
@johandouma
johandouma / SimplifyPivotalTracker.css
Last active November 2, 2016 23:03
Simplifies Pivotal Tracker's interface.
@-moz-document domain("pivotaltracker.com") {
.item .maximize,
.info_box .row.owner,
.info_box .row.requester,
.info_box .row.type,
.story .description,
.story .followers_wrapper,
.story .tasks,
.story .timestamp_wrapper,
.iteration .preview .points,
// External selector for jquery
$.expr[":"].external = function(obj, index, meta, stack) {
var a = $(obj).prop("href") || "";
var server = window.location.href.split('/'); server = server[0] + "//" + server[2];
if(a == "#" || a == "" || a.indexOf(server)>-1 || a.indexOf("javascript:")>-1 ) {
return false;
}
return true;
}
@johandouma
johandouma / simplevalidation.js
Last active April 14, 2016 03:43
Simplest validation for Safari and <=IE9
//// Validation
if (typeof document.createElement('input').checkValidity === 'function') {
$('form').submit(function (e) {
if (!this.checkValidity()) {
e.preventDefault();
alert('Some fields are invalid. Please check your form again. ');
}
});
} else {
$('form').submit(function (e) {
@johandouma
johandouma / gist:73b5da17334773138d60
Last active January 16, 2016 08:12
Craft CMS + Foundation Top Bar Twig Macro
{% macro menu(entries, active, level) %}
{% if entries|length %}
{% set level = level|default(1) %}
<ul class="level-{{ level }} {{ level > 1 ? "dropdown sub" : "left top" }}">
{% for n in entries %}
<li class="{{ loop.first ? "first" : "" }} {{ loop.last ? "last" : "" }}
{%- if n.children|length %}has-dropdown{% endif %}
{%- if active is defined and (active.descendantOf(n) or active.id == n.id) %} active{% endif %}">
<a href="{{ n.url }}">
{{ n }}
@johandouma
johandouma / stringToRgb.php
Created July 21, 2014 23:39
Generate colour from string
<?php
function stringToRgb($string, $s = 100, $l = 70){
$h = floor((hexdec(substr(md5($string), 0, 2))/255)*360);
$h /= 360;
$s /= 100;
$l /= 100;