Skip to content

Instantly share code, notes, and snippets.

Avatar
🍉

shinnn shinnn

🍉
View GitHub Profile
View all.rb
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 / reserved.text
Created Jan 17, 2017
Github reserved usernames
View reserved.text
admin
account
help
about
enterprise
join
new
shop
contact
training
View image-size-stream.js
'use strict';
var Transform = require('stream').Transform;
var imageSize = require('image-size');
const LIMIT = 128 * 1024;
class ImageSizeStream extends Transform {
constructor () {
super();
@shinnn
shinnn / file0.txt
Last active Aug 29, 2015
ファイル削除にはgulpプラグインを使わない ref: http://qiita.com/shinnn/items/bd7ad79526eff37cebd0
View file0.txt
var rimraf = require('rimraf');
gulp.task('clean', function (cb) {
rimraf('./dir', cb);
});
gulp.task('build', ['clean'], function() {
// Something
});
View array-write-out.js
(function() {
'use strict';
function arrayWriteOut(arr, process) {
if (!process) {
process = function(str) {
return str;
};
}
@shinnn
shinnn / file0.txt
Created Dec 11, 2013
UglifyJSで、できるだけライセンスコメントを残して圧縮する ref: http://qiita.com/shinnn/items/57327006390f2181f550
View file0.txt
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) {
@shinnn
shinnn / file0.css
Created Oct 24, 2013
游明朝体・游ゴシック体のCSSでの利用 ref: http://qiita.com/shinnn/items/5be7e8106189311559c1
View file0.css
.sans-serif {
font-family: "游ゴシック体", "Yu Gothic", YuGothic, sans-serif;
}
View knockout.jade
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 Jul 29, 2013
Jadeで、jQueryの読み込みを丁寧かつ簡潔に書く ref: http://qiita.com/shinnn/items/d36468ca91ac35399f0b
View example.html
<!--[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]-->
View loopvideo.coffee
$ ->
video = document.getElementsByTagName('video')[0]
$video = null
rewind = (videoElm) ->
$(videoElm).one 'play', null, ->
videoElm.pause()
# この条件分岐が無いと DOM Exception 11 Error が発生
# TODO: 原因の発見