Skip to content

Instantly share code, notes, and snippets.

var BitmapData = (function() {
function BitmapData(width, height) {
this.width = width;
this.height = height;
this.canvas = document.createElement('canvas');
this.canvas.setAttribute('width', this.width + 'px');
this.canvas.setAttribute('height', this.height + 'px');
{
houses: [
{
name: "なんとかライブハウス",
lat: 11.111,
lng: 99.999,
landmarks: [
{
name: "なんとか交差点",
0.1 : 25
0.2 : 33
0.3 : 4C
0.4 : 66
0.5 : 7F
0.6 : 99
0.7 : B2
0.8 : CC
0.9 : E5
html, body {
width: 100%;
height: 100%;
min-height: 100%;
margin: 0;
padding: 0;
background: #333;
}
#workspace {
@foo9
foo9 / gist:7152506
Last active December 26, 2015 12:39
$(function () {
var $win = $(window);
var $doc = $(document);
var $body = $('body');
var winWidth = $win.width();
var winHeight = $win.height();
var $vertical = $('<div/>').css({
position: 'absolute',
top: 0,
left: winWidth * 0.5,
body {
background: #ccc;
}
@foo9
foo9 / backbone-shape.js
Last active December 25, 2015 02:39
Backbone.js & svg.js
Backbone.Shape = {};
Backbone.Shape.Rect = Backbone.View.extend({
className: 'shape rect',
isClosed: false,
paper: null,
shape: null,
@foo9
foo9 / gist:6724770
Created September 27, 2013 06:20
Ctrl + s
$(document).on('keydown', function(event) {
if ((event.which == 115 || event.which == 83) && (event.ctrlKey || event.metaKey) || (event.which == 19)) {
event.preventDefault();
// do something
return false;
}
return true;
});
@foo9
foo9 / gist:6590945
Last active December 23, 2015 05:59
contenteditableを使って簡単にドキュメントを翻訳できる仕組みを作りたい。
(function() {
var map = {};
var elems = document.querySelectorAll('h1, h2, h3, h4, h5, h6, h7, p, li, dt, dd');
var cid;
var text;
for (var i = 0, iz = elems.length; i < iz; i++) {
cid = 'c' + i;
elems[i].setAttribute('contenteditable', 'true');
elems[i].setAttribute('data-cid', cid);
@foo9
foo9 / gist:6304230
Created August 22, 2013 07:45
Copy POSIX Path to Clipboard
to joinList(aList, delimiter)
set retVal to ""
set prevDelimiter to AppleScript's text item delimiters
set AppleScript's text item delimiters to delimiter
set retVal to aList as string
set AppleScript's text item delimiters to prevDelimiter
return retVal
end joinList
on run {input, parameters}