Skip to content

Instantly share code, notes, and snippets.

View subomi's full-sized avatar
😝
What did you think you'd find here?

Subomi Oluwalana subomi

😝
What did you think you'd find here?
  • Convoy
  • Lagos, Nigeria
View GitHub Profile
@subomi
subomi / index.html
Last active November 1, 2016 13:39
Paystack Inline Blog Post
<html>
<head>
<title>Paystack Inline</title>
<!-- Paystack Library is ready to fly -->
<script src='https://js.paystack.co/v1/inline.js'></script>
</head>
<style type="text/css">
input, button {
margin: 2px;
padding: 10px;
function makepayment(key, email, amount, ref, callback) {
var handler = PaystackPop.setup({
key: key, // This is your public key only!
email: email || 'customer@email.com', // Customers email
amount: amount || 5000000.00, // The amount charged, I like big money lol
ref: ref || 6019, // Generate a random reference number and put here",
metadata: { // More custom information about the transaction
custom_fields: [
{}
]
<script src='https://js.paystack.co/v1/inline.js'></script>
@subomi
subomi / events.js
Created July 3, 2017 19:24
A small events data type to handle paystack payments events
"use strict";
const EventEmitter = require('events').EventEmitter;
const util = require('util');
module.export = eventsCreator;
const eventNames;
function eventsCreator(object) {
@subomi
subomi / flipper.rb
Created February 4, 2019 08:37
configuring a global flipper instance
# config/initializers/flipper.rb
Flipper.configure do |config|
config.default do
adapter = Flipper::Adapters::ActiveRecord.new
Flipper.new(adapter)
end
end
# This setup is primarily for first deployment, because consequently
# we can add new features from the Web UI. However when the DB is changed/crashed
# app/graphql/bitkoin_schema.rb
BitkoinSchema = GraphQL::Schema.define do
# ...
instrument(:query, FeatureFlags::Instrumentation)
# ...
end
# app/utils/feature_flags.rb
module FeatureFlags
module Instrumentation
module_function
DEFAULT_ERROR_MESSAGE = 'This Feature is currently unavailable, please try again later.'
def before_query(query)
# We query for the root fields alone.
begin
# config/routes.rb
flipper_auth_app = Flipper::UI.app(Flipper.instance) do |builder|
builder.use Rack::Auth::Basic do |username, password|
if username == ENV['FLIPPER_USERNAME'] && password == ENV['FLIPPER_PASSWORD']
true
else
false
end
end
end
@subomi
subomi / states-local-govt.json
Created May 23, 2020 18:32
Nigeria States & Local governements
{
"Abia State": [
"Aba South",
"Arochukwu",
"Bende",
"Ikwuano",
"Isiala Ngwa North",
"Isiala Ngwa South",
"Isuikwuato",
"Obi Ngwa",
@subomi
subomi / paystack_webhook_validation.rb
Created January 24, 2021 18:53
Handle Paystack webhook validation in Ruby.
# Controller to handle Event.
class PaystackController < ApplicationController
skip_before_action :authorize_request, only: :webhook
def webhook
paystack_instance = PaystackObject.instance
valid_event = paystack_instance.verify_webhook_event?(request)
raise StandardError, 'Phony event - Not Paystack' unless valid_event
render status: 200, plain: "Ok\n"