Skip to content

Instantly share code, notes, and snippets.

View sunchess's full-sized avatar
🎧
Focusing

Alexander Dmitriev sunchess

🎧
Focusing
  • Russia, Rostov-on-Don
View GitHub Profile
@sunchess
sunchess / Empty Template.vue
Created May 19, 2022 14:30 — forked from patleeman/Template.vue
Empty .vue file template
<template>
</template>
<script>
export default {
components: {
},
props: [
@sunchess
sunchess / Terraform.md
Last active April 7, 2022 13:35
Terraform commands

Terraform Command Lines

Terraform CLI tricks

terraform -install-autocomplete #Setup tab auto-completion, requires logging back in

Format and Validate Terraform code

@sunchess
sunchess / rails_dirty.rb
Created July 18, 2017 16:01
Пояснения по dirty методам
#rails <= 5.0
user = User.new(name: "Bob")
user.save
user.changed_name? #true
user.update_attribute(:name, "Alice")
user.changed_name? #true
#rails >= 5.1
user = User.new(name: "Bob")
@sunchess
sunchess / gist:48434beee4fe92ba7242
Created May 8, 2015 09:29
Просматриваем путь к переводу полей формы #Rails 4.2
#put to lib/i18n_ar_attribute_shower.rb
module ActiveModel
# == Active \Model \Translation
#
# Provides integration between your object and the Rails internationalization
# (i18n) framework.
#
# A minimal implementation could be:
#
@all_count = 0
list.each { |item| @all_count += item['quantity'] }
#short and correctly
@all_count = list.map(&:auantity).sum
filters[:departure_date].each do |str_date|
if str_date.size == 8
updated_date_filters << Date.strptime(str_date, '%d.%m.%y')
else
updated_date_filters << str_date
end
end
#short variant
filters[:departure_date].map!(|d| d.size == 8 ? Date.strptime(d, '%d.%m.%y') : d)
@sunchess
sunchess / gist:1978397
Created March 5, 2012 13:51
flex error
Error #1034: Type Coercion failed: cannot convert Object@ee052671 to com.raka.mapeditor.model.Area
package com.raka.mapeditor.model
{
public class Area
{
public var id:Number;
public var name:String;