Skip to content

Instantly share code, notes, and snippets.

View prestigegodson's full-sized avatar
💭
I may be slow to respond.

Godson Ositadinma prestigegodson

💭
I may be slow to respond.
View GitHub Profile
@prestigegodson
prestigegodson / SwaggerConfig.java
Created September 6, 2018 13:23
Spring boot swagger configuration
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@prestigegodson
prestigegodson / download.js
Created November 4, 2018 07:12
React source code to download file via ajax
import React, { Component } from 'react';
import './App.css';
//import Person from './Person';
class App extends Component {
constructor(){
super();
this.state = {
downloaded : 'NOT YET',
public function transaction_charge(){
log_message('debug','Event charge.success from paystack');
// Retrieve the request's body
$input = @file_get_contents("php://input");
// only a post with paystack signature header gets our attention
if ((strtoupper($_SERVER['REQUEST_METHOD']) != 'POST' ) || !array_key_exists('HTTP_X_PAYSTACK_SIGNATURE', $_SERVER) ){
exit();
}
define('PAYSTACK_SECRET_KEY',$this->private_key);
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta name="viewport" content="width=device-width"/>
<title>Omnibranches | Agent Creation</title>
</head>
<body>
select pr.id, coalesce(acc_bal.balance,0.00) as "Amount Paid",
pr.title as "Project Title",
(select coalesce(sum(amount),0.00) from pledge where project_id = pr.id) as "Amount Pledged",
(select count(*) from pledge where project_id = pr.id) as "Pledge count",
(select count(*) from account_history where account_id = acc.id) as "Payment count"
from project pr
join account acc
on pr.id = acc.project_id
left join account_balance acc_bal
on acc.id = acc_bal.account_id
select au.first_name, au.last_name, au.email, p.user_id as "User Id", p.id as "Pledge Id", p.amount as "Pledged Amount",
(select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id) as "Paid Amount"
from pledge p
join auth_user au on au.id = p.user_id
where p.amount > (select coalesce(sum(pr.amount), 0) from pledge_redemption pr where p.id = pr.pledge_id);
@Injectable()
export class AuthInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<any>,
next: HttpHandler): Observable<HttpEvent<any>> {
const idToken = localStorage.getItem("id_token");
if (idToken) {
const cloned = req.clone({
<!doctype html>
<html lang="en">
<!-- Copyright 2017 Nishant Srivastava
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
{
"countries": [
{
"country": "Afghanistan",
"states": ["Badakhshan", "Badghis", "Baghlan", "Balkh", "Bamian", "Daykondi", "Farah", "Faryab", "Ghazni", "Ghowr", "Helmand", "Herat", "Jowzjan", "Kabul", "Kandahar", "Kapisa", "Khost", "Konar", "Kondoz", "Laghman", "Lowgar", "Nangarhar", "Nimruz", "Nurestan", "Oruzgan", "Paktia", "Paktika", "Panjshir", "Parvan", "Samangan", "Sar-e Pol", "Takhar", "Vardak", "Zabol"]
},
{
"country": "Albania",
"states": ["Berat", "Dibres", "Durres", "Elbasan", "Fier", "Gjirokastre", "Korce", "Kukes", "Lezhe", "Shkoder", "Tirane", "Vlore"]
},
@prestigegodson
prestigegodson / postgres_manager.py
Created December 9, 2020 11:14 — forked from valferon/postgres_manager.py
Python script to take care of postgres backup and restore of data
#!/usr/bin/python3
import argparse
import logging
import subprocess
import os
import tempfile
from tempfile import mkstemp
import configparser
import gzip