Skip to content

Instantly share code, notes, and snippets.

🏠
Coding cozy websites at home

Vitaliy Emeliyantsev gambala

🏠
Coding cozy websites at home
Block or report user

Report or block gambala

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rubocop.yml
inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'tmp/**/*'
- 'vendor/**/*'
RunRailsCops: true
Documentation:
Enabled: false
@gambala
gambala / pyramid.rb
Created Jul 11, 2016
Let's find minimal path in pyramid from top to bottom
View pyramid.rb
class Pyramid
attr_accessor :layers_number
attr_accessor :layers
def initialize(layers_number, layers = [])
@layers_number = layers_number
@layers = layers
end
def populate_with_random_weights
@gambala
gambala / _form.slim
Created Jul 24, 2016
BootstrapFormBuilder
View _form.slim
= form_for resource do |f|
= f.form_group :first_name do
= f.label :first_name, class: 'control-label'
= f.text_field :first_name, class: 'form-control'
= f.error_message :first_name
@gambala
gambala / example.scss
Created Aug 8, 2016
OOP-like CSS naming
View example.scss
// css/search-form.scss
.search-form {
> .field {
}
}
// css/search-form/iconic-button.scss
View phrases_controller.rb
class PhrasesController < ApplicationController
def index
set_cookies
@phrases_left = avaible_ids(cookies[:showed_ph]).count
@phrases = Phrase.find(cookies_to_array(cookies[:showed_ph]))
end
def random_phrase
all_ids = avaible_ids(cookies[:showed_ph])
@phrases_left = all_ids.count - 1
@gambala
gambala / palindrom_searcher.rb
Last active Sep 6, 2016
Palindrom searcher class
View palindrom_searcher.rb
class PalindromSearcher
attr_accessor :string
def initialize(string)
@string = string
end
def longest
return unless all.any?
all.max_by(&:length)
@gambala
gambala / trello.css
Created Sep 28, 2016
Gambala theme for Trello
View trello.css
/* webfont */
@import 'https://fonts.googleapis.com/css?family=Roboto';
body,
button,
html,
input,
select,
textarea {
@gambala
gambala / example.js
Created Jun 23, 2017
Params filter and formatter for fetch requests
View example.js
import urlWithParams from 'urlWithParams'
fetch(
urlWithParams('/api/v1/cities.json', {
name: input,
city_id: this.state.cityID,
})
)
.then((response) => response.json())
.then((json) => {
@gambala
gambala / admin.slim
Created Jul 24, 2017
Redis::Objects use case
View admin.slim
p = user.ip_addresses.size
p = user.ip_addresses.value
View rubocop.yml
inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'node_modules/**/*'
- 'vendor/**/*'
TargetRubyVersion: 2.4
Layout/IndentationConsistency:
EnforcedStyle: normal
You can’t perform that action at this time.