Skip to content

Instantly share code, notes, and snippets.

View makotoworld's full-sized avatar
😉
Happy Coding!

nzk makotoworld

😉
Happy Coding!
View GitHub Profile
@makotoworld
makotoworld / cyclone.py
Created April 17, 2012 01:40
flask deploy tornado
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from tornado.wsgi import WSGIContainer
from tornado.ioloop import IOLoop
from tornado.web import FallbackHandler, RequestHandler, Application
from wsgi import app
class MainHandler(RequestHandler):
def get(self):
@makotoworld
makotoworld / gist:2766649
Created May 22, 2012 04:44
HTML5のVIDEOタグのあるところで、倍速設定する方法
video = document.getElementById('video');
video.playbackRate = 2.0; //2倍速
@makotoworld
makotoworld / gist:2829159
Created May 29, 2012 15:46
Amazon S3 Memo (boto)
# DELETE
c = boto.connect_s3()
b = Bucket(c, 'deafway.jp')
list = b.get_all_keys()
for i in list:
if 'sign201' in i.name:
k = Key(b)
k.key = i.name
b.delete_key(k)
@makotoworld
makotoworld / bitbucket_issue_customize.user.js
Created July 3, 2012 06:30
Bitbucket Issue Customize Page
// ==UserScript==
// @name Bitbucket Issue Customize Page
// @namespace http://makotoworld.hatenablog.com/
// @description issue page customize.
// @include http://bitbucket.org/*/*/issues?status=new
// @include https://bitbucket.org/*/*/issues?status=new
// @version 0.1.0
// ==/UserScript==
// @author Makoto Nozaki
// @history [2012-07-03] 0.1.0 initial version
@makotoworld
makotoworld / gist:3234813
Created August 2, 2012 07:27
Social Button
<div class="social-buttons" data-url="http://www.deafway.jp/"></div>
<script type="text/javascript">
<!--
$(document).ready(function() {
var mixi_favorite_parse = function() {
$('div[data-plugins-type="mixi-favorite"]:empty').each(function(i, e) {
new window.__MIXI_PLUGINS__.FavoriteFrame(e);
});
$(function() {
var topBtn = $('#page-top');
topBtn.hide();
$(window).scroll(function () {
if ($(this).scrollTop() > 80) {
topBtn.fadeIn();
} else {
topBtn.fadeOut();
}
});
q_op_map = {
OP_EQ: '=',
OP_LT: '<',
OP_LTE: '<=',
OP_GT: '>',
OP_GTE: '>=',
OP_NE: '!=',
OP_IN: 'IN',
OP_IS: 'IS',
OP_LIKE: 'LIKE',
@makotoworld
makotoworld / gist:4129898
Created November 22, 2012 07:58
python でエポック秒を好きなフォーマットで出力する
# import datetime
# import time
# date = datetime.datetime(*time.localtime(1111111111)[:-3]).strftime('%Y/%m/%d %H:%M:%S')
@makotoworld
makotoworld / gist:4159459
Created November 28, 2012 06:42
python で指定日時をエポック秒に変換する
import datetime
import time
int(time.mktime(datetime.datetime(2012, 3, 3, 22, 0, 57).timetuple()))
@makotoworld
makotoworld / gist:4334367
Created December 19, 2012 04:23
python で json を解析、出力する
import simplejson
## 書き出し
sample = {"@title": "みんなのPython", "author": "柴田淳", "pub": ["SoftBank Creative", "2006"]}
file = open("sample.json", "w")
simplejson.dump(sample, file, indent=3)
## sample.jsonの中身
#{
# "@title": "みんなのPython",
# "pub": [