Skip to content

Instantly share code, notes, and snippets.

View SunDi3yansyah's full-sized avatar

Cahyadi Triyansyah SunDi3yansyah

View GitHub Profile
SunDi3yansyah / force-http.tpl
Created March 25, 2024 21:23 — forked from wodCZ/force-http.tpl
vestacp cert letsencrypt
server {
listen %ip%:%web_port%;
server_name %domain_idn% %alias_idn%;
location / {
rewrite ^(.*) https://%domain_idn%$1 permanent;
SunDi3yansyah /
Created July 31, 2021 15:49 — forked from abravalheri/
RFC: Git Commit Message Guidelines

Commit Message Guidelines

In the last few years, the number of programmers concerned about writing structured commit messages have dramatically grown. As exposed by Tim Pope in article readable commit messages are easy to follow when looking through the project history. Moreover the AngularJS contributing guides introduced conventions that can be used by automation tools to automatically generate useful documentation, or by developers during debugging process.

This document borrows some concepts, conventions and even text mainly from these two sources, extending them in order to provide a sensible guideline for writing commit messages.

SunDi3yansyah /
Created February 23, 2021 16:20 — forked from ShvaykaD/
Upgrading PostgreSQL service from 9.x or 10.x to 11 version on CentOS 7

Rails naming conventions

General Ruby conventions

Class names are CamelCase.

Methods and variables are snake_case.

Methods with a ? suffix will return a boolean.

SunDi3yansyah /
Created September 7, 2020 15:06 — forked from floodico/
user is typing feature
jQuery(document).on 'turbolinks:load', ->
u = $("#current_user").val()
window.current_user = JSON.parse(u)
messages = $('#messages')
user_is_typing = $('#user_is_typing')
App.global_chat = App.cable.subscriptions.create {
channel: "ChatRoomsChannel"
SunDi3yansyah / test_channel_spec.rb
Created May 31, 2020 10:36 — forked from tomekw/test_channel_spec.rb
Unit testing ActionCable channels with RSpec
# app/channels/hello_channel.rb
class HelloChannel < ActionCable::Channel::Base
def say_hello(data)
times_to_say_hello = data.fetch("times_to_say_hello")
hello = "Hello, #{}!"
times_to_say_hello.times do
ActionCable.server.broadcast(, hello)
SunDi3yansyah / nginx.conf
Created May 13, 2020 06:57 — forked from weapp/nginx.conf
Return common errors as json in Nginx
error_page 500 /500.html;
location /500.html{
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}';
error_page 502 /502.html;
location /502.html{
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}';
SunDi3yansyah / message_encryptor.rb
Created April 17, 2020 05:48 — forked from pixeltrix/message_encryptor.rb
Action Mailer interceptor for encrypting emails using S/MIME
require 'openssl'
class MessageEncryptor
class << self
include OpenSSL
def delivering_email(message)
encrypted_message = sign_and_encrypt(message.encoded,
overwrite_body(message, encrypted_message)
overwrite_headers(message, encrypted_message)
SunDi3yansyah / build.rb
Created April 11, 2020 08:59 — forked from dugsmith/build.rb
Example Capistrano configuration to run RSpec tests on build instance
role :app, 'your-build-server-ip'
set :scm, :git
set :repository, "your-git-repo-url"
set :user, 'your-user-name'
set :deploy_to, "/Users/#{user}/deployments/build/#{application}"
set :deploy_via, :export
set :branch, 'master'
set :rails_env, 'build'
SunDi3yansyah / character_set_and_collation.rb
Created April 9, 2020 16:14 — forked from tjh/character_set_and_collation.rb
Convert all Rails table column collation and character set
#!/usr/bin/env ruby
# Put this file in the root of your Rails project,
# then run it to output the SQL needed to change all
# your tables and columns to the same character set
# and collation.
# > ruby character_set_and_collation.rb