Skip to content

Instantly share code, notes, and snippets.

@foo9
foo9 / gist:5442202
Created April 23, 2013 09:40
スマホ用 疑似ホバー
// スマホ用 疑似ホバー
$('a, input[type="button"], input[type="submit"], button').on('touchstart', function() {
$(this).addClass('hover');
}).on('touchend', function() {
$(this).removeClass('hover');
});
@foo9
foo9 / gist:5457102
Created April 25, 2013 02:32
.vimrc
execute pathogen#infect()
syntax on
filetype plugin indent on
autocmd vimenter * NERDTree
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif
set nocompatible
set fileformats=unix,dos,mac
set title
@foo9
foo9 / demo.haml
Created April 25, 2013 06:26
tooltip for createjs
!!! 5
%html
%head
%meta(charset="utf-8")
%title="demo"
%script(src="http://code.createjs.com/createjs-2013.02.12.min.js")
%script(src="foo9.createjs.tooltip.js")
:css
canvas {
background: #abc;
@foo9
foo9 / demo.js
Last active December 16, 2015 15:49
foo9.createjs.label.js
var canvas = document.getElementById("testCanvas");
var stage = new createjs.Stage(canvas);
var letters = ["test", "日本語", "abcカタカナ", "1234567890"];
for (var i = 0, iz = letters.length; i < iz; i++) {
var label = new foo9.createjs.Label(letters[i], "12px Arial", "#000", "#fff");
stage.addChild(label);
label.y = 20 * i;
}
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title></title>
</head>
<body>
<h1>test</h1>
</body>
</html>
@foo9
foo9 / ShuffleEaselText.js
Created April 29, 2013 23:11
ShuffleEaselText.jsをeaseljs0.6に対応
/*
* ShuffleText by Yasunobu Ikeda. Feb 3, 2012
* Visit http://clockmaker.jp/ for documentation, updates and examples.
*
*
* Copyright (c) 2012 Yasunobu Ikeda
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
@foo9
foo9 / gist:5486617
Last active December 16, 2015 19:39
easeljsでスワイプ
var FPS = 60;
var canvas = document.getElementById("testCanvas");
var stage = new createjs.Stage(canvas);
if (createjs.Touch.isSupported()) {
createjs.Touch.enable(stage, false, false);
}
createjs.Ticker.setFPS(FPS);
createjs.Ticker.addEventListener("tick", handleTick);
class StyleSheet
constructor: () ->
@cssRule = null
parseCSS: (CSSText) ->
parser = new CSSParser()
@cssRule = parser.parse CSSText
return
# TODO:
var array = ['a', 'b', 'c', 'd', 'e', 'f', 'g'];
var size = 2;
var result = chunk(array, size);
// console.log(result); // [['a', 'b'], ['c', 'd'], ['e', 'f'], ['g']]
function chunk(array, size) {
var len = array.length;
var index = 0;
var result = [];
var canvas, doAnim, endPoint, getPoint, line, stage, startPoint, t;
function getPoint(p1, p2, t) {
var x, x1, x2, y, y1, y2;
x1 = p1.x;
y1 = p1.y;
x2 = p2.x;
y2 = p2.y;
x = (x2 - x1) * t + x1;