Skip to content

Instantly share code, notes, and snippets.

class ClassMethod(object):
"Emulate PyClassMethod_Type() in Objects/funcobject.c"
def __init__(self, f):
self.f = f
def __get__(self, obj, klass=None):
if klass is None:
klass = type(obj)
def newfunc(*args):
class Line(object):
def __init__(self, a, b):
self.a = a
self.b = b
def __eq__(self, other):
return all((
self.a == other.a,
self.b == other.b
))
# 対話モード >>> に
# コピペで実行できます。
class Container:
def __init__(self, list_):
self._list = list_
def __len__(self):
return len(self._list)
def __getitem__(self, index):
# 対話モード >>> に
# コピペで実行できます。
class Container:
def __iter__(self):
return Iterator()
class Iterator:
def __iter__(self):
return self
# 偶数だけ取得します。
lst = [1, 2, 3, 4, 5, 6, 7]
new_lst = list(filter(lambda x: x % 2, lst))
print(new_lst)
# [1, 3, 5, 7]
"""Send an email from Gmail.
Before execute this code, you have some tasks.
1) for temporary
Turn on the flag "Allow less secure apps"
from the follwoing link.
https://myaccount.google.com/lesssecureapps
or
class ClassMethod(object):
"Emulate PyClassMethod_Type() in Objects/funcobject.c"
def __init__(self, f):
self.f = f
def __get__(self, obj, klass=None):
... # ここを実装してください。
def __call__(self, *args, **kwargs):
set mouse=a
set clipboard+=unnamedplus
set runtimepath+=/Users/ユーザ名/.cache/dein/repos/github.com/Shougo/dein.vim
if dein#load_state('/Users/ユーザ名/.cache/dein')
call dein#begin('/Users/ユーザ名/.cache/dein')
call dein#add('/Users/ユーザ名/.cache/dein/repos/github.com/Shougo/dein.vim')
" ale に乗り換えたい...
call dein#add('scrooloose/syntastic')
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
</head>
<body>
<div id="app">
<header>
<button v-on:click="show=!show">切り替え</button>
</header>
@niconico25
niconico25 / highlighter.html
Last active March 2, 2019 08:00
はてなブログでマーカーが引けるようになります。
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.7/dist/vue.js"></script>
<script>
// DOM が描画されるまで待つ
setTimeout(vue, 1000);
function vue() {
new Vue({