Skip to content

Instantly share code, notes, and snippets.

View dmitry's full-sized avatar
🇪🇪
Water, earth and air.

Dmitry Polushkin dmitry

🇪🇪
Water, earth and air.
View GitHub Profile
@dmitry
dmitry / i18n-mapper.rb
Created July 7, 2015 17:06
Map i18n locales from one file to other and translate locales
require 'yaml'
require 'psych'
require 'active_support'
YAML::ENGINE.yamler = 'psych'
FLATTEN_SEPARATOR = '.'
LOCALES = %w(ru es de pt tr it fr)
def load_yaml(files)
@dmitry
dmitry / sql.sql
Created July 2, 2015 10:34
MySQL kill long running processes
SELECT CONCAT('KILL ',ID,';')
FROM INFORMATION_SCHEMA.PROCESSLIST
WHERE COMMAND = 'Query'
AND TIME > 10;
import fauxJax from 'faux-jax';
fauxJax.install();
fauxJax.on('request', function(request) {
console.log(request.requestURL);
request.respond(
200, { // status
'Content-Type': 'application/json' // headers
},
@dmitry
dmitry / readme.md
Created May 29, 2015 15:44
9flats-next development conventions
@dmitry
dmitry / class.rb
Last active August 29, 2015 14:19
What do you prefer? Identical but the same.
def tree_options(collection, options = {}, &block)
TreeOptions.(collection, options, &block)
end
class TreeOptions
attr_reader :result
def self.call(collection, options, &block)
new(collection, options, &block).process.result
end