This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArticlesController < ApplicationController | |
def create | |
@article = Article.create article_params | |
if @article.save | |
redirect_to article_path(@article) | |
else | |
render :new | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example of usage: | |
# result = WeiConverter.new(1890000000000000000).call | |
# Result contains 1.89 | |
class WeiConverter | |
UNITS = { | |
wei: 1, | |
kwei: 1000, | |
ada: 1000, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location ~* \.(png|jpg|jpeg|js|css|svg) { | |
expires max; | |
gzip_static on; | |
add_header Cache-Control public; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
development: | |
<<: *default | |
host: webpacker | |
hmr: true | |
compile: true | |
# Reference: https://webpack.js.org/configuration/dev-server/ | |
dev_server: | |
https: false | |
host: webpacker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Module for easier translation (Easy Translation) | |
module EasyTranslation | |
extend ActiveSupport::Concern | |
included do | |
def self.t(symbol=nil) | |
case symbol | |
when nil | |
model_name.human | |
when :plural |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
elasticsearch: | |
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2 | |
container_name: elasticsearch | |
volumes: | |
- esdata1:/usr/share/elasticsearch/data | |
ports: | |
- 9200:9200 | |
volumes: | |
esdata1: | |
driver: local |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
businesses = Business.select{ |business| check_data_presence_for(business)} | |
previous_count = BusinessArea::RegisteredOffice.count | |
count = businesses.count.to_s | |
count_digits = count.length | |
cursors = ['|', '/', '-', '\\', '|', '/', '-', '\\'] | |
businesses.each.with_index(1) do |business, index| | |
cursor = cursors[index % 32 / 4] | |
formatted_index = index.to_s.rjust(count_digits, '0') | |
print "#{cursor} #{formatted_index}/#{count} (business #{business.id}) #{cursor}" | |
params = extract_params_from(business) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select type="text" | |
class="form-control" | |
v-model="momento.project" | |
name="project_id"> | |
<option v-for="project in projects" | |
v-bind:value="{name: project.name, id: project.id}"> | |
{{ project.name }} | |
</option> | |
</select> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# test/helpers/title_helper_test.rb | |
require 'test_helper' | |
class TitleHelperTest < ActionView::TestCase | |
test "return title with controller name when title content is nil" do | |
stub :controller_name, 'businesses' do | |
result = set_title_tag title_content: nil, from_layout: 'Admin Area' | |
assert_equal 'Clienti - Admin Area - iPY', result | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("turbolinks:load", function() { | |
$('.selectize').selectize() | |
}) | |
document.addEventListener('turbolinks:before-cache', function(){ | |
$('.selectize').each(function(){ | |
if (this.selectize != undefined) { | |
this.selectize.destroy() | |
} | |
}) |
NewerOlder