This file contains 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
var uint8array = new Uint8Array(arrayBuffer); //arrayBufferにはデータが入っているとする | |
var value = (uint8array[0] << 8) + uint8array[1]; | |
if(value & 0x8000){ | |
value = -((value - 1) ^ 0xffff); //2の補数計算 | |
} | |
alert(value); //valueに変換された値 |
This file contains 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
function download(url, name){ | |
var a = document.createElement('a'); | |
a.href = url; | |
a.setAttribute('download', name || 'noname'); | |
a.dispatchEvent(new CustomEvent('click')); | |
} |
This file contains 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
.target{ | |
width:/*ImageWidth*/; | |
height:/*ImageHeight*/; | |
background-image: url(Octcat.png); | |
} |
This file contains 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
<input ng-model="hoge" type="text"> | |
<h1>{{hoge}}</h1> |
This file contains 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
$('body').on('dragover', function(e){ | |
e.stopPropagation(); | |
e.preventDefault(); | |
$('#overlay').fadeIn(300); | |
}); | |
$('body').on('dragleave', function(e){ | |
e.stopPropagation(); | |
e.preventDefault(); | |
$('#overlay').fadeOut(300); |
This file contains 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
<div ng-app="myApp"> | |
<div ng-controller="testCtrl"> | |
{{hoge}} | |
</div> | |
</div> |
This file contains 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
$N: 20; | |
$COLOR: green; | |
$WIDTH: 500px; | |
$HEIGHT: 500px; | |
@function W1x($x, $y){ @return 0.836 * $x + 0.044 * $y;} | |
@function W2x($x, $y){ @return -0.141 * $x + 0.302 * $y;} | |
@function W3x($x, $y){ @return 0.141 * $x - 0.302 * $y;} | |
@function W4x($x, $y){ @return 0;} |
This file contains 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
.fizzbuzz(@i:1){ | |
& when (@i >= 1) and (@i <= 100){ | |
@fizz: ceil(@i / 3) - floor(@i / 3); | |
@buzz: ceil(@i / 5) - floor(@i / 5); | |
@fizzbuzz: @fizz + @buzz; | |
& when not (@fizz = 0) and not (@buzz = 0){ | |
@{i}: @i; | |
} | |
& when (@fizz = 0) and not (@fizzbuzz = 0){ |
This file contains 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
h2{ | |
text-align: center; | |
background: black; | |
color: white; | |
-webkit-transition-property: all; | |
transition-property: all; | |
-webkit-transition-duration: 1s; | |
transition-duration: 1s; | |
} |
This file contains 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
var array = []; | |
// データをセット | |
for(var i = 0;i < 100;i++){ | |
array[i] = i; | |
} | |
//横幅を10にセット | |
var array2d = to2dArray(array, 10); | |
// x = 3, y = 2の値を取得, 23 | |
console.log(array2d[3][2]); | |
// x = 9, y = 9に値をセット |
OlderNewer