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
void main() {
print('hello');
}
class User(db.Model):
__tablename__ = 'users'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(80), unique=True, index = True)
email = db.Column(db.String(120), unique=True, index = True)
image_url = db.Column(db.String(120), unique=True, index =True)
def __init__(self, name, password, email, image_url):
self.name = name
<div
onClick={onClickHandler}
onKeyPress={onKeyPressHandler}
role="button"
tabIndex="0">
Save
</div>
@piyonishi
piyonishi / focus-end-input-react.js
Last active December 21, 2023 09:48
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
@-moz-document url-prefix() {
select {
-moz-appearance: none;
text-indent: 0.01px;
text-overflow: "";
}
}
@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
.posts {
list-style: none;
margin: 0;
padding: 0;
}
/* 上書きする例(bad) */
.post {
border-bottom: 1px solid #eee;

git config --global core.quotepath false

@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%;
}
// 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);