This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set filetype=python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A: | |
@property | |
def value(self): | |
return 1 | |
sample_list = [A(), A(), A()] | |
print reduce(lambda x, y: x + y.value, sample_list, 0) | |
print reduce(lambda x, y: x + y, map(lambda x: x.value, sample_list)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@pytest.mark.parametrize( | |
('rolls', 'expected'), | |
[ | |
([1, 2], 18 + 3), | |
([10, 5, 5], 18 + 30), | |
([5, 5, 10], 18 + 30), | |
] | |
) | |
def test_10_frame(rolls, expected): | |
g = Game() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def vim_input(message = 'input', secret = False): | |
vim.command('call inputsave()') | |
vim.command("let s:user_input = %s('%s :')" % (("inputsecret" if secret else "input"), message)) | |
vim.command('call inputrestore()') | |
return vim.eval('s:user_input') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ExpiresActive On | |
ExpiresByType image/png "access plus 20 days" | |
ExpiresByType image/jpg "access plus 50 days" | |
ExpiresByType image/jpeg "access plus 50 days" | |
ExpiresByType image/ico "access plus 10 month" | |
ExpiresByType image/gif "access plus 30 days" | |
ExpiresByType text/javascript "access plus 8 days" | |
ExpiresByType application/javascript "access plus 8 days" | |
ExpiresByType text/css "access plus 8 days" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="gist">https://gist.github.com/3364994</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
custom style for gist | |
div.section と組み合わせて適用範囲を限定することで、標準の.gist-xxxxの設定を上書きしている。 | |
*/ | |
div.section .gist .gist-file .gist-data pre{ | |
-moz-border-radius-bottomleft: 0; | |
-moz-border-radius-bottomright: 0; | |
-webkit-border-bottom-left-radius: 0; | |
-webkit-border-bottom-right-radius: 0; | |
background: #000000 !important; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mcs -t:library Account.cs | |
mcs -t:library -r:nunit.framework,Account.dll AccountTest.cs | |
nunit-console AccountTest.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt-get install haskell-platform | |
cabal update | |
cabal install pandoc | |
make sure path | |
cabal path is ${HOME}/.cabal/bin | |
sudo apt-get install graphviz libgraphviz-dev pkg-config python-dev | |
git clone https://github.com/jgm/pandocfilters.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def f(a): | |
a.index = [0 for i in range(len(a))] | |
del a['rot'] | |
out = a[0:1] | |
for i in range(1, len(a)): | |
out = out.join(a[i:i+1], rsuffix='{0}'.format(i)) |
OlderNewer