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 | |
$len = 5; | |
$jsonArray = array(); | |
$bodyStr = "。"; | |
for($i = 0; $i < 10; $i++){ | |
$bodyStr = "仲村みう".$bodyStr; | |
} | |
for($i = 1, $l = $len + 1; $i < $l; $i++){ |
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 wrapElement(targetElm, wrapperElm) { | |
wrapperElm.appendChild(targetElm.cloneNode(true)); | |
targetElm.parentNode.replaceChild(wrapperElm, targetElm); | |
} |
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
挿入先要素の親要素の指定を自動化。 | |
### usage ### | |
[html] | |
<div><div id="target">target</div></div> | |
[js] | |
var doc = document, elm = doc.createElement("div"), targetElm = doc.getElementById("target"); | |
elm.appendChild(doc.createTextNode("insert !")); |
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
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller | |
// fixes from Paul Irish and Tino Zijdel | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; | |
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) { |
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
if(typeof getComputedStyle === "undefined") { | |
var getComputedStyle = function(targetElm){ | |
return document.defaultView.getComputedStyle(targetElm, "") || targetElm.currentStyle; | |
}; | |
} |
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
if (typeof getRandomColor === "undefined") { | |
var getRandomColor = function(type) { | |
var _c; | |
if (type) type = type.toUpperCase(); | |
switch (type) { | |
case "RGB": | |
_c = "rgb(" + (Math.random() * 256 | 0) + ", " + (Math.random() * 256 | 0) + ", " + (Math.random() * 256 | 0) + ")"; | |
break; |
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 audioElementSupported = (function(d) { | |
var a = d.createElement("audio"), | |
o = {}, | |
s = "audio\/"; | |
if (typeof a.canPlayType === "function") { | |
o.supported = Boolean(true); | |
o.mp3 = a.canPlayType(s + "mpeg"); | |
o.wav = a.canPlayType(s + 'wav; codecs="1"'); | |
o.ogg = a.canPlayType(s + 'ogg; codecs="vorbis"'); |
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 _t = "[\x09-\x0D\x20\xA0\x85\u1680\u180E\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]+", | |
_l = new RegExp("^" + _t), | |
_r = new RegExp(_t + "$"), | |
SP = String.prototype; | |
SP.trimLeft = function() { return this.replace(_l, ""); }; | |
SP.trimRight = function() { return this.replace(_r, ""); }; | |
SP.trim = function() { return this.trimLeft().trimRight(); }; | |
})(); |
NewerOlder