Skip to content

Instantly share code, notes, and snippets.

🏠
Coding cozy websites from home

Vitaliy Emeliyantsev gambala

View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am gambala on github.
  • I am gambala (https://keybase.io/gambala) on keybase.
  • I have a public key ASAcNq3bEZkYNOoxulD8WtPjwhUaFzzl4PZQCw3cycIKxwo

To claim this, I am signing this object:

@gambala
gambala / application_helper.rb
Last active Aug 1, 2017
http://images inside https://site with proxying in nginx
View application_helper.rb
module ApplicationHelper
def http_url(url)
return url if Rails.env.development?
"/http_proxy?url=#{url}"
end
end
View rubocop.yml
inherit_from: .rubocop_todo.yml
AllCops:
Exclude:
- 'bin/*'
- 'db/schema.rb'
- 'node_modules/**/*'
- 'vendor/**/*'
TargetRubyVersion: 2.4
Layout/IndentationConsistency:
EnforcedStyle: normal
@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
@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 / 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 / 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)
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 / 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
@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
You can’t perform that action at this time.