Skip to content

Instantly share code, notes, and snippets.

niconico25

Block or report user

Report or block niconico25

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View classmethod_staticmethod.py
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):
View comparison.py
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
))
View empty_iterator.py
# 対話モード >>> に
# コピペで実行できます。
class Container:
def __iter__(self):
return Iterator()
class Iterator:
def __iter__(self):
return self
View list_iterator.py
# 対話モード >>> に
# コピペで実行できます。
class Container:
def __init__(self, list_):
self._list = list_
def __len__(self):
return len(self._list)
def __getitem__(self, index):
View classmethod_staticmethod_practice.py
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):
View init.vim
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')
View index.html
<!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 Mar 2, 2019
はてなブログでマーカーが引けるようになります。
View highlighter.html
<script src="https://cdn.jsdelivr.net/npm/vue@2.6.7/dist/vue.js"></script>
<script>
// DOM が描画されるまで待つ
setTimeout(vue, 1000);
function vue() {
new Vue({
View gmail.py
"""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
View lambda_lesson.py
# 偶数だけ取得します。
lst = [1, 2, 3, 4, 5, 6, 7]
new_lst = list(filter(lambda x: x % 2, lst))
print(new_lst)
# [1, 3, 5, 7]
You can’t perform that action at this time.