Skip to content

Instantly share code, notes, and snippets.

@kinsomicrote
kinsomicrote / log_request_header.rb
Created January 6, 2024 08:38
rails http header
before_action :log_request
def log_request
Rails.logger.info "Request: #{request.method} #{request.fullpath}"
http_envs = {}.tap do |envs|
request.headers.each do |key, value|
envs[key] = value if key.downcase.starts_with?('http')
end
end
@kinsomicrote
kinsomicrote / README.md
Created April 28, 2023 17:46 — forked from masterT/README.md
RequestForgeryProtection for ActionController::API

Configure ActionController::RequestForgeryProtection for an ApplicationController that does not inherits from ActionController::Base (or any controller that does not include ActionController::RequestForgeryProtection).

This is required since the module is included after the application is loaded, so it does not get configured automatically by the configuration files config/environments/*.rb.

@kinsomicrote
kinsomicrote / banks.json
Created April 10, 2023 20:51 — forked from LordGhostX/banks.json
List of Nigerian Banks and Codes
{
"Access Bank": "044",
"Access Bank (Diamond)": "063",
"ALAT by WEMA": "035A",
"ASO Savings and Loans": "401",
"Bowen Microfinance Bank": "50931",
"CEMCS Microfinance Bank": "50823",
"Citibank Nigeria": "023",
"Ecobank Nigeria": "050",
"Ekondo Microfinance Bank": "562",
@kinsomicrote
kinsomicrote / tinymce-react-nextjs.md
Created January 18, 2021 13:18 — forked from zhangshine/tinymce-react-nextjs.md
NextJs- React - Self hosted TinyMCE
  1. Install (TinyMCE 5.x)
npm install --save tinymce @tinymce/tinymce-react copy-webpack-plugin
  1. Copy static files(tinymce skins) to public folder. Edit file next.config.js
const path = require('path');
const webpack = require('webpack');
const CopyPlugin = require('copy-webpack-plugin');
require 'httparty'
class TransactionsController < ApplicationController
def paystack
@order = Order.find_by(ref_no: params[:ref])
amount = @order.price
ref = @order.ref_no
@kinsomicrote
kinsomicrote / rails http status codes
Created November 18, 2019 19:14 — 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
# frozen_string_literal: true
Doorkeeper.configure do
# Change the ORM that doorkeeper will use (requires ORM extensions installed).
# Check the list of supported ORMs here: https://github.com/doorkeeper-gem/doorkeeper#orms
orm :active_record
# This block will be called to check whether the resource owner is authenticated or not.
resource_owner_authenticator do
#raise "Please configure doorkeeper resource_owner_authenticator block located in #{__FILE__}"
@kinsomicrote
kinsomicrote / ngrok-installation.md
Created October 24, 2019 15:39 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

Installing ngrok on OSX

brew cask install ngrok

Using ngrok

The easiest way to use ngrok to tunnel into your localhost is if your local project is running on a specific port (e.g. not using named vhosts). You just run ngrok http [port number].

You can quickly boot up a local webserver using ruby. cd into the project's root directory and run ruby -run -e httpd . -p [port number].

alias ga.="git add ."
alias gc="git commit -m"
alias gpush="git push"
alias gb="git branch"
alias gck="git checkout"
alias gst="git status"
alias gpull="git pull origin"
@kinsomicrote
kinsomicrote / HOC.js
Created March 2, 2018 03:53 — forked from Restuta/HOC.js
React HOC (Higher Order Component) Example
/* HOC fundamentally is just a function that accepts a Component and returns a Component:
(component) => {return componentOnSteroids; } or just component => componentOnSteroids;
Let's assume we want to wrap our components in another component that is used for debugging purposes,
it just wraps them in a DIV with "debug class on it".
Below ComponentToDebug is a React component.
*/
//HOC using Class
//it's a function that accepts ComponentToDebug and implicitly returns a Class
let DebugComponent = ComponentToDebug => class extends Component {