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
from django.http import HttpResponse | |
from django.shortcuts import render_to_response | |
def helloworld(request): | |
return render_to_response('test.html', {'title': 'djangoTest!'}) |
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
<?php | |
function debugLog($label, $val) { | |
static $filename = 'logs/debug.log'; | |
$mtime = microtime(); | |
$timeStmp = explode(' ', $mtime); | |
$time = date('Y-m-d H:i:s', (int)$timeStmp[1]); | |
$mtime = number_format($mtime,5); | |
$val = var_export($val, true); |
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
<?php | |
App::uses('Helper', 'View'); | |
class AppHelper extends Helper { | |
/** | |
* CakeがHTMLを出力する際に生成される無駄なタブを削除する。 | |
* @see Helper::afterLayout() | |
*/ | |
public function afterLayout($layoutFile) { | |
parent::afterLayout($layoutFile); | |
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
;(function($) { | |
//最大文字数 | |
var OVER_LENGTH = 100; | |
//「続きを読む」リンクのクラス | |
var READ_MORE_CLASS = 'read-more'; | |
$.fn.readmore = function(option) { | |
if(option.length) { | |
OVER_LENGTH = option.length; | |
} | |
$.each(this, function() { |
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
<?php | |
App::uses('HtmlHelper', 'View/Helper'); | |
class MyHtmlHelper extends HtmlHelper { | |
/** | |
* microdata属性対応版 | |
* @link https://support.google.com/webmasters/answer/185417?hl=en | |
* @see HtmlHelper::getCrumbList() | |
*/ |
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
<?php | |
App::uses('Model', 'Model'); | |
class AppModel extends Model { | |
/** | |
* モデルの空配列を返します。 | |
* @return array モデルの空配列 | |
*/ | |
public function getModelArray() { | |
//カラムタイプの配列からキーのみを取得 | |
$keys = array_keys($this->getColumnTypes()); |
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
<?php | |
function bench() { | |
//計測回数 | |
$count = 10; | |
//試行回数 | |
$testCount = 100000; | |
//小数点桁数 | |
$decimalDigits = 10; | |
//平均値 | |
$average = 0.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
# -*- coding: cp932 -*- | |
import wx | |
class MyFrame(wx.Frame): | |
def __init__(self, parent, title): | |
wx.Frame.__init__(self, parent, title=title, size=(500,500),pos=(10,10)) | |
#ステータスバー | |
self.CreateStatusBar() | |
#ファイルメニュー | |
filemenu = wx.Menu() |
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 Spinner = function() { | |
/** | |
* ランダムでIDを生成する | |
*/ | |
this.id = 'spinner' + Math.floor(Math.random () * 10000) + 1; | |
}; | |
Spinner.prototype = { |
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
/** | |
* HTML5 WebSpeechAPI SpeechSynthesis | |
* @class Speech | |
*/ | |
var Speech = (function() { | |
// 存在チェック | |
if (!'SpeechSynthesisUtterance' in window) { | |
throw new Error('SpeechSynthesisAPI unsupported.'); | |
alert('SpeechSynthesisAPIが対応していないブラウザです。'); |
OlderNewer