Skip to content

Instantly share code, notes, and snippets.

@kotarok
kotarok / 0_reuse_code.js
Created March 22, 2014 16:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@kotarok
kotarok / Default (OSX).sublime-keymap
Created January 23, 2013 08:56
Default (OSX).sublime-keymap
[
{ "keys": ["super+("], "command": "toggle_setting", "args": {"setting": "word_wrap"} }
]
{
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/Espresso Soda.tmTheme",
"ensure_newline_at_eof_on_save": true,
"font_size": 13.0,
"highlight_line": true,
"highlight_modified_tabs": true,
"ignored_packages":
[
"Vintage"
@kotarok
kotarok / gist:1035044
Created June 20, 2011 02:47
iOS style scrollbar sass snippet
/* iOS style scrollbar */
&::-webkit-scrollbar {
width: 12px;
height: 12px;
}
&::-webkit-scrollbar-thumb {
background: #ddd;
border: 3px solid #fff;
@include radius(6px);
@kotarok
kotarok / $.fn.fixFxTableMargin
Created February 23, 2011 12:56
Fix the Firefox's bug that vertical margins of table elements don't collapse.
$.fn.fixFxTableMargin = function(conf){
if(!$.browser.mozilla) return this;
this.each(function(){
var elem = $(this);
elem.wrap('<div class="fixFxTableMargin" />');
var mt = elem.css('margin-top'),
mb = elem.css('margin-bottom');
elem.css({'margin-top':0,'margin-bottom':0})
@kotarok
kotarok / jquery.stickyfooter.js
Created January 16, 2011 12:22
Make footer stick to the bottom edge. Cares not to overlap upper content. Make sure that base ancestor element's position is 'relative.' I believe that mostly its 'body' element.
/*!
* jquery.stickyfooter.js
*
* Copyright 2011, Kotaro Kokubo
* kotaro@nodot.jp
* Dual licensed under the MIT or GPL Version 2 licenses.
*/
// In jQuery1.4.4, .outerHeight() or .height doesn't work collecly sometimes.
$.fn.stickyfooter = function(){
html {
/*to remove all comment nodes on IE*/
behavior: expression(this.behavior || ((function(a){
a=document.getElementsByTagName('!');
try{for(var i=0,l=a.length;i<l;i++){a[i].parentNode.removeChild(a[i])}}catch(e){};
})(),1));
}
.whatever slector {
/*run behaviour only one time*/
behavior: expression(this.behavior || (function(that){try{
/*do something here*/
}catch(e){};})(this),1);
}
@kotarok
kotarok / give 'first-child' class in
Created December 4, 2010 00:37
In this gist, add 'first-child' class for first-child element. This runs expression only one time. So browser doesn't get slow.
.someClass{
behavior: expression(this.style.behavior || ((function(a,b,c){
c=a.parentNode.getElementsByTagName('!');
try{for(var i=0,l=c.length;i<l;i++){c[i].parentNode.removeChild(c[i])}}catch(e){};
if(a.parentNode.firstChild==a){a.className+=' '+b}
})(this,"lu.first-child"),1));
}
@kotarok
kotarok / my clearfix
Created November 28, 2010 10:28
the clearfix I'm currently using
.clearfix {
*zoom: 1;
}
.clearfix:after {
content: '';
display: block;
clear : both;
height: 0;
}