Skip to content

Instantly share code, notes, and snippets.

@mogi
mogi / make_ctags.sh
Created January 16, 2015 08:47
git-hook make crags
#!/bin/sh
ctags -R
@mogi
mogi / dateutil.py
Created October 28, 2014 03:04
dateutil.parser.parseの使いかた
>>> import dateutil.parser
>>> print dateutil.parser.parse('Oct 3 12:00:00')
2014-10-03 12:00:00
>>> type(dateutil.parser.parse('Oct 3 12:00:00'))
<type 'datetime.datetime'>
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
csvから文字列を探して位置を返す
# 入力形式. csvが渡されることを想定
"Z","T","A","V",
"P","G","P","N",
# 出力形式
for i=1, 100 do
if i%3 == 0 and i%5 == 0 then
print(fizzbuzz')
elseif %3 == 0 then
print('fizz')
elseif i%5 == 0 then
print('buzz')
else
print(i)
end
@mogi
mogi / gist:5118118
Last active December 14, 2015 16:49
| static/
| | | css/
| | | fonts/
| | | images/
| | | js/
| | | movies/
| browser_scripts/ # js
| data/
| scripts/ # wsgi
| submodule/
# coding: utf-8
"""
ハンバーガーショップの合計金額計算
"""
import sys
from collections import defaultdict
########
# マスターデータ定義クラス群
@mogi
mogi / gist:4510622
Last active December 10, 2015 23:38
trim duplicate object
def trim_duplicate_by_objects_list(objects_list, obj_attr_name):
trimd = {}
for o in objects_list:
key = getattr(o, obj_attr_name)
if not key:
continue
trimd[key] = o
return trimd.values()
@mogi
mogi / gist:4286962
Last active October 14, 2015 01:28
lifegame
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
"""
class BaseRule(object):
def __init__(self, cell):
self.cell = cell
def valid():
raise NotImplementedError
@mogi
mogi / README
Created November 29, 2012 11:53
forked: Tree in the breeze
fork したものを写経してみた。
割とtypoしててびびった。
@mogi
mogi / markdown.md
Created November 22, 2012 09:58 — forked from azu/markdown.md
markdownで書かれたmarkdownチートシート

Code - コードの挿入

puts 'The best way to log and share programmers knowledge.'

puts 'The best way to log and share programmers knowledge.'

また、コードをインライン表示することも可能です。