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
<?php | |
/* DPZラジオ 長編をpodcastで聞く */ | |
$dprfeed = file_get_contents( "http://podfeedsp.podcastjuice.jp/app/rss_convert.cgi?url=http%3A%2F%2Fdpz%2Ecocolog%2Dnifty%2Ecom%2Fdpr%2F" ); | |
if($dprfeed){ | |
$dprfeed = preg_replace('|<enclosure url="http://portal\.nifty\.com/[0-9]*/[0-9]*/[0-9]*/[a-z]/[0-9]*.mp3" length="[0-9]*" type="audio/mpeg" />|', "", $dprfeed); | |
$dprfeed = preg_replace('|<title>デイリーポータルZラジオ</title>|', "<title>デイリーポータルZラジオ(長編)</title>", $dprfeed); | |
print($dprfeed); | |
}else{ | |
header('HTTP/1.0 500 Internal Server Error'); |
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
# -*- coding: utf-8 -*- | |
# 文字列型にマルチバイト文字を入れる(この場合はソースコードの文字コードのutf-8のはず) | |
string = 'あいう' | |
# 文字列をutf-8とみなしてユニコード文字列に変換する | |
unicode_string = string.decode('utf-8') | |
# 文字列をそのまま出力する | |
print string |
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
# -*- coding: utf-8 -*- | |
class Foo(object): | |
def method_1(self): | |
print self | |
@classmethod | |
def classmethod_1(cls): | |
print cls | |
@staticmethod | |
def staticmethod_1(): |
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
# -*- coding: utf-8 -*- | |
from cgi import parse_qs | |
from urllib import urlencode | |
import oauth2 | |
OAUTH_REQUEST_TOKEN_URL = 'http://www.plurk.com/OAuth/request_token' | |
OAUTH_ACCESS_TOKEN_URL = 'http://www.plurk.com/OAuth/access_token' |
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
display dialog "url" default answer "" | |
set clipurl to text returned of result | |
tell application "Evernote" | |
create note from url clipurl notebook "clip" | |
end tell |
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 asyncore | |
import socket | |
class EchoHandler(asyncore.dispatcher): | |
def __init__(self, sock): | |
asyncore.dispatcher.__init__(self, sock=sock) | |
self.send('welcome') | |
return |
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
class Foo(): | |
message = "I'm Foo class" | |
def method(self, foo): | |
self.foo = foo | |
print self.message | |
@classmethod | |
def class_method(cls, foo): | |
cls.foo = foo |
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
# -*- coding: utf-8 -*- | |
import sys, csv, StringIO | |
import tweepy | |
def get_followers(api, screen_name): | |
followers_count = api.get_user(screen_name = screen_name).followers_count | |
cursor = tweepy.Cursor(api.followers, screen_name = screen_name) | |
followers = cursor.items() |
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
# 引数もリストで渡す | |
# 一行で | |
Popen(['ls','-l'],stdout=PIPE).stdout.read() | |
# 一行毎に | |
p = Popen(['ls','-l'],stdout=PIPE) | |
for line in p.stdout.read(): | |
print line | |
# popen2は書いたまま |
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
# -*- coding: utf-8 -*- | |
import csv | |
import StringIO | |
s = StringIO.StringIO() | |
csv_writer = csv.writer(s) | |
list = [ | |
{'name': 'item1', 'value': 'foo string'}, | |
{'name': 'item2', 'value': 'bar "quoted" string'}, |
OlderNewer