View labelclick.js
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 labelClick = function() { | |
var labels = document.getElementsByTagName('label'); | |
console.log(labels); | |
for(var i=0,len=labels.length; i<len; i++){ | |
if(labels[i].getAttribute('for')) { | |
labels[i].addEventListener('click',function(){ | |
var id = this.getAttribute('for'), | |
target = document.getElementById(id); | |
if(['radio','checkbox'].indexOf(target.getAttribute('type')) !== -1){ |
View sinatra_oauth.rb
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 | |
require 'rubygems' | |
require 'sinatra' | |
require 'erb' | |
require 'pp' | |
require 'twitter_oauth' | |
set :sessions, true |
View pjax.rb
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 | |
require 'rubygems' | |
require 'sinatra' | |
require 'erb' | |
require 'pp' | |
class Sinatra::Request | |
def pjax? | |
env['HTTP_X_PJAX'] || self['_pjax'] |
View check_device.js
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 iOS_hasRetinaDisplay() | |
{ | |
return window.devicePixelRatio > 1; | |
} | |
//UAでデバイスのチェック | |
function iOS_initPage() | |
{ | |
if(navigator.standalone) iOS_createWebappLinks(); | |
// iOS class |
View ga_shorten.js
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(d, t ,s) { | |
var js,ga = d.createElement(t); | |
ga.type = 'text/javascript'; ga.async = true; ga.src = '//' + s; | |
js = d.getElementsByTagName(t)[0]; js.parentNode.insertBefore(ga, js); | |
})(document, 'script', 'google-analytics.com/ga.js'); |
View photoshop-grid-script.js
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
// check for document | |
if(app.documents.length > 0){ | |
// get active document | |
var psDoc = app.activeDocument; | |
// get user input on column count | |
var colWidth = parseInt( prompt("Column size?", 5) ); | |
var docWidth = psDoc.width; | |
View Router_spec.js
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
describe("Routerは", function() { | |
beforeEach(function() { | |
this.router = App.Router(); | |
// routes { | |
// '' : 'index', | |
// 'login' : 'login' | |
// } |
View gist:2769620
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="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Backbone + sinon simple tests</title> | |
<script src="http://code.jquery.com/jquery-1.7.2.min.js" type="text/javascript"></script> | |
<script type="text/javascript" src='http://documentcloud.github.com/underscore/underscore-min.js'></script> | |
<script type="text/javascript" src='http://documentcloud.github.com/backbone/backbone.js'></script> | |
<script type="text/javascript" src='http://sinonjs.org/releases/sinon-1.3.4.js'></script> | |
<script src="https://raw.github.com/douglascrockford/JSON-js/master/json2.js" type="text/javascript"></script> |
View gist:2770136
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="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Backbone + sinon simple tests</title> | |
<script type="text/javascript" src='http://documentcloud.github.com/underscore/underscore-min.js'></script> | |
<script type="text/javascript" src='http://documentcloud.github.com/backbone/backbone.js'></script> | |
<script type="text/javascript" src='http://sinonjs.org/releases/sinon-1.3.4.js'></script> | |
<script type="text/javascript"> | |
View data-bind.html
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://ericbidelman.tumblr.com/post/23615290220/data-binding-using-data-attributes | |
--> | |
<style> | |
input[type="range"] { | |
vertical-align: middle; | |
margin: 2em; | |
font-size: 14px; | |
height: 20px; | |
} |
OlderNewer