Skip to content

Instantly share code, notes, and snippets.

View anselmh's full-sized avatar

Anselm Hannemann anselmh

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Cross-browser kerning-pairs & ligatures</title>
<style>
body { font-family: sans-serif; background: #f4f3f3; color: rgba(40, 30, 0, 1); width: 500px; margin: 80px auto; padding: 0px; }
a { color: rgba(15, 10, 0, 0.8); text-decoration: none; border-bottom: 1px solid; padding: 1px 1px 0px; -webkit-transition: background 1s ease; }
a:hover { background: rgba(0, 220, 220, 0.2); }
p, li { line-height: 1.5; padding: 0em 1em 0em 0em; margin: 0em 0em 0.5em; }
<?php
$output = '';
$tElementClass = !empty($tElementClass) ? $tElementClass : 'modSnippet';
$tStart = $modx->getMicroTime();
if (!empty($tElement)) {
switch ($tElementClass) {
case 'modChunk':
$output = $modx->getChunk($tElement, $scriptProperties);
break;
@necolas
necolas / style.css
Created June 14, 2011 12:18
HTML5 Boilerplate a la normalize.css
/* =============================================================================
HTML5 element display
========================================================================== */
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
audio[controls], canvas, video { display: inline-block; *display: inline; *zoom: 1; }
/* =============================================================================
Base
@chuanxshi
chuanxshi / style.css
Created June 18, 2011 10:49 — forked from necolas/style.css
HTML5 Boilerplate a la normalize.css
/* =============================================================================
HTML5 element display
========================================================================== */
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; }
/* =============================================================================
Base
========================================================================== */

shiminy: minimal es5-shim

Looking at the ES5 compatibility table, several browsers provide everything often used (i. e. not Object.freeze() and friends) except Function.prototype.bind. So I just inline that. Browsers that don't provide other functions also don't include Object.getOwnPropertyNames, so I used it as my test for including the entire shim.

Note that I haven't tested it yet, and it doesn't work for the six Object functions next to each other in the Safari 5 part of the compatibility chart (Safari 5 is deemed good enough).

Update: I added JSON for IE <= 7. JSON is used in a good number of node.js modules.

@anselmh
anselmh / responsive-attr-html5.html
Last active September 26, 2015 21:07
responsive attribute for HTML/CSS3
<!-- backwards compatible solution -->
<!-- the browser should read media-query and then download the right file for the actual screen size -->
<img media-xs="(min-width:640px)" media-xs-src="http://cdn.url.com/img/myimage_xs.jpg" media-m="(max-width:1024px)" media-m-src="http://cdn.url.com/img/myimage_m.jpg" media-xl="(min-width:1025px)" media-xl-src="http://cdn.url.com/img/myimage_xsl.jpg" src="http://cdn.url.com/img/myimage_xs.jpg" />
<img media-xs="(max-width:640px)"
media-xs-src="http://cdn.url.com/img/myimage_xs.jpg"
media-m="(max-width:1024px)"
media-m-src="http://cdn.url.com/img/myimage_m.jpg"
media-xl="(min-width:1025px)"
media-xl-src="http://cdn.url.com/img/myimage_xsl.jpg"
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
<component lightWeight="true">
<attach event="onpropertychange" onevent="checkPropertyChange()" />
<attach event="ondetach" onevent="restore()" />
<attach event="onresize" for="window" onevent="restore();init()" />
<script type="text/javascript">
//<![CDATA[
var viewportwidth = (typeof window.innerWidth != 'undefined' ? window.innerWidth : element.document.documentElement.clientWidth);
// Shortcut for the document object
var doc = element.document;
@mattpodwysocki
mattpodwysocki / jsconf-eu-2011.md
Created October 1, 2011 13:40
JSConf.EU Slides
@netProphET
netProphET / migx_modx-2.2.diff
Created October 6, 2011 04:22
MIGX diff for MODX2.2
--------------- core/components/migx/elements/tv/input/migx.php ---------------
index 11a9c2d..53370a5 100644
@@ -133,6 +133,7 @@ $lang = $this->xpdo->lexicon->fetch();
$lang['mig_add'] = !empty($properties['btntext'])?$properties['btntext']:$lang['mig_add'];
$modx->smarty->assign('i18n', $lang);
$this->xpdo->smarty->assign('properties', $properties);
+$this->xpdo->smarty->assign('resource', is_object($this->xpdo->resource) ? $this->xpdo->resource->toArray() : array());
$this->xpdo->smarty->assign('pathconfigs', $this->xpdo->toJSON($pathconfigs));
$this->xpdo->smarty->assign('columns', $this->xpdo->toJSON($cols));
$this->xpdo->smarty->assign('fields', $this->xpdo->toJSON($fields));