Skip to content

Instantly share code, notes, and snippets.

View KOBA789's full-sized avatar
🚀

KOBA789 KOBA789

🚀
View GitHub Profile
@KOBA789
KOBA789 / qs.js
Created July 22, 2015 17:04
QueryString Parser/Stringifier
// THIS CODE IS LICENCED UNDER WTFPL
var qs = {
get: function () {
return qs.parse(window.location.search.substring(1));
},
parse: function (str) {
return str.split('&').map(function (value) { return value.split('='); })
.reduce(function (obj, pair) {
obj[pair[0]] = decodeURIComponent(pair[1]);
var A = /* put your answer here */,
B = /* put your answer here */;
if (B/A !== A/B && A === B && 1/A > 2/B) console.log('congrats!');
@KOBA789
KOBA789 / css_ident.js
Created March 18, 2015 00:41
CSS IDENT REGEXP
var CSS_IDENT = /-?(?:[_a-z]|[\240-\377]|(?:(:?\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?)|\\[^\r\n\f0-9a-f]))(?:[_a-z0-9-]|[\240-\377]|(?:(:?\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?)|\\[^\r\n\f0-9a-f]))*/;
pi@raspberrypi ~/qpuinfo $ make run
sudo ./qpuinfo
mapmem.c:46: pagesize: 4096
mapmem.c:52: offset_from_v3d: 0
p: 0xb6f6b000
p[0]: 0x55555555
V3D Technology Version: 85
V3D Id String: 0x55 0x55 0x55
V3D Id String: UUU
VPM Memory Size: 5
Linux raspberrypi 3.12.33+ #724 PREEMPT Wed Nov 26 17:55:23 GMT 2014 armv6l GNU/Linux
Linux raspberrypi 3.18.5-v7+ #225 SMP PREEMPT Fri Jan 30 18:53:55 GMT 2015 armv7l GNU/Linux
pi@raspberrypi ~/qpuinfo $ git log -1 -p
commit d3d4745808231202a19365458e283d730e3d1a2e
Author: Terminus <[email protected]>
Date: Sun Feb 8 05:06:01 2015 +0900
change to point physical address, not bus address
Special thanks to @KOBA789 !
diff --git a/mapmem.c b/mapmem.c
pi@raspberrypi ~/qpuinfo $ git pull
Already up-to-date.
pi@raspberrypi ~/qpuinfo $ make run
sudo ./qpuinfo
mapmem.c:46: pagesize: 4096
mapmem.c:52: offset_from_v3d: 0
p: 0xb6fc5000
p[0]: 0xdeadbeef
V3D Technology Version: 222
V3D Id String: 0xad 0xbe 0xef
@KOBA789
KOBA789 / gist:89d1505ab2fc37b6fe9f
Created February 5, 2015 14:48
Raspberry Pi 2 qpuinfo
mapmem.c:46: pagesize: 4096
mapmem.c:52: offset_from_v3d: 0
p: 0xb6ff3000
p[0]: 0x00000000
V3D Technology Version: 0
V3D Id String: 0x00 0x00 0x00
V3D Id String:
VPM Memory Size: 0
@KOBA789
KOBA789 / warning.md
Last active August 29, 2015 14:14
JS でフロントエンドを書くときに気をつけること

ポエム

JS でフロントエンドを書くときに気をつけること

  • いかなる時も UI はブロックされず、ユーザーは自由である

    • 押せるボタンはすべて押すものとして設計する
    • フォームの送信ボタンを押した瞬間にフォームの要素は適切に readonly あるいは disabled になるべきである
  • ユーザーの操作を UI だけで制限してはいけない

  • tab キーよるフォーカス移動などによって不可視な要素に対してイベントを発行できる

@KOBA789
KOBA789 / problem.js
Created November 28, 2014 16:06 — forked from mactkg/problem.js
var Obj = function() {
this.func = function() {
return something.f().then(this._a, this._b);
}
this._a = function() {
//something...(終わったらhoge実行)
}
this._b = function() {