Skip to content

Instantly share code, notes, and snippets.

View shinnn's full-sized avatar
🍉

shinnn shinnn

🍉
View GitHub Profile
@shinnn
shinnn / loadjquery.php
Last active October 8, 2015 07:38
Loading CDN-hosted jQuery with triple fallbacks in PHP
<?php
// ref: http://www.php.net/manual/ja/function.file-exists.php#79118
function getResource(){
$args_last_key = func_num_args() - 1;
$resource_urls = array_slice(func_get_args(), 0, $args_last_key);
// The last argument is a local file path.
$local_fallback = func_get_arg($args_last_key);
'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 August 29, 2015 14:03
ファイル削除にはgulpプラグインを使わない ref: http://qiita.com/shinnn/items/bd7ad79526eff37cebd0
var rimraf = require('rimraf');
gulp.task('clean', function (cb) {
rimraf('./dir', cb);
});
gulp.task('build', ['clean'], function() {
// Something
});
(function() {
'use strict';
function arrayWriteOut(arr, process) {
if (!process) {
process = function(str) {
return str;
};
}