Skip to content

Instantly share code, notes, and snippets.

Avatar

Андрей Листочкин (Andrey Listochkin) listochkin

View GitHub Profile
@listochkin
listochkin / gist:1200393
Created Sep 7, 2011
Algorithm for Area of a closed polygon.
View gist:1200393

Re: Algorithm for Area of a closed polygon.

To: Ted Hill <thill@tomotherapy.com>
Subject: Re: Algorithm for Area of a closed polygon.
From: "Demian M. Nave" <dnave@psc.edu>
Date: Wed, 12 Nov 2003 21:23:16 -0500 (EST)
Cc: <compgeom-discuss@research.bell-labs.com>
In-reply-to: <1E2E66102E75104D8C740340EBCD98671BC279@tomoex.tomotherapy.com>
References: <1E2E66102E75104D8C740340EBCD98671BC279@tomoex.tomotherapy.com>
@listochkin
listochkin / jquery.json-date-support.js
Created Feb 9, 2012
Date support for jQuery json and jsonp calls.
View jquery.json-date-support.js
// Copyright (c) 2012 Andrey Listochkin
// This code is freely distributable under the MIT license:
// http://www.opensource.org/licenses/mit-license.php
// put this file after jQuery and before any $.ajax calls
(function($) {
if (!window.JSON) {
$.error( "No JSON available, add json2.js to your project from https://github.com/douglascrockford/JSON-js/blob/master/json2.js" );
}
@listochkin
listochkin / thread-with-scheduling.java
Created Feb 8, 2013
Fancy way to create Java Thread
View thread-with-scheduling.java
// Looks a bit scary but works wonders
ScheduledExecutorService ses = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
// Name your thread so you can later easily recognize it with a profiler
@Override
public Thread newThread(Runnable r) {
return new Thread(r, "Thread Name");
}
});
@listochkin
listochkin / socket.io-client.js
Created Mar 5, 2013
Dist version of Socket.IO-client
View socket.io-client.js
/*! Socket.IO.js build:0.9.11, development. Copyright(c) 2011 LearnBoost <dev@learnboost.com> MIT Licensed */
var io = ('undefined' === typeof module ? {} : module.exports);
(function() {
/**
* socket.io
* Copyright(c) 2011 LearnBoost <dev@learnboost.com>
* MIT Licensed
*/
@listochkin
listochkin / ember-data.js
Created Mar 28, 2013
Ember Data, API rev 12, build: 5fd6d65 (2013-03-28 01:13:50 +0100),
View ember-data.js
// Last commit: 5fd6d65 (2013-03-28 01:13:50 +0100)
(function() {
window.DS = Ember.Namespace.create({
// this one goes past 11
CURRENT_API_REVISION: 12
});
})();
@listochkin
listochkin / bootstrap-2.3.1.all.js
Created Mar 30, 2013
bootstrap-2.3.1.js in a single file
View bootstrap-2.3.1.all.js
/* ===================================================
* bootstrap-transition.js v2.3.1
* http://twitter.github.com/bootstrap/javascript.html#transitions
* ===================================================
* Copyright 2012 Twitter, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@listochkin
listochkin / domains.irc.log
Last active Dec 16, 2015
Forrest L Norvell describes Domains in Node
View domains.irc.log
02:15:46 (listochkin) how do I know if my current callback is running in a domain?
02:16:17 (Remy) listochkin: can you clarify ?
02:19:35 (listochkin) Remy: I mean, suppose I have a module A that does something potentially dangerous. I want to wrap a function in that module in a domain dA. Now suppose I require that module A from module B. And inside that module I've already created a domain dB. What I want is to use dB inside of A instead of creating an extra domain dA since my code is now protected by that external domain. Is it possible and is it a good idea?
02:25:24 (ChrisPartridge) listochkin: then don't put the domain in module A, just have it in module B
02:27:07 (listochkin) ChrisPartridge: what if A is my module and B is someone else's app?
02:33:48 (listochkin) Remy, ChrisPartridge: so, guys any ideas about my nested domains question?
02:33:51 (ChrisPartridge) listochkin: in that case I'm not too sure, I think domains should be used in the application context, not so much in every module - I could
@listochkin
listochkin / node-cluster-and-domains.md
Created Apr 17, 2013
Node Cluster and Domains. Links.
View node-cluster-and-domains.md

Cluster: helps running and coordinating several Node processes:

  1. [API][1].
  2. Module to get started easily: [cluster-master][2].

Domains: help keeping your Node process up and running by catching unhandled errors:

  1. [API][3].
  2. Read [the example code][4] to understand the basic workflow of domains.
  3. Module to get started easier: [domain-http-server][5].
@listochkin
listochkin / jquery-2.0.0.js
Created Apr 22, 2013
jQuery 2.0 custom build: no sizzle, effects, and aliases, XHR-only Ajax
View jquery-2.0.0.js
/*!
* jQuery JavaScript Library v2.0.0 -sizzle,-event-alias,-ajax/script,-ajax/jsonp,-effects,-deprecated
* http://jquery.com/
*
* Includes Sizzle.js
* http://sizzlejs.com/
*
* Copyright 2005, 2013 jQuery Foundation, Inc. and other contributors
* Released under the MIT license
* http://jquery.org/license