Zaid Annas
Devsinc inc. 30/08/2018
// Note: make sure your editor in step 2 is non-blocking (i.e. not "subl -w") | |
// | |
// 1. Enable in your config/environment/development.rb | |
// config.action_view.annotate_rendered_view_with_filenames = true | |
// | |
// 2. Add this to your routes.rb | |
// post "__xray/open", to: ->(env) { | |
// editor = ENV["GEM_EDITOR"] || ENV["VISUAL"] || ENV["EDITOR"] || "/usr/local/bin/subl" | |
// params = JSON.parse(Rack::Request.new(env).body.read) | |
// path = Rails.root.join(params["path"].to_s) |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: example | |
namespace: default | |
data: | |
APPLICATION_HOST: example.com | |
LANG: en_US.UTF-8 | |
PIDFILE: /tmp/server.pid | |
PORT: "3000" |
Google Tag Manager sayfanizda: | |
1. Sol menuden Tetikleyiciler'e tikla | |
a. Yeni'ye tikla | |
1) Acilan sayfanin ustunde tetikleyici adi: Adsız Tetikleyiciyi turbolinksPageView olarak degistirdim. | |
2) Tetikleyici Yapılandırması'na tikla | |
a) Tetikleyici türü seçin: ---->Ozel etkinlik<------ (*) | |
b) Etkinlik adi: turbolinks:load (*) | |
c) Baska bir seye dokunmadan Kaydet diyelim. | |
2. Etiketlere tiklayalim. (*) |
Firewall with UFW | |
sudo apt-get install ufw -------- Install ufw | |
sudo Vim /etc/default/ufw ------- Edit UFW configuration | |
sudo ufw reset ------------------ reset ufw rules | |
sudo ufw default deny incoming -- To set the defaults | |
sudo ufw default allow outgoing | |
sudo ufw allow https ------------ port 443 -- HTTPS connections, which is what encrypted web servers | |
sudo ufw allow ssh -------------- port 22 -- Configure your server to allow incoming SSH connections | |
sudo ufw allow 22 |
# implementation from https://github.com/rails/rails/pull/16919 | |
# activerecord/lib/active_record/connection_adapters/postgresql/oid/interval.rb | |
require "active_support/duration" | |
module ActiveRecord | |
module ConnectionAdapters | |
module PostgreSQL |
(function webpackUniversalModuleDefinition(root, factory) { | |
if (typeof exports === 'object' && typeof module === 'object') | |
module.exports = factory(); | |
else if (typeof define === 'function' && define.amd) | |
define([], factory); | |
else if (typeof exports === 'object') | |
exports["io"] = factory(); | |
else | |
root["io"] = factory(); | |
})(this, function() { |
# frozen_string_literal: true | |
class AssociationLoader < GraphQL::Batch::Loader | |
attr_reader :klass, :association | |
def initialize(klass, association) | |
raise ArgumentError, "association to load must be a symbol (got #{association.inspect})" unless association.is_a?(Symbol) | |
raise ArgumentError, "cannot load associations for class #{klass.name}" unless klass < ActiveRecord::Base | |
raise TypeError, "association #{association} does not exist on #{klass.name}" unless klass.reflect_on_association(association) | |
@klass = klass |
Deploy key is a SSH key set in your repo to grant client read-only (as well as r/w, if you want) access to your repo.
As the name says, its primary function is to be used in the deploy process in replace of username/password, where only read access is needed. Therefore keep the repo safe from the attack, in case the server side is fallen.
To enable the precompilation of all non.js/.css assets within vendor/assets
just add this to config/initializers/assets.rb
:
Rails.application.config.assets.precompile << Proc.new { |path, fn| fn =~ /vendor\/assets/ && !%w(.js .css).include?(File.extname(path)) }
Be aware that this will precompile ALL non .js/.css assets that you have there, some plugins or libraries might have .txt or other files around, and those would end up into your precompiled list also.
If you need to precompile images only, you could use this:
Rails.application.config.assets.precompile += %w(*.png *.jpg *.jpeg *.gif)