Skip to content

Instantly share code, notes, and snippets.

View terkel's full-sized avatar

Takeru Suzuki terkel

View GitHub Profile
@terkel
terkel / gist:1681150
Last active September 29, 2015 22:48
Detect IE and add classes to the <html> element
// Detect IE versions
// https://gist.github.com/527683
var ie = (function () {
var v = 3,
div = document.createElement('div'),
all = div.getElementsByTagName('i');
do {
div.innerHTML = '<!--[if gt IE ' + (++v) + ']><i></i><![endif]-->';
} while (all[0]);
return (v > 4)? v: void 0;
@terkel
terkel / sticky-footer.html
Last active September 30, 2015 01:07
CSS Sticky Footer
@terkel
terkel / gist:1784889
Created February 10, 2012 00:51
CSS line break
.br-before:before,
.br-after:after {
content: "\A";
white-space: pre-line;
}
@terkel
terkel / colorbox.html
Last active October 1, 2015 06:38
HTML generated by ColorBox
<div id="cboxOverlay"></div>
<div id="colorbox">
<div id="cboxWrapper">
<div>
<div id="cboxTopLeft" style="float: left;"></div>
<div id="cboxTopCenter" style="float: left;"></div>
<div id="cboxTopRight" style="float: left;"></div>
</div>
<div style="clear: left;">
<div id="cboxMiddleLeft" style="float: left;"></div>
@terkel
terkel / jquery.parallax.js
Created March 12, 2012 08:16
jQuery Parallax Effect plugin
/*!
* jQuery Parallax Effect plugin v0.9
* https://gist.github.com/2020675
*
* Copyright (c) 2012 Takeru Suzuki - http://terkel.jp/
* Licensed under the MIT license - http://www.opensource.org/licenses/MIT
*/
(function (window, $) {
$.fn.parallax = function (options) {
@terkel
terkel / adr-pref-ja.html
Last active October 1, 2015 17:08
都道府県
<select name="adr-pref" id="adr-pref">
<optgroup label="北海道・東北">
<option>北海道</option>
<option>青森県</option>
<option>岩手県</option>
<option>宮城県</option>
<option>秋田県</option>
<option>山形県</option>
<option>福島県</option>
</optgroup>
@terkel
terkel / _grid.scss
Created March 18, 2012 03:11
Sass Grid
$column-count: 12;
$column-width: 3em;
$gutter: 2em;
// 1. Class pattern
.gridRow {
margin-left: -($gutter);
@include clearfix;
@terkel
terkel / gist:2284704
Created April 2, 2012 16:11
RSS feed text example
To keep updated, you can <a href="...">subscribe to my RSS feed</a>.
http://elliotjaystocks.com/
<a href="..." title="Subscribe to my RSS feed">
http://dbushell.com/
For updates, please use <a href="...">RSS feed<a/>
http://www.maratz.com/about/
<a href="..." title="Subscribe to my RSS feed for updates">
@terkel
terkel / gist:2719671
Created May 17, 2012 15:34
Get root-relative URL for WordPress
<?php
function get_root_rel_url ($url) {
$blog_url = get_bloginfo('url');
$url = str_replace($blog_url, '', $url);
return $url;
}
function root_rel_url ($url) {
echo get_root_rel_url($url);
@terkel
terkel / gist:2722543
Created May 18, 2012 01:04
Get copyright years for WordPress
<?php
function get_copyright_date ($then) {
$now = date('Y');
if ($now > $then) {
return $then.'&#8211;'.$now;
} else {
return $then;
}
}