Skip to content

Instantly share code, notes, and snippets.

@jmblog
jmblog / new-clearfix.css
Created December 13, 2009 01:23
new clearfix
/* new clearfix */
/* http://perishablepress.com/press/2009/12/06/new-clearfix-hack/ */
.clearfix:after {
visibility: hidden;
display: block;
font-size: 0;
content: " ";
clear: both;
height: 0;
}
@jmblog
jmblog / gist:255328
Created December 13, 2009 07:16
モダンなファイル入出力
### file read ###
open my $fh, '<', $filename || die $@;
while (my $line = <$fh>) {
print $line;
}
close $fh;
### file write ###
use utf8;
@jmblog
jmblog / gist:255912
Created December 14, 2009 08:50
超シンプルなCoroのサンプル
use Coro;
### To create a thread, use the async function
async {
print "async 1\n";
cede;
print "async 2\n";
};
print "main 1\n";
@jmblog
jmblog / gist:257725
Created December 16, 2009 10:05
ヒアドキュメント
### ヒアドキュメント(変数展開なし) ###
my $text1 = <<'EOS';
aaa
bbb
ccc
EOS
### ヒアドキュメント(変数展開あり) ###
my $eee = 'eee;
my $text2 = <<"EOS"
@jmblog
jmblog / 1kb_grid.scss
Created May 10, 2011 02:34
1kb_grid.scss
/*
1kb_grid.scss
This SCSS is based on "The 1Kb CSS Grid".
Learn more ~ http://www.1kbgrid.com/
*/
/* Grid Settings
---------------------------*/
$columns: 12; // Number of columns (9, 10, 12, 14 or 16)
@jmblog
jmblog / 1kb_grid_extended.scss
Created May 10, 2011 04:52
1kb_grid_extended.scss
/*
1kb_grid_extended.scss
This SCSS is based on "The 1Kb CSS Grid".
Learn more ~ http://www.1kbgrid.com/
*/
/* Grid Settings
---------------------------*/
$columns: 12; // Number of columns (9, 10, 12, 14 or 16)
@jmblog
jmblog / adjust-font-size.scss
Created May 12, 2011 01:21
adjust-font-size.scss
@function -yui-font-size($px) {
@if $px == 10 { @return 77%; }
@else if $px == 11 { @return 85%; }
@else if $px == 12 { @return 93%; }
@else if $px == 13 { @return 100%; }
@else if $px == 14 { @return 108%; }
@else if $px == 15 { @return 116%; }
@else if $px == 16 { @return 123.1%; }
@else if $px == 17 { @return 131%; }
@else if $px == 18 { @return 138.5%; }
@jmblog
jmblog / linear-gradient.scss
Created August 12, 2011 05:10
linear-gradient.scss
$css3-ie-support: 0 !default;
@mixin linear-gradient($topColor, $bottomColor) {
background-image: -moz-linear-gradient(top, $topColor, $bottomColor);
background-image: -webkit-gradient(linear, left top, left bottom, from($topColor), to($bottomColor));
// If you set the output style as "compressed", it doesn't work well...
@if $css3-ie-support == 1 {
$ieTopColor: rgb(red($topColor), green($topColor), blue($topColor));
$ieBottomColor: rgb(red($bottomColor), green($bottomColor), blue($bottomColor));
@jmblog
jmblog / gist:1188292
Created September 2, 2011 09:56
Check z-index in IE6/7
$('*').each(function() {
var position = $(this).css('position'),
zIndex = $(this).css('z-index');
if (position != 'static' && zIndex != 'auto') {
console.log(position, zIndex, $(this));
} else if (position != 'static') {
console.log(position, '0 in IE', $(this));
}
});