Skip to content

Instantly share code, notes, and snippets.

View listochkin's full-sized avatar

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

View GitHub Profile
@listochkin
listochkin / gist:1200393
Created September 7, 2011 12:02
Algorithm for Area of a closed polygon.
@listochkin
listochkin / jquery.json-date-support.js
Created February 9, 2012 09:42
Date support for jQuery json and jsonp calls.
// 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 / 0 Private members in JavaScript.md
Created December 19, 2012 11:04
Private members in JavaScript

Private members in JavaScript

@listochkin
listochkin / thread-with-scheduling.java
Created February 8, 2013 10:09
Fancy way to create Java Thread
// 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 March 5, 2013 15:13
Dist version of Socket.IO-client
/*! Socket.IO.js build:0.9.11, development. Copyright(c) 2011 LearnBoost <[email protected]> MIT Licensed */
var io = ('undefined' === typeof module ? {} : module.exports);
(function() {
/**
* socket.io
* Copyright(c) 2011 LearnBoost <[email protected]>
* MIT Licensed
*/
@listochkin
listochkin / ember-data.js
Created March 28, 2013 19:49
Ember Data, API rev 12, build: 5fd6d65 (2013-03-28 01:13:50 +0100),
// 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 March 30, 2013 06:29
bootstrap-2.3.1.js in a single file
/* ===================================================
* 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 December 16, 2015 03:09
Forrest L Norvell describes Domains in Node
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 April 17, 2013 11:12
Node Cluster and Domains. Links.

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 April 22, 2013 12:15
jQuery 2.0 custom build: no sizzle, effects, and aliases, XHR-only Ajax
/*!
* 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