This file contains hidden or 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
// 数字の有効桁を0埋めしたい場合の書き方 | |
// こんな書き方も可能 | |
console.log("00005".slice(-4)) | |
// -> 0005 |
This file contains hidden or 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
u''' | |
2. 組み込み関数 — Python v2.6.2 documentation | |
http://pythonjp.sourceforge.jp/dev/library/functions.html?highlight=sorted#sorted | |
''' | |
#java -Xms512M -Xmx512M -cp igo-0.4.2.jar net.reduls.igo.bin.BuildDic naist mecab-naist-jdic-0.6.3-20100801 EUC-JP | |
# a.strftime('%b %d, %Y %p%I:%M') | |
for k ,v in sorted(a.items(),cmp=lambda x,y:cmp(int(x),int(y)),key= lambda a:a[0],reverse=True): |
This file contains hidden or 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
from docutils.core import publish_parts | |
source = u""" | |
======= | |
test | |
======= | |
aaa | |
* aaa | |
* bbb |
This file contains hidden or 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
from docutils import nodes | |
from docutils.parsers.rst import directives | |
from pygments import highlight | |
from pygments.lexers import get_lexer_by_name | |
from pygments.formatters import HtmlFormatter | |
pygments_formatter = HtmlFormatter() | |
def pygments_directive(name, arguments, options, content, lineno, |
This file contains hidden or 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
from flask import Flask, render_template | |
from pygments import highlight | |
from pygments.lexers import get_lexer_by_name | |
from pygments.formatters import HtmlFormatter | |
app = Flask(__name__) | |
# jinja2 custom filter | |
@app.template_filter() |
This file contains hidden or 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
#!/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require 'socket' | |
class IPMsg | |
IPMSG_VERSION = 0x0001 | |
IPMSG_SENDMSG_CODE = 0x00000020 | |
IPMSG_PORT = 2425 |
This file contains hidden or 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 sys | |
if len(sys.argv) > 1: | |
expression = sys.argv[1] | |
expression = expression.replace("x","*") | |
print( eval(expression) ) |
This file contains hidden or 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
var array = []; | |
var l = 100000; | |
for(var i = 0; i < l; i++) { | |
array.push(i); | |
} | |
// Pattern A | |
console.time("for文で毎回array.lengthを呼ぶ"); | |
var count=0; | |
for(var i = 0; i< array.length; i++) { |
This file contains hidden or 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 socket | |
from multiprocessing import Pool,Process | |
def get(url): | |
job =socket.gethostbyname(url) | |
return job | |
if __name__ == '__main__': | |
urls= ['www.google.com', 'www.yahoo.com', 'www.python.org'] |
This file contains hidden or 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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
#テスト | |
import multiprocessing | |
import urllib2 | |
from pyquery import PyQuery as pq | |
''' | |
import sys,codecs | |
sys.stdout = codecs.getwriter('utf-8')(sys.stdout) |