Skip to content

Instantly share code, notes, and snippets.

function Board(domEl, width, height, toWinCount) {
this.domEl = domEl;
this.width = width || 20;
this.height = height || 20;
this.toWinCount = toWinCount || 5;
this.board = undefined;
this.firstTurnTs = undefined;
this.turnsCount = undefined;
this.popupDomEl = this.domEl.querySelector('.popup');
}
.board {
border: 1px #000 solid;
width: 600px;
height: 600px;
}
.board .popup {
position: absolute;
opacity: 0.6;
background: #fff;
width: 600px;
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Tic-tac-toe</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="result"></div>
<div class="board">
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Title</title>
<link rel="stylesheet" type="text/css" href="https://www.gosuslugi.ru/widgets/css/player.min.css" />
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
// 1. from http://www.2ality.com/2012/12/javascript-puzzle-equal.html
// question:
x === y // true
1/x > 1/y // true
// solution:
x = y = { count: 1, valueOf: function () { return this.count++; }};
// 2.
@bazalev
bazalev / canvas.js
Last active December 22, 2015 12:19
/*
* Drag and Drop
*/
function DnD (element, settings) {
this.dragstartCallbacks = [];
this.dragCallbacks = [];
this.dragendCallbacks = [];
this.element = element;
this.settings = settings || {};
if (this.settings.dragstart) {
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<style>
body {
padding: 10px;
background: #000;
}
.guide {
var result =
data.reduce(function(soFar, next) {
return { total: soFar.total + next,
count: soFar.count + 1 };
},
{total: 0, count: 0 }
);
var mean = result.total / result.count;
///<reference path="../../DefinitelyTyped/underscore/underscore.d.ts" />
///<reference path="../../DefinitelyTyped/jquery/jquery.d.ts" />
import MapiRequest = require('../mapi/request.t');
import request_i = require("../mapi/request.i");
import mapi_i = require("../mapi.i");
import user_account_i = require('./user_account.i');
import IUserAccount = user_account_i.IUserAccount;
import IBalanceMapiResponse = user_account_i.IBalanceMapiResponse;
define(
[
'../page',
'template!templates/page/catalogue.mustache',
'src/widgets/catalogue',
'./catalogue/filter',
'underscore',
'stivi/models/catalogue_collection',
'config/app',
'src/popups/prompt'