Skip to content

Instantly share code, notes, and snippets.

View achmiral's full-sized avatar
🏠
WFH

Miral Achmed achmiral

🏠
WFH
View GitHub Profile
@achmiral
achmiral / rails-singular-or-plural.md
Created July 24, 2018 03:53 — forked from SunDi3yansyah/rails-singular-or-plural.md
Rails Conventions - Singular or Plural?
Name Singular/Plural Use
Controller Plural rails g controller Users index show
Helper Plural rails g helper Users
Mailer Singular rails g mailer UserMailer
Migration Plural rails g migration AddEmailToUsers email:string
Model Singular rails g model User name:string
Observer Singular rails g observer User
Resource Plural* resources :users, :only => [:index, :show]
Scaffold Singular rails g scaffold User name:string
@achmiral
achmiral / shell.md
Created November 9, 2018 16:59 — forked from SunDi3yansyah/shell.md
MySQL / MariaDB login without SUDO
$ > sudo mysql -uroot
mysql > SELECT User, Host FROM mysql.user;
mysql > DROP USER 'root'@'localhost';
@achmiral
achmiral / dropzone_controller.js
Created March 24, 2023 05:21 — forked from lazaronixon/dropzone_controller.js
Dropzone.js + Stimulus + Active Storage
import { Controller } from "stimulus"
import { DirectUpload } from "@rails/activestorage"
import Dropzone from "dropzone"
import { getMetaValue, findElement, removeElement, insertAfter } from "helpers"
Dropzone.autoDiscover = false
export default class extends Controller {
static targets = [ "input" ]
@achmiral
achmiral / creative-cloud-disable.md
Created February 12, 2022 08:04 — forked from andreibosco/creative-cloud-disable.md
disable creative cloud startup on mac
@achmiral
achmiral / Gemfile
Created June 25, 2020 06:21 — forked from dhh/Gemfile
HEY's Gemfile
ruby '2.7.1'
gem 'rails', github: 'rails/rails'
gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data
# Action Text
gem 'actiontext', github: 'basecamp/actiontext', ref: 'okra'
gem 'okra', github: 'basecamp/okra'
# Drivers
@achmiral
achmiral / .gitlab-ci.yml
Created November 9, 2018 16:50 — forked from SunDi3yansyah/.gitlab-ci.yml
Example Gitlab CI Config for a Rails + Nginx application using Docker Compose
# See how variables work, and a list of predefined ones:
# - https://docs.gitlab.com/ce/ci/variables/
variables:
RAILS_IMAGE: registry.gitlab.com/bryanbraun/gridmaster.io/railsapp:$CI_COMMIT_SHA
NGINX_IMAGE: registry.gitlab.com/bryanbraun/gridmaster.io/nginx:$CI_COMMIT_SHA
DEPLOY_TAG: $CI_COMMIT_SHA
cache:
paths:
- vendor/ruby

The JSON API Standard

What is the JSON API Standard

The Specification

  • The History
  • Why does it exist?
    • Bike Shedding/LookingFor
  • Do we have to use it?
@achmiral
achmiral / manu-active-with.js
Created November 10, 2018 06:02 — forked from SunDi3yansyah/manu-active-with.js
Menu Active with JS
var url = window.location;
var element = $(".ui.vertical.menu a.item").filter(function() {
return this.href == url || url.href.indexOf(this.href) == 0;
}).addClass("active").parent().parent().parent();
if (element.is("li")) {
element.addClass("active");
}
@achmiral
achmiral / application.html.erb
Created November 9, 2018 16:59 — forked from SunDi3yansyah/application.html.erb
Each :notice :error :alert helper
<% [:notice, :error, :alert].each do |level| %>
<% unless flash[level].blank? %>
<div data-alert="alert" class="alert alert-<%= flash_class(level) %> fade in">
<a class="close" data-dismiss="alert" href="#">&times;</a>
<%= content_tag :p, flash[level] %>
</div>
<% end %>
<% end %>
@achmiral
achmiral / subdomain-localhost-rails-5.md
Created November 9, 2018 16:52 — forked from SunDi3yansyah/subdomain-localhost-rails-5.md
how to access subdomains locally with Rails 5

Subdomaining Localhost with Rails 5

I've been following this blog post on how to set up an api-only Rails 5 application. One of the sections talks about creating a subdomain for your api

Rails.application.routes.draw do
  constraints subdomain: "api" do
    scope module: "api" do