Skip to content

Instantly share code, notes, and snippets.

Avatar

Yoshihide Jimbo jmblog

View GitHub Profile
View new-clearfix.css
/* 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 Dec 13, 2009
モダンなファイル入出力
View gist:255328
### file read ###
open my $fh, '<', $filename || die $@;
while (my $line = <$fh>) {
print $line;
}
close $fh;
### file write ###
use utf8;
@jmblog
jmblog / gist:255912
Created Dec 14, 2009
超シンプルなCoroのサンプル
View gist:255912
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 Dec 16, 2009
ヒアドキュメント
View gist:257725
### ヒアドキュメント(変数展開なし) ###
my $text1 = <<'EOS';
aaa
bbb
ccc
EOS
### ヒアドキュメント(変数展開あり) ###
my $eee = 'eee;
my $text2 = <<"EOS"
View 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
1kb_grid_extended.scss
View 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
adjust-font-size.scss
View 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 Aug 12, 2011
linear-gradient.scss
View 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 Sep 2, 2011
Check z-index in IE6/7
View gist:1188292
$('*').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));
}
});