Skip to content

Instantly share code, notes, and snippets.

View paulobunga's full-sized avatar
🏠
Available for work

Paul Obunga paulobunga

🏠
Available for work
View GitHub Profile
@paulobunga
paulobunga / Test.php
Last active May 11, 2017 22:15
Autoload firebase php-jwt library in CodeIgniter 3
<?php defined('BASEPATH') OR exit('No direct script access allowed');
use \Firebase\JWT\JWT;
Class Test extends CI_Controller
{
public function index()
{
$key = "example_key";
<?php defined('BASEPATH') OR exit('No direct script access allowed');
Class Api extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('api_model','api');
//I stumbled into issues when testing on my local development server
@paulobunga
paulobunga / index.html
Created August 20, 2017 11:24
Centering with html css grid
<html>
<head>
<title>Centering with Grid</title>
<style>
body, html {
height: 100%;
display: grid;
}
h1.title {
margin: auto;
@paulobunga
paulobunga / CodeIgniter base url
Created October 3, 2017 17:05
Automatically pick a base url for a codeIgniter project
$config['base_url'] = 'https';
$config['base_url'] .= '://'. $_SERVER['HTTP_HOST'];
$config['base_url'] .= str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']);
//Add this to fetch the CLEARDB_DATABASE_URL
$url = parse_url(getenv("CLEARDB_DATABASE_URL"));
$db['default'] = array(
'dsn' => '',
'hostname' => $url["host"],
'username' => $url["user"],
'password' => $url["pass"],
'database' => substr($url["path"], 1),
'dbdriver' => 'mysqli',
//Add this to fetch the CLEARDB_DATABASE_URL
$url = parse_url(getenv("CLEARDB_DATABASE_URL"));
@paulobunga
paulobunga / regex
Created August 3, 2018 00:08
Regex to select HTML element by ID
<a.*?href="([^"]*)".*?tabindex=".*?61.*?"[^>]*>.*?<\/a>
@paulobunga
paulobunga / index.html
Created August 9, 2018 00:02
Responsive Shopping Cart - Brand v01
<head>
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1.0">
</head>
<body class="ux-app">
<div class="container">
<div class="cart">
<div class="basket col-md-6 col-md-offset-1">
<div class="product ux-card">
<img src="https://img1.wsimg.com/fos/react/sprite.svg#domains" height="32" width="32" />
<span class="title"><a href="/product/{id}">catstewardesses</a></span>
@paulobunga
paulobunga / error_pages
Created September 2, 2018 21:30 — forked from ansemjo/error_pages
beautiful html5 error pages for nginx; applied globally for each server block
# this belongs inside a 'server {}' block
# I propose you put this in a file somewhere, e.g. /etc/nginx/error_pages
# and then include it with an 'include error_pages;' directive
#
# see it in larger context here:
# https://git.semjonov.de/server/nginx-conf/tree/b63de50001b15fbb33680de14fad05230f2b8fd2
#
# design is taken from html5-boilerplate:
# https://github.com/h5bp/html5-boilerplate/blob/master/src/404.html
@paulobunga
paulobunga / flash-app.js
Created September 6, 2018 13:58 — forked from brianmacarthur/flash-app.js
Flash messaging in Express 4: express-flash vs. custom middleware in ejs, handlebars, or jade
var express = require('express');
var cookieParser = require('cookie-parser');
var session = require('express-session');
var flash = require('express-flash');
var handlebars = require('express-handlebars')
var app = express();
var sessionStore = new session.MemoryStore;
// View Engines