Skip to content

Instantly share code, notes, and snippets.

View ronnyandre's full-sized avatar

Ronny-André Bendiksen ronnyandre

View GitHub Profile
@ronnyandre
ronnyandre / header.html
Created June 5, 2014 08:04
All Search and Social Media Meta Tags Starter Template
<!-- Search Engines / Google -->
<meta name="author" content="Wikipedia User">
<meta name="description" content="Telangana is a state in southern India. It was part of the princely state of Hyderabad (Medak and Warangal Divisions) which was ruled by the Nizams during the British Raj until 1947, and later until 1948, when it joined the Union of India.">
<!-- Social: Twitter -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@wikipedia">
<meta name="twitter:creator" content="wikipedia_user">
<meta name="twitter:title" content="Telangana">
<meta name="twitter:description" content="Telangana is a state in southern India. It was part of the princely state of Hyderabad (Medak and Warangal Divisions) which was ruled by the Nizams during the British Raj until 1947, and later until 1948, when it joined the Union of India.">
@ronnyandre
ronnyandre / gist:5822886bd25a8ba9f895
Last active August 29, 2015 14:07
WCAG 2.0 A/AA / Tilgjengelighetsloven

Images

  • Alternative text is required. The alternative text is not the same as image description in WP. Alt text should explain what the photo shows.
  • Alt text for linked images should describe the link, not the image.
  • Hi-res (retina or SVG) is good for users who need to zoom.

RESP: Editor/designer/developer.

Colors

<?php
// URL til varselet
$url = 'http://www.yr.no/sted/Norge/Hordaland/Bergen/Bergen/varsel.xml';
// Les data fra URL
$xmldata = file_get_contents($url);
// Les dataene og gjør om til SimpleXML-objekt
$xml = new SimpleXMLElement($xmldata);
@ronnyandre
ronnyandre / gist:900309
Created April 3, 2011 08:50
Comprehensive List of Browser-Specific CSS Hacks
/**
* Source: Paul Irish - Comprehensive List of Browser-Specific CSS Hacks
* http://paulirish.com/2009/browser-specific-css-hacks/
**/
/***** Selector Hacks ******/
/* IE6 and below */
* html #uno { color: red }
@ronnyandre
ronnyandre / js.js
Created March 8, 2012 13:33
JavaScript: Sexy PubSub
var o = $( {} );
$.subscribe = o.on.bind(o);
$.unsubscribe = 0.off.bind(o);
$.publish = o.trigger.bind(o);
@ronnyandre
ronnyandre / style.css
Created March 8, 2012 13:34
CSS: Image Replacement
.ir {
border: 0;
font: 0/0 a;
text-shadow: none;
color: transparent;
background-color: transparent;
}
@ronnyandre
ronnyandre / jQuery: PubSub
Created March 8, 2013 14:18
JavaScript: jQuery PubSub
(function($) {
var o = $( {} );
$.each({
on: 'subscribe',
trigger: 'publish',
off: 'unsubscribe'
}, function( key, api ) {
$[api] = function() {
o[key].apply( o, arguments );
@ronnyandre
ronnyandre / gist:5261967
Last active December 15, 2015 12:39
Don't prevent events when users hold CTRL or META keys
document.getElementById("myLink").addEventListener("click", function(e) {
// e.preventDefault(); (bad)
if(e.meta || e.ctrlKey) return; // Don't block user if they want to open a new tab
e.preventDefault();
});
@ronnyandre
ronnyandre / index.html
Created March 28, 2013 09:32
A CodePen by Ronny-André Bendiksen. Slide in from bottom boxes - Saw this while using Google+ app on my (Android) Nexus 7.
<section>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
<div class="module"></div>
@ronnyandre
ronnyandre / dateinterval.php
Last active December 17, 2015 14:49
Get each occurence in DatePeriod
<?php
// Found at http://www.php.net/manual/en/class.dateperiod.php
// Credit goes to jkaatz at gmx dot de
// ************************************************
// Nice example from PHP Spring Conference (thanks to Johannes Schlüter and David Zülke)
$begin = new DateTime('2013-05-01 00:00:00');
$end = new DateTime('2013-12-31 23:59:59');