This file contains 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 script = document.createElement("script"); | |
script.setAttribute("type", "application/javascript"); | |
script.setAttribute("src", /* 動的に生成したAPIのURL */); | |
document.getElementById("twitterApiScript").appendChild(script); |
This file contains 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 xhr = new XMLHttpRequest(); | |
xhr.open('GET', /* 動的に生成したAPIのURL */, true); | |
xhr.responseType = 'json'; | |
xhr.onload = function(e) { | |
/** | |
* Callback | |
* e.target.response.statuses にTweets情報が格納されている | |
*/ | |
} | |
xhr.send(); |
This file contains 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
/** | |
* ChromeアプリからTwitter search APIを呼ぶための関数 | |
* Use: oauth.js, sha1.js | |
*/ | |
function searchTweets(query) { | |
var secretKeys = { | |
consumerSecret: /* Consumer secret */, | |
tokenSecret: /* Access token secret */ | |
}; |
This file contains 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
# -*- encoding: utf-8 -*- | |
# ソート詰め合わせパック | |
# * バブルソート(単純交換ソート) | |
# * 単純選択ソート | |
# * シャトルソート(単純挿入ソート) | |
# * シェルソート | |
# * クイックソート | |
# * ヒープソート | |
# Copyright 2015 daiz. All Rights Reserved. |
This file contains 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
/* Copyright 2015 daiz, app Ui design project. */ | |
function getFlexibleWidth(column, margins, stage_width, min_width, max_width) { | |
/** | |
column: 標準カラム指定 | |
margins: margin-left, margin-right を要素に持つ配列 | |
stage_width: 表示領域の横幅 | |
min_width: multi column の場合のcolumn横幅の最小値 | |
この値より小さい横幅になる場合はカラムを減らす | |
max_width: multi column の場合のcolumn横幅の最大値 | |
この値より大きい横幅になる場合はカラムを増やす |
This file contains 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
# -*- encoding: utf-8 -*- | |
import urllib | |
from bs4 import BeautifulSoup | |
def main(): | |
# URL を指定するとそのファイルを開けるっぽい | |
my_page = 'http://daiz-projects.appspot.com/hoge/bar.html' | |
f = urllib.urlopen(my_page) | |
# f の型は一体何なのか調べてみる | |
print type(f) #=> <type 'instance'> |
This file contains 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
String.prototype.format = function() { | |
var str = this.toString(); | |
var args = arguments; | |
// {} の個数を確認 | |
var len_blanks = (str.match(/\{\}/g) || []).length; | |
// 引数の個数を確認 | |
var len_args = args.length; | |
// 個数が一致しない場合は文字列をそのまま返す | |
if(len_args != len_blanks) return str; | |
// 個数が一致していれば置換作業を行う |
This file contains 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/sh | |
PORT=8000 | |
if [ $# == 1 ]; then | |
PORT=$1 | |
fi | |
python -m SimpleHTTPServer $PORT | |
exit 0 |
This file contains 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/python | |
# -*- coding: utf-8 -*- | |
# Copyright (c) 2015 daiz | |
# Options: | |
# s: シークレットモードで起動 | |
# run: 開発中のアプリを読み込む | |
# Usage: $ chrome run /path/to/app/ |
This file contains 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
<!doctype html> | |
<html> | |
<head> | |
<title>Sample</title> | |
<style> | |
#c0, #c1, #c2, #c3 { | |
height: 100px; | |
width: 100px; | |
background-color: #ccc; | |
} |
OlderNewer