Skip to content

Instantly share code, notes, and snippets.

View EfeAgare's full-sized avatar
🎯
Focusing

Efe Agare EfeAgare

🎯
Focusing
View GitHub Profile
@EfeAgare
EfeAgare / LICENSE
Created October 19, 2022 10:30 — forked from sinisterchipmunk/LICENSE
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@EfeAgare
EfeAgare / rails http status codes
Created July 27, 2022 10:11 — forked from mlanett/rails http status codes
HTTP status code symbols for Rails
HTTP status code symbols for Rails
Thanks to Cody Fauser for this list of HTTP responce codes and their Ruby on Rails symbol mappings.
Status Code Symbol
1xx Informational
100 :continue
101 :switching_protocols
102 :processing
@EfeAgare
EfeAgare / update_book_spec.rb
Created April 21, 2022 12:59 — forked from kayinrage/update_book_spec.rb
Testing GraphQL Mutations In Ruby On Rails with Rspec
require 'rails_helper'
module Mutations
module Books
RSpec.describe UpdateBook, type: :request do
describe 'resolve' do
it 'updates a book' do
book = create(:book, title: 'Hero', publication_date: 1984, genre: 'Horror')
author = create(:author)
@EfeAgare
EfeAgare / csv_importable.rb
Created March 13, 2022 20:21 — forked from jeff-free/csv_importable.rb
Rspec CSV import feature testing with CSV foreach stubbing
# Implementation
module CSVImportable
extend ActiveSupport::Concern
included do
def self.import(file)
CSV.foreach(file.path, headers: true, encoding:'utf-8') do |row|
self.create! row.to_hash
end
@EfeAgare
EfeAgare / puma.service
Created February 8, 2022 15:11 — forked from arteezy/puma.service
Manage Puma with systemd and rbenv
[Unit]
Description=Puma Rails Server
After=network.target
[Service]
Type=simple
User=deploy
WorkingDirectory=/home/deploy/app/current
ExecStart=/home/deploy/.rbenv/bin/rbenv exec bundle exec puma -C /home/deploy/app/shared/config/puma.rb
ExecStop=/home/deploy/.rbenv/bin/rbenv exec bundle exec pumactl -S /home/deploy/app/shared/tmp/pids/puma.state stop
@EfeAgare
EfeAgare / LifecycleEventLIstener.java
Created January 30, 2022 21:56 — forked from christocracy/LifecycleEventLIstener.java
Listening to React-Native life-cycle events in your custom Views or Modules
public class MyView extends SimpleViewManager<MapView> {
public static final String TAG = "MyView";
@Override
public String getName() {
return TAG;
}
@Override
protected MapView createViewInstance(ThemedReactContext context) {
@EfeAgare
EfeAgare / node_nginx_ssl.md
Created December 3, 2021 21:59 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@EfeAgare
EfeAgare / README.md
Created December 3, 2021 09:28 — forked from jimothyGator/README.md
Nginx configuration for Mac OS X with Homebrew, using sites-enabled directory.
mkdir -p /usr/local/etc/nginx/sites-{enabled,available}
cd /usr/local/etc/nginx/sites-enabled
ln -s ../sites-available/default.conf
ln -s ../sites-available/default-ssl.conf

File locations:

  • nginx.conf to /usr/local/etc/nginx/
  • default.conf and default-ssl.conf to /usr/local/etc/nginx/sites-available
  • homebrew.mxcl.nginx.plist to /Library/LaunchDaemons/
@EfeAgare
EfeAgare / Capfile
Created December 2, 2021 22:53 — forked from mashihua/Capfile
Capistrano deploy script for node.js
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
Dir['vendor/gems/*/recipes/*.rb','vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) }
load 'config/deploy' # remove this line to skip loading any of the default tasks
load 'config/node'
@EfeAgare
EfeAgare / Deploy APP to EC2 Ubuntu
Last active December 30, 2022 12:47 — forked from ThomasBush/youtube-video-commands
Ubuntu 20.04 Focal Fossa Rails server setup
# Generate Random Passwords
curl 'https://www.random.org/passwords/?num=2&len=24&format=plain&rnd=new'
# Create deploy user
sudo adduser deploy
sudo adduser deploy sudo
su deploy
cd ../deploy/
mkdir .ssh
touch .ssh/authorized_keys