Skip to content

Instantly share code, notes, and snippets.

View mehmetaydogduu's full-sized avatar
🏍️
Tech goes infinite speed

Mehmet Aydogdu mehmetaydogduu

🏍️
Tech goes infinite speed
View GitHub Profile
@jferris
jferris / configmap.yaml
Last active July 4, 2024 09:52
Rails Kubernetes Manifests
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"
@mzaidannas
mzaidannas / Simple Docker Setup with Rails+Nginx+Redis+Postgres.md
Last active March 26, 2024 19:55
Simple Docker Setup with Rails+Nginx+Redis+Postgres.md

Typical rails setup with docker+puma+nginx+postgres

Zaid Annas

Devsinc inc. 30/08/2018

Overview

@cihad
cihad / Aciklama
Last active May 9, 2020 19:17
Rails, Turbolinks, Google Tag Manager, Google Analytics
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. (*)
@BobCHub
BobCHub / ufw_reference.txt
Last active September 26, 2022 18:28
ufw reference
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
@vollnhals
vollnhals / pg_interval_rails_5_1.rb
Last active July 13, 2020 13:44
Implementation of interval database type in Rails 5.1
# 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
@igorls
igorls / fuse_socket.io.js
Last active May 10, 2018 21:59
socket.io 2.0.3 fixed for Fusetools compatibility
(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() {
@theorygeek
theorygeek / association_loader.rb
Last active October 31, 2023 07:15
Preloading Associations with graphql-batch
# 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
@kuznero
kuznero / Ctrl-C-Console-App.md
Last active May 18, 2021 18:13
Console application that exit on Ctrl-C (ready for Docker)

Console application that exit on Ctrl-C (ready for Docker)

Console.ReadLine or Console.ReadKey do not work as expected under Docker container environment. Thus, typical way to solve this would be to properly handle Ctrl-C key combination.

C# snippet

using System;
using System.Threading;
@zhujunsan
zhujunsan / Using Github Deploy Key.md
Last active June 4, 2024 10:08
Using Github Deploy Key

What / Why

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.

How to

  1. Generate a ssh key
@mrbongiolo
mrbongiolo / precompile.md
Last active February 27, 2023 00:16
HOW TO: Rails 4.2 add 'vendor/asset' to precompile list

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)