Skip to content

Instantly share code, notes, and snippets.

View verkligheten's full-sized avatar
💭
🦊

Eugene Naumov verkligheten

💭
🦊
View GitHub Profile
@verkligheten
verkligheten / ror interview.txt
Last active August 17, 2020 20:54
RoR interview themes and examples
theory
OOP
ruby
inheritance
classes
modules
objects
private/public/protected
super
SAINT DOCTRINE:
• TDD, start with integrations tests
• Use Service Objects for interaction between several models
• all texts to i18n (in multilingual projects)
• all bootstrap elements to own CSS classes (grids & utilities are exeptions)
• use BEM methodology for naming CSS classes
• no CSS in HTML
• no JavaScript in HTML
• no new gems/libraries without agreement
User.all.each do |user|
user.attachments.each do |attachment|
unless ["contract", "terms_and_conditions", "consumer_credit_form", "consent_personal_data_processing", "registration_contract", "terms_and_conditions_provision", "loan_application", "terms_and_conditions_no_sign", "factura"].any? { |word| attachment.filename.include?(word) }
attachment.user_id = attachment.attachable_id
attachment.save
end
end
end
@verkligheten
verkligheten / widgets.js
Last active April 15, 2016 12:45
widgets
$(function() {
'use strict';
var updateWidgetPreview = function() {
var iframe = $('#previewiframe');
var form = $("#previewform");
if (form.length == 0) {
form = $("<form/>", {id: "previewform", action: iframe.data('url'), target: "previewiframe", method: "GET"});
form.hide();
form.appendTo(document.body);
# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
# cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
# Mayor.create(name: 'Emanuel', city: cities.first)
users = User.create([{"email" => "user1@email.com", "password" => "12345678", "password_confirmation" => "12345678"}, {"email" => "user2@email.com", "password" => "12345678", "password_confirmation" => "12345678"}])
DietaryPreference.create([{name: "I`ll eat it all!", picture: File.open(Rails.root.join('test', 'fixtures', 'files', 'preference.png'))},