Skip to content

Instantly share code, notes, and snippets.

@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;
}
@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 / 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 / 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:5362367
Last active December 16, 2015 02:28
背景いっぱいにドット
$(function () {
var dotSize = 3;
var dotColor = "#abc";
var canvas = $("<canvas/>").attr({
width: dotSize * 2,
height: dotSize * 2
})[0];
var ctx = canvas.getContext('2d');
ctx.fillStyle = dotColor;
ctx.beginPath();
@foo9
foo9 / gist:5360249
Last active December 16, 2015 02:09
// how to use $("#hoge").visible(function () { console.log("(<●>д<●>)", this); }, function () { console.log("( ― д ― )", this); });
// uncompress
;(function ($) {
$.fn.visible = function (visible, invisible) {
if ((typeof visible !== "function") && (typeof invisible !== "function")) {
return this;
}
return this.each(function () {
if ($(this).css('display') === 'none') {
invisible.apply(this);
@foo9
foo9 / gist:5336802
Last active December 15, 2015 22:59
remove forcus dotted outline (for firefox)
var selectElems = document.getElementsByTagName("select");
for (var i = 0, iz = selectElems.length; i < iz; i++) {
selectElems[i].onfocus = selectElems[i].blur;
}
@foo9
foo9 / gist:5333658
Last active December 15, 2015 22:29
simple checkbox css (webkit only)
<form>
<input type="checkbox" checked="checked" />
<input type="checkbox" />
</form>
@foo9
foo9 / gist:5230897
Last active December 15, 2015 08:29
var elementId = "testCanvas";
var stageWidth = 300;
var stageHeight = 300;
var backgroundColor = "#abc";
var stage;
function init() {
var canvas = document.getElementById(elementId);
canvas.style.width = stageWidth + "px";
@foo9
foo9 / jquery.simpletab.min.js
Created March 22, 2013 15:51
minimum tab jquery plugin (577 bytes)
;(function(a){a.fn.simpletab=function(){return this.each(function(){for(var b,c,d,e,f=a(this).find("a"),g=0,h=f.length;h>g;g++)c=a(f[g]),d=c.attr("href"),d=a(d),d.hide().bind("stactive stinactive",function(b,c){e=a(this),c=="#"+e.attr("id")&&("stactive"==b.type?e.show():e.hide())}),c.hasClass("active")&&d.show();f.click(function(){if(e=a(this),!e.hasClass("active")){a.event.trigger("stactive",[e.attr("href")]);for(var d=0,g=f.length;g>d;d++)b=f[d],c=a(b),b!=this?(c.removeClass("active"),a.event.trigger("stinactive",[c.attr("href")])):c.addClass("active")}})})}})(jQuery);