Skip to content

Instantly share code, notes, and snippets.

View float1251's full-sized avatar

float1251 float1251

View GitHub Profile
@float1251
float1251 / index.html
Created August 9, 2013 15:28
動的にCSSAnimationを作成するサンプル
<!DOCTYPE html>
<html>
<head>
<title>Sample Animation</title>
<link rel="stylesheet" href="sample.css"/>
</head>
<body>
@float1251
float1251 / gist:9883263
Created March 31, 2014 01:16
pythonでの文字列内の最大頻出文字抽出
max(text,key=lambda s:s.count)
@float1251
float1251 / middleware.py
Created May 5, 2014 11:41
django-profile-middleware
from datetime import datetime
import cProfile
import pstats
from django.conf import settings
class PerfomanceMesuamentMiddleware:
"""
consoleに実行時間を表示する。
表示条件は以下
@float1251
float1251 / pytest.py
Created May 7, 2014 01:41
vimscriptでpythonを使用する
def func():
print("test")
@float1251
float1251 / sample.vim
Created May 8, 2014 01:27
vimscriptでclassっぽいことをやってみる
" vimscriptでclassっぽく扱う
" dictionaryで頑張る
let s:MyClass = {"foo": "foo"}
function! s:MyClass.print() dict
echo self.foo
endfunction
" instance作成はcopyで代用
function! s:MyClass.new(text) dict
@float1251
float1251 / openbrowser.vim
Created May 17, 2014 10:15
選択したurlをブラウザで開くvimプラグイン
" File: openbrowser.vim
" License: MIT
if &cp || (exists("g:loaded_openbrowser_vim") && g:loaded_openbrowser_vim)
finish
endif
function! OpenBrowser()
let tmp = @@
silent normal gvy

unittestのコードリーディングメモ

今回読んだのは3.3のunittestのソース。 ソースを読む前に以下のドキュメントは確認しておく。 とりあえず以下の4つの概念を知っておくだけで理解が早まると思う。

http://docs.python.jp/3.3/library/unittest.html

@float1251
float1251 / jquery-event.rst
Last active August 29, 2015 14:01
bind,on,delegateの違い

event listenerの調査

調査方法

10001個のliをappendして、li要素に対してbind,on(bind方式),delegateでイベントを設定する。

それによるListenerの数とメモリの違いを調査する。

@float1251
float1251 / gist:75419faaae3b6b335d48
Last active August 29, 2015 14:01
vimで実行されているスクリプトファイルを取得する
let s:py_path = join([expand('<sfile>:p:h:h'), "python"], '/')
@float1251
float1251 / runtest.vim
Created June 5, 2014 13:27
testを実行するvimscript
let g:expectpy_path="PROJECT_DIRECTORY"
noremap <leader><C-r> :call RunTest() <CR>
function! RunTest()
let l:cwd = getcwd()
:exec "cd ".g:expectpy_path
:!python setup.py test
:exec "cd ".l:cwd
endfunction