Skip to content

Instantly share code, notes, and snippets.

View shinnn's full-sized avatar
🍉

shinnn shinnn

🍉
View GitHub Profile
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| {text: /^#{Regexp.quote(text)}$/}}.each.with_index(1) do |opt, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", opt.merge!(count: 1)
end
end
def assert_each_text(selector, array_of_text)
array_of_text.map{|text| {text: /^#{text}$/, count: 1}}.each.with_index(1) do |opts, i|
assert_selector "#{selector}:nth-of-type(#{i})#{i == array_of_text.size ? ':last-of-type' : ''}", opts
end
@shinnn
shinnn / file0.css
Created October 24, 2013 11:27
游明朝体・游ゴシック体のCSSでの利用 ref: http://qiita.com/shinnn/items/5be7e8106189311559c1
.sans-serif {
font-family: "游ゴシック体", "Yu Gothic", YuGothic, sans-serif;
}
@shinnn
shinnn / reserved.text
Created January 17, 2017 10:21
Github reserved usernames
admin
account
help
about
enterprise
join
new
shop
contact
training
@shinnn
shinnn / file0.txt
Created December 11, 2013 17:26
UglifyJSで、できるだけライセンスコメントを残して圧縮する ref: http://qiita.com/shinnn/items/57327006390f2181f550
var isLicenseComment = (function() {
// ライセンスコメントかどうか判定する正規表現
var licenseRegexp = /^\!|^@preserve|^@cc_on|\bMIT\b|\bMPL\b|\bGPL\b|\(c\)|License|Copyright/mi;
// 直前にライセンスコメントが現れた行を保存する内部変数
var _prevCommentLine = 0;
// 実際に`comment`オプションで実行されるのはこの関数
return function(node, comment) {
script(src='http://cdnjs.cloudflare.com/ajax/libs/knockout/3.0.0/knockout-min.js')
script.
window.ko || document.write("<script src='/js/knockout.js'><\/script>");
@shinnn
shinnn / example.html
Created July 29, 2013 15:11
Jadeで、jQueryの読み込みを丁寧かつ簡潔に書く ref: http://qiita.com/shinnn/items/d36468ca91ac35399f0b
<!--[if lt IE 9]>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<![endif]-->
<!--[if gte IE 9]><!-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<!--<![endif]-->
@shinnn
shinnn / loopvideo.coffee
Created July 20, 2013 15:39
video要素のループを滑らかにする ref: http://qiita.com/shinnn/items/83c2493ab3bbf49b1949
$ ->
video = document.getElementsByTagName('video')[0]
$video = null
rewind = (videoElm) ->
$(videoElm).one 'play', null, ->
videoElm.pause()
# この条件分岐が無いと DOM Exception 11 Error が発生
# TODO: 原因の発見
@shinnn
shinnn / loadjquery.jade
Created June 10, 2013 10:29
Loading CDN-hosted jQuery with triple fallbacks in Jade template Engine
mixin loadJQuery(version)
script(src='https://ajax.googleapis.com/ajax/libs/jquery/#{version}/jquery.min.js')
- var jQueryFallbacks = [];
- jQueryFallbacks[0] = 'http://code.jquery.com/jquery-' + version + '.min.js';
- jQueryFallbacks[1] = 'http://ajax.aspnetcdn.com/ajax/jQuery/jquery-' + version + '.min.js';
- jQueryFallbacks[2] = 'js/jquery' + (version.charAt(0) === '1'? '1': '') +'.js';
each url in jQueryFallbacks
script.
@shinnn
shinnn / quicklook.txt
Last active December 17, 2015 13:29
The list of Quick Look plugins currently I use
QuickLookJSON.qlgenerator
CC_QL.qlgenerator
QLStephen.qlgenerator
QLColorCode.qlgenerator
QLMarkdown.qlgenerator
ScriptQL.qlgenerator
DICOMQuickLook.qlgenerator
ProcessingQL.qlgenerator
Archive.qlgenerator
GBQLGenerator.qlgenerator
// Fork from Chromium's 'Bufferloader' class
// http://chromium.googlecode.com/svn/trunk/samples/audio/doc/loading-sounds.html
function BufferLoader(audioContext, urlList, callback){
this.context = audioContext;
this.urlList = urlList;
this.onload = callback;
this.bufferList = [];
this.loadCount = 0;
}