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 ($) { | |
$(function () { | |
// jQuery の要素集合をキャッシュ | |
var $slider_root = $('#slider'), | |
$slider_ul = $slider_root.find('ul'), | |
$slider_li = $slider_ul.find('li'), | |
sliderWidth = $slider_li.outerWidth(true) * $slider_li.size(), | |
viewWidth = 800; |
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 addEvent(element, type, handler, data, context) { | |
if (!element) { return false; } | |
if (!handler) { return false; } | |
context = context || element; | |
var fn = function (e) { | |
e = e || win.event; |
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 collection = Backbone.Collection.extend({ | |
originalSync: Backbone.sync, | |
sync: function(method, model, options) { | |
var originalSuccess, cache; | |
if (method !== 'read') { | |
this.originalSync(method, model, options); |
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 flattenHeight(elements) { | |
var maxHeight, i, l, defaultView; | |
maxHeight = 0; | |
i = 0; | |
l = elements.length; | |
defaultView = document.defaultView || {}; | |
if (defaultView.getComputedStyle) { |
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
Array.apply(null, Array(100)).forEach(function(x, i) { | |
console.log(i + 1); | |
}); |
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 lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<!-- このスタイルは文書ツリー側に定義したものなので Shadow DOM 内部には適用されない。 --> | |
<style> | |
section.articleBox h1 { | |
color: black; | |
} |
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 password = [].reduce.call('AaBbCcDdEeFfGgHhiJjKkLMmNnPpQqRrSsTtWwXxYyz3456789', function(p, c, i, a) { | |
return p += a.replace(new RegExp(p.split('').join('|'), 'g'), '')[Math.floor(Math.random() * (a.length - p.length))]; | |
}, '').substr(0, 16); | |
console.log(password); |
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
do | |
<-! $ | |
initializeApp! | |
data <-! $.get 'ajaxtest' | |
$ \.result .html data | |
processed <-! $.get 'ajaxprocess', data | |
$ \.result .append processed |
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
require 'net/http' | |
require 'rexml/document' | |
class Palette | |
attr_accessor :name, :url, :colors | |
def initialize(id) | |
@name = String.new | |
@url = String.new | |
@colors = Array.new |
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
domParse = function(htmlString) { | |
var doc; | |
doc = document.implementation.createHTMLDocument(''); | |
doc.body.innerHTML = htmlString; | |
return doc.body.firstChild; | |
}; |