Skip to content

Instantly share code, notes, and snippets.

View yomotsu's full-sized avatar

Akihiro Oyamada yomotsu

View GitHub Profile
var scrollbarWidth = ( function () {
var outer = document.createElement( 'div' );
outer.style.visibility = 'hidden';
outer.style.width = '100px';
outer.style.msOverflowStyle = 'scrollbar';
document.body.appendChild( outer );
var widthNoScroll = outer.offsetWidth;
.myDiv {
padding-right: #{'5px' + '\\9'}; /* IE8,9,10 */
}
@yomotsu
yomotsu / base.scss
Last active May 12, 2016 03:10
最初に用意しておきたいやつ
.s5--alignStart {text-align:left !important; }
.s5--alignEnd {text-align:right !important; }
.s5--alignCenter {text-align:center !important; }
.s5--alignTop {vertical-align:top !important; }
.s5--alignMiddle {vertical-align:middle !important; }
.s5--alignBottom {vertical-align:bottom !important; }
/* modifier:font size
========================================================================== */
@yomotsu
yomotsu / gist:509c89f75bc25f948046
Last active August 29, 2015 14:25
unique array in pure js
var a = [ {x:1}, {x:2}, {x:1}, {x:1}, {x:3} ];
console.log( unique( a ) ); // -> [ {x:1}, {x:2}, {x:3} ]
function unique ( array ) {
var result = [];
array.forEach( function ( el ) {
AutoFileName
Codecs33
ConvertToUTF8
Hayaku
HTML5
Surround
Tag
THREE.js Autocomplete
@yomotsu
yomotsu / gist:de14c32e9828d18dea88
Last active August 29, 2015 14:20
smoothNoise
<div id="xxx"></div>
<script>
var noise = function ( x ) {
x = ( x << 13 ) ^ x;
return 1 - ( ( x * ( x * x * 15731 + 789221 ) + 1376312589 ) & 0x7fffffff ) / 1073741824;
}
@yomotsu
yomotsu / gist:55fbc244fd7e557b449c
Created April 30, 2015 05:35
UNDERSCORE PARTIAL exclusive _.template
// UNDERSCORE PARTIAL
//
// Underscore.js 1.8.3
// http://underscorejs.org
// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
// Underscore may be freely distributed under the MIT license.
(function() {
// Baseline setup
@yomotsu
yomotsu / gist:00d7475651a5ed556c3f
Created April 4, 2015 08:07
monokai のコードハイライトで keynote にペーストしたい

python のパッケージ Pygments をインストール。

$ sudo easy_install Pygments
pygmentize -f rtf -O 'fontface=Monaco,style=monokai' path/to/file.html | pbcopy
@yomotsu
yomotsu / gist:2f8a7823cdac9c3f7b5a
Created March 18, 2015 19:39
atom open in CHROME

~/.atom/packages/open-in-browser/lib/open-in-browser.coffee

の25行目を

when 'darwin' then exec ('open -a "/Applications/Google Chrome.app" '+filePath)

にすれば chrome で開ける

@yomotsu
yomotsu / gist:a2b28b0b22c7000e8da7
Last active January 24, 2018 08:20
こもじら: THREE.js でなにをつくろう? ネタ帳

なんでWebGL?

  • ブラウザーでだれでも、どこでも使うことができる。もちろんモバイルでも
  • インストールがいらない

  • 最近はUnityやUnreal EngineもWebGLを書き出せるようになりました!が、WebGLのメリットを活かすにはまだまだ問題も多い。近いうちに現実的になるかも?
    • パフォーマンスの問題(微調整できない)
  • 容量の問題