Skip to content

Instantly share code, notes, and snippets.

@ques0942
ques0942 / load_mtg_jp.py
Last active May 5, 2016 12:40
Magic the Gathering日本語公式サイトから記事一覧を引っこ抜くスクリプト
import json
import requests
from bs4 import BeautifulSoup
def load_mtg_jp():
url = 'http://mtg-jp.com/topics.html'
r = requests.get(url)
# GAEに持ち込むと文字コードが一致しないケースがあったため対応
if r.encoding != r.apparent_encoding:
r.encoding = r.apparent_encoding
@ques0942
ques0942 / file0.py
Created March 18, 2016 17:41
Pythonでズンドコキヨシ(ジェネレータ) ref: http://qiita.com/ques0942/items/b3762287d8962d489bbf
# -*- coding: utf-8 -*-
from collections import deque
import random
z = u'ズン'
d = u'ドコ'
zzzzd = (z, z, z, z, d, )
kys = u'キ・ヨ・シ!'
@ques0942
ques0942 / file0.txt
Created February 14, 2016 10:48
Ubuntuを12.04 -> 14.04にしたらvirtualenv利用中に「import io」できなくなった ref: http://qiita.com/ques0942/items/073393b7585b13438dff
$ python -c "import io"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/lib/python2.7/io.py", line 51, in <module>
import _io
ImportError: No module named _io
# coding: utf-8
from types import MethodType
class Sample(object):
"""
一度実行するとメソッドの中身が変更される
"""
def method(self, value):
"""
@ques0942
ques0942 / file0.txt
Last active September 26, 2015 14:05
rvmからrbenvへの切り替えでつまづいた話 ref: http://qiita.com/ques0942/items/f35715c638fa47bb383e
common.rb:67: [BUG] Segmentation fault
@ques0942
ques0942 / file0.js
Created September 5, 2015 07:32
Browserify + gulpではまったのでメモ ref: http://qiita.com/ques0942/items/ad9428661e385fddb257
gulp.task('browserify', function(){
var browserify = require('browserify');
browserify('<元になるファイル>', {<option>})
.bundle()
.pipe(gulp.dest('<出力先ディレクトリ>'));
});
@ques0942
ques0942 / file0.txt
Created May 4, 2015 10:24
Chocolateyで使用するNuGetのバージョンが古くなった場合の対処法 ref: http://qiita.com/ques0942/items/fbebbbae190469585ca4
The schema version of 'Microsoft.AspNet.Mvc' is incompatible with version
@ques0942
ques0942 / file0.js
Created April 18, 2015 06:24
node.js初心者のPromiseサンプル ref: http://qiita.com/ques0942/items/e31134ec3245640bbd55
//
//Promiseの練習用
//
// Promise1つだけのケース
// 引数をそのまま次のfunctionに渡すだけ
var return_number = function(num){
return new Promise(function(onFulfilled, onRejected){
onFulfilled(num);
});
@ques0942
ques0942 / file0.txt
Last active August 29, 2015 14:19
ndenvで作った環境下でnpm install -gでインストールしたコマンドが見つからずに死にかける ref: http://qiita.com/ques0942/items/9861a10647d200cbc6b9
npm install -g jshint
@ques0942
ques0942 / file0.txt
Last active August 29, 2015 14:12
CentOS 6.5 + pyenv + pytest + git + jenkinsでCI環境を作成するまで ref: http://qiita.com/ques0942/items/9e0a9db84fd071ead61c
python runtest.py --junitxml=<テスト結果を出力するファイル名> --cov-report xml --cov <テスト対象>