Skip to content

Instantly share code, notes, and snippets.

View mokevnin's full-sized avatar

Kirill Mokevnin mokevnin

View GitHub Profile
@mokevnin
mokevnin / Dockerfile
Last active December 16, 2017 14:19
hexlet.io: configuration management and deploy
FROM ruby:2.2.1
RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app
ENV RAILS_ENV production
ENV REFILE_CACHE_DIR /var/tmp/uploads
RUN curl -sL https://deb.nodesource.com/setup | bash -
(ns hexlet.codex.actions
(:require
[jayq.core :as jq]
[cljs.core.async :as a]
[hexlet.helpers :as h]
[hexlet.shared :refer [chan]])
(:require-macros [jayq.macros :as jm]))
(enable-console-print!)
(ns hexlet.terminal.components
(:require
[cljs.core.async :as a]
[hexlet.shared :refer [chan]]
[quiescent :as q :include-macros true]
[quiescent.dom :as d]
[components.rails :as rails]
[hexlet.helpers :as h]
[hexlet.terminal.actions :as actions]))
(ns hexlet.quiz
(:require
[hexlet.helpers :as h]
[ajax.core :refer [POST]]
[goog.dom :as gd]
[cljs.core.async :as a]
[quiescent :as q :include-macros true]
[quiescent.dom :as d])
(:require-macros [cljs.core.async.macros :as am]))
@mokevnin
mokevnin / game.js
Last active January 1, 2016 18:19
var Game = React.createClass({
getInitialState: function() {
var numbers = _.shuffle(_.range(1, this.props.size * this.props.size));
var table = [];
var thumb_position = {};
for (var x = 0; x < this.props.size; x++) {
table[x] = [];
for (var y = 0; y < this.props.size; y++) {
if (x == this.props.size - 1 && y == this.props.size - 1) {
thumb_position = {"x": x, "y": y};
@mokevnin
mokevnin / routes.erl
Created December 23, 2013 18:49
naming routes for cowboy
-module(routes).
-export([compile/0, generate_path/2, generate_url/3]).
compile() ->
List = [root, games, game, start_game],
cowboy_router:compile([
%% {URIHost, list({URIPath, Handler, Opts})}
{'_', [route(Name) || Name <- List]}
]).
@mokevnin
mokevnin / playbook
Last active December 31, 2015 20:39
---
-
hosts: default
vars:
database:
password: my_secret_password
# server_name: "codebattle.me"
erlang:
directory: ~/.kerl/erlangs
-module(example).
-export([words_count/1]).
words_count(Str) ->
words_count_ac(Str, outside, 0).
words_count_ac([], _, Acc) ->
Acc;
words_count_ac([Head | Tail], outside, Acc) when Head /= 32 ->
def word_count(str)
previous = :outside
current = :outside
count = 0
str.each_char do |char|
case current
when :outside
previous = :outside
if char != ' '
current = :inside
@mokevnin
mokevnin / irb
Created January 31, 2013 04:48
User.ancestors
1.9.3-p327 :008 > User.ancestors
=> [User(Table doesn't exist), StateMachine::InstanceMethods, User :state instance helpers, UserRepository, UsefullScopes, User::GeneratedFeatureMethods, #<Module:0x007fbb5bd15038>, ActiveRecord::Base, ActiveRecord::Aggregations, ActiveRecord::Transactions, ActiveRecord::Reflection, ActiveRecord::Serialization, ActiveModel::Serializers::Xml, ActiveModel::Serializers::JSON, ActiveModel::Serialization, ActiveRecord::Store, ActiveRecord::AutosaveAssociation, ActiveRecord::NestedAttributes, ActiveModel::SecurePassword, ActiveRecord::IdentityMap, ActiveRecord::Associations, ActiveModel::Validations::Callbacks, ActiveRecord::Callbacks, ActiveModel::Observing, ActiveRecord::Timestamp, ActiveRecord::AttributeMethods::DeprecatedUnderscoreRead, ActiveRecord::AttributeMethods::Serialization, ActiveRecord::AttributeMethods::Dirty, ActiveModel::Dirty, ActiveRecord::AttributeMethods::TimeZoneConversion, ActiveRecord::AttributeMethods::PrimaryKey, ActiveRecord::AttributeMethods::Query, Acti