Skip to content

Instantly share code, notes, and snippets.

View Olegas's full-sized avatar

Oleg Elifantiev Olegas

  • Russia, Yaroslavl
View GitHub Profile
@Olegas
Olegas / gist:9817229
Last active August 29, 2015 13:57
Monitor current focused element
var current = null;
$('<div />', {
html: '<style>@-webkit-keyframes changeopacity { from { opacity: 1 } to { opacity: 0.2 } }\
.indicate { -webkit-animation-duration: 0.25s; -webkit-animation-name: changeopacity; -webkit-animation-iteration-count: infinite; -webkit-animation-direction: alternate; }\
.focus-mark-container { outline: 1px dotted red; }\
.focus-target-log { position: absolute; left: 0; top: 30px; background: blue; color: white; z-index: 20000 }\
.tabindex-indicator { z-index: 100000; opacity: 0.3; position: absolute; left: 0; top: 0; background: blue; color: white }\
.tabindex-indicator-current { background: red; }\
</style>'
@Olegas
Olegas / gitlab-teamcity-integration
Created November 4, 2014 20:34
Custom script to integrate GitLab with TeamCity 8+
// Configuration. GitLab API key, API url
var CIParams = {
gitlabKey: 'YOURSECREKAPIKEY',
gitlabApiUrl: 'https://gitlab/api/v3/',
tcApiUrl: '/guestAuth/app/rest/',
tcProtocol: 'https://'
},
cachedData = {
currentProject: {id: -1},
currentMergeRequest: {id: -1}
@Olegas
Olegas / autodoc.js
Last active August 29, 2015 14:09
How code style affects code review
{
/**
* Получить контрол по идентификатору.
* @param {String} id Идентификатор искомого контрола.
* @return {$ws.proto.Control} Найденный контрол.
* @deprecated Используйте $ws.proto.AreaAbstract.getChildControlByName
*/
get : function(id){
if (this._storage[id] === undefined)
throw new Error("ControlStorage : id = '" + id + "' not stored");
@Olegas
Olegas / bad.js
Created November 11, 2014 20:50
How code style affects code review
this.doWork({ amount: 6, unit: "hour" });
@Olegas
Olegas / 0-Description.md
Last active August 29, 2015 14:16
Read file stream line by line using generators
@Olegas
Olegas / Description.md
Last active August 29, 2015 14:22
Race condition in cluster RR scheduling

Starting from createServer: https://github.com/nodejs/io.js/blob/master/lib/net.js#L884

Adding subscription to ‘connection’ event: https://github.com/nodejs/io.js/blob/master/lib/net.js#L1066

When listen is called, we are going here: https://github.com/nodejs/io.js/blob/master/lib/net.js#L1353

Cause’ we are worker, we’ll request a server: https://github.com/nodejs/io.js/blob/master/lib/net.js#L1254

_getServer is sending a message to master https://github.com/nodejs/io.js/blob/master/lib/cluster.js#L542

@Olegas
Olegas / amd.js
Created July 9, 2015 10:42 — forked from ipoddubny/amd.js
define(['cjs'], function (cjs) {
console.log('amd module loaded');
console.log('cjs exported:', cjs);
return 'AMD';
});
@Olegas
Olegas / actions.js
Last active September 29, 2015 20:03
A story about pet store or Yet another stupid redux application
import decreaseFoodAction from 'FoodStoreActions';
import validationErrorAction from 'ValidationErrors';
function feedAnimalAction(animalName, amount) {
var animal = getAnimalByName(animalName);
// no write access here
var foodStore = State.get('store');
var preferredFood = Animal.getRequiredFoodType(animal);
if (Animal.isHungry(animal)) {
if (Store.hasSufficientFood(foodStore, preferredFood, amount)) {
@Olegas
Olegas / post-update
Created December 10, 2012 07:21 — forked from dchest/post-update
Git post-update hook to checkout working copy and publish it with jekyll (put it into .git/hooks and chmod +x post-update)
#!/bin/sh
#
# This hook does two things:
#
# 1. update the "info" files that allow the list of references to be
# queries over dumb transports such as http
#
# 2. if this repository looks like it is a non-bare repository, and
# the checked-out branch is pushed to, then update the working copy.
# This makes "push" function somewhat similarly to darcs and bzr.