Skip to content

Instantly share code, notes, and snippets.

@ginlime
ginlime / jquery.ui.jcarousellite.js
Created January 9, 2015 01:49
jQuery UI widget version of jCarouselLite
/*!
* jQuery UI jCarouselLite
*
* Copyright 2015, Startia Lab
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* Ported from jCarouselLite v1.1 to UI widget
* http://www.gmarwaha.com/jquery/jcarousellite/
*
@ginlime
ginlime / gist:dfc6cbc17c46782ce22b
Last active August 29, 2015 14:17
jQuery で使う easing を cubic bezier で追加する
// jQuery easing に ease を追加
$.extend( $.easing,
{
ease: function(x, t, b, c, d){
var easing = BezierEasing.css.ease;
return easing(t/d);
}
});
// jQuery easing に超適当に作った cubic bezier を tekitou という名前で追加
@ginlime
ginlime / jQuery.footerFixed.js
Created October 30, 2015 02:36
jQuery version of footerFixed.js
/*--------------------------------------------------------------------------*
*
* jQuery.footerFixed.js
*
* MIT-style license.
*
* ported by @ginlime
* https://gist.github.com/ginlime
*
* original written by:
var hoge = '';
$(selector).on(event,function(){
$.ajax({
async:false,
success:function(){
hoge='1';
}
});
if(hoge=='1'){
fuga();
@ginlime
ginlime / JSONPlus による JSON の自己参照.md
Last active February 16, 2017 07:59
JSON の自己参照は楽だ。

JSONPlus による JSON の自己参照

JSONPlus

普通に自己参照を使えばいいんだけど、多用すると「@self」まみれでプロパティ参照が長くなって可読性がちょっと落ちるんじゃないかなーということで、JSONPlus の resolve を使う方法。

前提

  • Gulp でとりあえず動作させる
  • JSONPlus を使うので JSON5 としてコメント書いてる

gulpfile.js

@ginlime
ginlime / spritesmith_template_less.txt
Created December 21, 2017 07:35
LESS template for spritesmith with Retina/responsive support / spritesmith 用 Retina/レスポンシブ対応 LESS テンプレート
{{#block "sprites"}}
{{#each sprites}}
@{{strings.name_name}}: '{{name}}';
@{{strings.name_x}}: {{px.x}};
@{{strings.name_y}}: {{px.y}};
@{{strings.name_offset_x}}: {{px.offset_x}};
@{{strings.name_offset_y}}: {{px.offset_y}};
@{{strings.name_width}}: {{px.width}};
@{{strings.name_height}}: {{px.height}};
@{{strings.name_total_width}}: {{px.total_width}};
@ginlime
ginlime / spritesmith_template_scss.txt
Created December 21, 2017 07:36
SCSS template for spritesmith with Retina/responsive support / spritesmith 用 Retina/レスポンシブ対応 SCSS テンプレート
{{#block "sprites"}}
{{#each sprites}}
${{strings.name_name}}: '{{name}}';
${{strings.name_x}}: {{px.x}};
${{strings.name_y}}: {{px.y}};
${{strings.name_offset_x}}: {{px.offset_x}};
${{strings.name_offset_y}}: {{px.offset_y}};
${{strings.name_width}}: {{px.width}};
${{strings.name_height}}: {{px.height}};
${{strings.name_total_width}}: {{px.total_width}};
@ginlime
ginlime / kansuji2arabic.js
Last active January 17, 2018 09:11
JavaScript で漢数字からアラビア数字に変換
// https://qiita.com/dosec/items/c6aef40fae6977fd89ab
// から移植+α
// とりあえず
// (文字列).kansuji2arabic(split3)
// で動作
(function(){
// 改良版 typeOf(のさらに改良)
// http://qiita.com/Hiraku/items/87e5d1cdaaa475c80cc2
var typeOf = function(x) {
@ginlime
ginlime / shorten.php
Created March 15, 2018 06:34
YOURLS の API を JavaScript から使う時に、API の ID/PW を隠すために噛ませる PHP
<?php
/*
パラメータ(両方とも必須にしている):
shorturl:短縮したい URL
title:yourls の画面に表示するタイトル
*/
$host = $_SERVER['HTTP_REFERER'];
$str = parse_url($host);
@ginlime
ginlime / vbac.wsf
Last active April 2, 2018 06:23
vbac.wsf で出力されるコードが Shift_JIS で エディタによっては面倒なので、nkf で UTF-8 に変換するようにしてみた(要 nkf)
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<package>
<comment>
The vbac is not VBA compiler.
Instead, this unsophisticated script frees VBA code from binary files.
This script is distributed as part of the Ariawase library.
The Project Page: https://github.com/vbaidiot/Ariawase
Modified by: twitter:@ginlime