Skip to content

Instantly share code, notes, and snippets.

View piyonishi's full-sized avatar
On target

Yusuke Nakanishi piyonishi

On target
View GitHub Profile
@piyonishi
piyonishi / open_browser.sh
Created September 22, 2014 04:59
ブラウザ起動
open -a Firefox
open -a Safari
open -a Google\ Chrome
// 命令形
var total = 0,
num = 0,
ave,
i;
for (i = 1; i <= 10; i++) {
total += i;
num++;
}
@piyonishi
piyonishi / closure.js
Created May 19, 2015 15:16
クロージャ
function newCounter() {
var i = 0;
return function() {
i = i + 1;
return i;
}
}
var c1 = newCounter();
var c2 = newCounter();
console.log(c1()); // 1
// Cache the querySelector/All for easier and faster reuse
window.$ = document.querySelectorAll.bind(document);
window.$$ = document.querySelector.bind(document);
// Get element(s) by CSS selector:
window.qs = function (selector, scope) {
return (scope || document).querySelector(selector);
};
window.qsa = function (selector, scope) {
return (scope || document).querySelectorAll(selector);
@piyonishi
piyonishi / ratio.css
Created February 21, 2016 19:15
ratio.css
.pannel {
display: block;
position: relative;
width: 100%;
&:before {
content: "";
display: block;
padding-top: 50%;
}

git config --global core.quotepath false

.posts {
list-style: none;
margin: 0;
padding: 0;
}
/* 上書きする例(bad) */
.post {
border-bottom: 1px solid #eee;
@piyonishi
piyonishi / docker-memo.txt
Last active March 12, 2019 08:13
Dockerのメモ
# Dockerで<none>なイメージを一括で削除するワンライナー
# not danglingなimageを全て削除
docker image prune
# not danglingなcontainer, volume, network,imageを全て削除
docker system prune
@-moz-document url-prefix() {
select {
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: "";
}
}
@piyonishi
piyonishi / focus-end-input-react.js
Last active February 2, 2025 20:59
How to put focus at the end of an input with React.js
// https://coderwall.com/p/0iz_zq/how-to-put-focus-at-the-end-of-an-input-with-react-js
moveCaretAtEnd(e) {
var temp_value = e.target.value
e.target.value = ''
e.target.value = temp_value
}
render() {
<textarea