This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* inspired by jdduke (http://jsbin.com/qofuwa/2/edit) | |
*/ | |
var preventPullToRefresh = (function preventPullToRefresh(lastTouchY) { | |
lastTouchY = lastTouchY || 0; | |
var maybePrevent = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://www.learningjquery.com/2007/10/improved-animated-scrolling-script-for-same-page-links | |
function scrollableElement(els) { | |
for(var i = 0, len = arguments.length; i < len; i++) { | |
var el = arguments[i], | |
$scrollElement = $(el); | |
if($scrollElement.scrollTop() > 0) { | |
return el; | |
} else { | |
$scrollElement.scrollTop(1); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http://h2ham.net/youtube-responsive | |
.youtube { | |
position: relative; | |
width: 100%; | |
padding-top: 56.25%; // it is aspect ratio. padding respect to the width | |
iframe { | |
position: absolute; | |
top: 0; | |
left: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$FontSize: 14px; | |
$LineHeight: $FontSize * 1.5; | |
@function getLineHeight($fontSize) { | |
$height: $LineHeight; | |
@while $height < $fontSize { | |
$height: $height + $height; | |
} | |
@return $height; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%vCentering { | |
// https://css-tricks.com/centering-in-the-unknown/ | |
text-align: center; | |
white-space: nowrap; | |
overflow-x: hidden; | |
&:before { | |
content: ""; | |
display: inline-block; | |
height: 100%; | |
vertical-align: middle; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# get 4 spaces indents(it is not works perfectly but enough) | |
/(?<!\S) {4}/ | |
# erace padding text such as ctrl char when logging bash log by [script] command | |
s/((?![\n\t])[[:cntrl:]])|(\[.*?(m|k))//g |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>Hello world!</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sundaycrafts", | |
"age": 18, | |
"gender": "male", | |
"msg": "<h1>Hello World!</h1>" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$maxWidth: 1330px | |
$col: 100px/$maxWidth * 100% | |
$margin: 10px/$maxWidth * 100% | |
@mixin col($contentCol:1, $marginCol-left:0, $marginCol-right:0) | |
width: $col*$contentCol + $margin*($contentCol - 1) | |
margin-left: ($col+$margin)*$marginCol-left + $margin | |
margin-right: ($col+$margin)*$marginCol-right + $margin | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// この実装は$.load()に限りなく近い | |
// http://james.padolsey.com/jquery/#v=2.1.3&fn=jQuery.fn.load | |
// http://stackoverflow.com/questions/16885538/how-to-load-an-html-fragment-with-jquery-ajax | |
$.ajax({ | |
url: 'page.html', | |
dataType: 'html' | |
}).done(responsText => | |
// 空のdiv要素に追加 | |
var $el = $('<div>').append($.parseHTML(responsText)).find('.selector'); | |
// この処理は逐次的に行う必要がある。 |
OlderNewer