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 / 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
@EfeAgare
EfeAgare / create_document.rb
Created November 3, 2021 20:19 — forked from sulmanweb/create_document.rb
ActiveStorage file uploading in GraphQL API in Rails
# app/graphql/types/objects/document_type.rb
module Mutations
class CreateDocument < BaseMutation
description "creates a document for the user in the system"
argument :doc, ApolloUploadServer::Upload, required: true
field :document, Types::Objects::DocumentType, null: false
@EfeAgare
EfeAgare / Capfile
Created October 20, 2021 22:45 — forked from hey-audiopin/Capfile
Using Capistrano 3, capistrano-rbenv, and capistrano-rbenv-build together with Rails 5
# Load DSL and set up stages
require "capistrano/setup"
# Include default deployment tasks
require "capistrano/deploy"
# Load the SCM plugin appropriate to your project:
#
# require "capistrano/scm/hg"
# install_plugin Capistrano::SCM::Hg
@EfeAgare
EfeAgare / install-docker.md
Created September 6, 2021 13:48 — forked from npearce/install-docker.md
Amazon Linux 2 - install docker & docker-compose using 'sudo amazon-linux-extras' command

UPDATE (March 2020, thanks @ic): I don't know the exact AMI version but yum install docker now works on the latest Amazon Linux 2. The instructions below may still be relevant depending on the vintage AMI you are using.

Amazon changed the install in Linux 2. One no-longer using 'yum' See: https://aws.amazon.com/amazon-linux-2/release-notes/

Docker CE Install

sudo amazon-linux-extras install docker
sudo service docker start
@EfeAgare
EfeAgare / array.rb
Created August 12, 2021 14:07
splice in ruby
class Array
def splice(start, len, *replace)
self[start, len] = replace
self
end
end
ruby-1.8.7-p352 :008 > initial_array = [:a, :c, :h, :g, :t, :m]
=> [:a, :c, :h, :g, :t, :m]
ruby-1.8.7-p352 :009 > initial_array.splice(2, 2, :test)
@EfeAgare
EfeAgare / .js
Created July 1, 2021 18:27 — forked from jmn/.js
React Native Apollo FlatList infinite scroll
import React from 'react';
import { Text, View, SafeAreaView, FlatList, WebView, Dimensions, Button, ScrollView} from 'react-native';
import { ListItem } from 'react-native-elements';
import ApolloClient from "apollo-boost";
import gql from "graphql-tag";
import { ApolloProvider } from "react-apollo";
import { Query } from "react-apollo";
import HTML from 'react-native-render-html';
import { createAppContainer, createStackNavigator} from 'react-navigation';
def split_string(str)
result = []
str = str + "_" if str.length.odd?
len = str.length / 2
for i in 0..len-1
arry = str[2*i, 2]
result << arry
end
result.to_a
end
@EfeAgare
EfeAgare / .babelrc
Created April 14, 2021 00:23 — forked from andrewmunro/.babelrc
Sequelize cli with ES6
{
"presets": ["es2015"],
"plugins": [
"add-module-exports"
],
}