Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Moses Gathuku gathuku

🎯
Focusing
View GitHub Profile
View sidekiq.service
#
# This file tells systemd how to run Sidekiq as a 24/7 long-running daemon.
#
# Customize this file based on your bundler location, app directory, etc.
# Customize and copy this into /usr/lib/systemd/system (CentOS) or /lib/systemd/system (Ubuntu).
# Then run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
@gathuku
gathuku / _form.html.erb
Last active Feb 23, 2021
Rails checkbox form
View _form.html.erb
<%= form_with(model: user_group, local: true) do |form| %>
<% if user_group.errors.any? %>
<div id="error_explanation" class="alert alert-danger">
<h5><%= pluralize(user_group.errors.count, "error") %> prohibited this user group from being saved:</h5>
<ul>
<% user_group.errors.full_messages.each do |message| %>
<li><%= message %></li>
<% end %>
</ul>
View noticed_africas_talking.rb
class DeliveryMethods::AfricasTalking < Noticed::DeliveryMethods::Base
def deliver
post(url, format)
end
def format
{
username: credentials.fetch(:username),
to: recipient.tel.gsub(/\s+/, ''), # recepient phone number
message: notification.params[:message],
View code.html
<template id="">
<div>
<div x-data="{ open: false }" class="relative bg-gray-900 overflow-hidden">
<div class="max-w-screen-xl mx-auto ">
<div class="relative z-10 pb-8 bg-gray-900 sm:pb-16 md:pb-20 lg:max-w-2xl lg:w-full lg:pb-28 xl:pb-32">
<div class="pt-6 px-4 sm:px-6 lg:px-8">
<nav class="relative flex items-center justify-between sm:h-10 lg:justify-start">
<div class="flex items-center flex-grow flex-shrink-0 lg:flex-grow-0">
<div class="flex items-center justify-between w-full md:w-auto">
<a href="#">
@gathuku
gathuku / script.sh
Last active May 16, 2020
Check git changes with scripts
View script.sh
# returns true if changes present
if [[ `git status --porcelain` ]]; then
echo "Changes";
else
echo "No changes";
fi
# Check for a more specific file
# includes its name
@gathuku
gathuku / GitCommitEmoji.md
Created Apr 9, 2019 — forked from parmentf/GitCommitEmoji.md
Git Commit message Emoji
View GitCommitEmoji.md