Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexander Ulizko aulizko

  • Currently seeking a new opportunity
  • Cherepovets, Russian Federation
View GitHub Profile
@aulizko
aulizko / daily-geek-show-fix.js
Last active Sep 12, 2015
Внизу тэга head есть <script>, в котором старая функция play(). Вот вместо нее надо вставить это.
View daily-geek-show-fix.js
// Убираем старый обработчик нажатий
var forEach = Array.prototype.forEach;
forEach.call(document.getElementsByClassName('glyphicon-volume-up'),
removeAllEventListeners);
function play(e) {
if (!e) {
return;
}
var target = e.target;
@aulizko
aulizko / server.es6.js
Last active Sep 8, 2015
SSR with react-router@1.0.0-beta4
View server.es6.js
// That variant actually works with 1.0.0-beta4
// Link to the previous (1.0.0-beta3) version:
// https://github.com/cdebotton/react-universal/blob/master/src/server.js#L49
import createLocation from 'history/lib/createLocation';
import createHistory from 'history/lib/createMemoryHistory';
import ReactDOM from 'react-dom/server';
import {Router} from 'react-router';
import Layout from './views/Layout';
import Application from './containers/Application';
View keybase.md

Keybase proof

I hereby claim:

  • I am aulizko on github.
  • I am aulizko (https://keybase.io/aulizko) on keybase.
  • I have a public key whose fingerprint is 2B15 3E78 238C 4606 5A19 1E12 56F2 EB3D 1694 9CF9

To claim this, I am signing this object:

@aulizko
aulizko / gist:766247
Created Jan 5, 2011
Bookmarklet example (outdated)
View gist:766247
(function () {
var Dom = {
get : function (el) {
return (el && el.nodeType) ? el : document.getElementById(el);
},
addListener : function (el, type, fn) {
if (document.body.addEventListener) {
return function (el, type, fn) {
el.addEventListener(type, fn, false);
};
@aulizko
aulizko / gist:766135
Created Jan 5, 2011
PageFlow (outdated)
View gist:766135
/**
* Page Flow controller - load hash-specific data, show appropriate container and all that
* @Class PageFlow
*/
var PageFlow = function () {
/**
* show whole list of goods
* @method loadListOfGoods
* @private
*/
@aulizko
aulizko / gist:766134
Created Jan 5, 2011
History manager (outdated a while)
View gist:766134
/**
* History managment, for ajax-based pages
* @class History
* @constructor
*/
History = function () {
var
/**
* @property currentHash
* @private
@aulizko
aulizko / locale.rb
Created Dec 28, 2010
Exports $app/config/locale/$locale.yml contents to mongodb database
View locale.rb
# usage:
# bundle exec rake locale:file RAILS_ENV=production
# if you want to export a different locale (not en.yml), provide locale option, as follows:
# bundle exec rake locale:file RAILS_ENV=production locale=ru
require 'mongo-i18n'
def write_to_database(sc, path, value)
key = path.join('.')
sc[key] = value.to_json
@aulizko
aulizko / yaml_override.rb
Created Dec 20, 2010
Overrides content of the en.yml file with content of ru.yml. Unique entries for en.yml remains untouched.
View yaml_override.rb
require 'rubygems'
require 'yaml'
require 'ya2yaml'
$KCODE = 'u'
class Hash
def deep_stringify_keys
new_hash = {}
self.each do |key, value|
new_hash.merge!(key.to_s => (value.is_a?(Hash) ? value.deep_stringify_keys : value))
View stripFirebugConsoleAPICallsFromProductionCode.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="deploy" default="stripFirebugConsoleCalls" basedir=".">
<!-- место, где сложены наши еще не сжатые и не слитые в один js-скрипты -->
<property name="js" value="js/"/>
<!-- регулярка для отлова нездоровых элементов (беззастенчиво утянута с yui builder'a, и слегка доведена напильником)
http://github.com/yui/builder/blob/master/componentbuild/shared/properties.xml 79-я строка -->
<property name="firebug.console.regex" value="^.*?(?:console.log|console.dir).*?(?:;|\).*;|(?:\r?\n.*?)*?\).*;).*;?.*?\r?\n" />
<property name="firebug.console.regex.flags" value="mg" />
<property name="firebug.console.regex.byline" value="false" />
View .vimrc
" Nathan L Smith's .vimrc file. Based on
" John Lam's .vimrc file
" General options
set nocompatible
set autoread
filetype on
filetype indent on
filetype plugin on