Skip to content

Instantly share code, notes, and snippets.

View iolufemi's full-sized avatar

Olanipekun Femi iolufemi

View GitHub Profile
// Generate Certificate
docker run -it --rm -p 443:443 -p 80:80 --name letsencrypt \
-v "/Users/iolufemi/workspace/letsencrypt:/etc/letsencrypt" \
-v "/Users/iolufemi/workspace/letsencrypt/:/var/lib/letsencrypt" \
quay.io/letsencrypt/letsencrypt:latest -a manual -d paybutton.prod1flutterwave.co \
--server https://acme-v01.api.letsencrypt.org/directory auth
// Renew Certificate
sudo docker run --rm --publish 80:80 --publish 443:443 --name letsencrypt \
--volume "/tmp/letsencrypt/etc/:/etc/letsencrypt" \
--volume "/tmp/letsencrypt/var/:/var/lib/letsencrypt" \
quay.io/letsencrypt/letsencrypt:latest certonly --standalone \
-d domain.name -d www.domain.name --agree-tos --email webmaster@domain.name

Keybase proof

I hereby claim:

  • I am iolufemi on github.
  • I am iolufemi (https://keybase.io/iolufemi) on keybase.
  • I have a public key whose fingerprint is F97F 6559 53A3 23C0 A57B 089A 8D6C 2A10 EA36 F3D6

To claim this, I am signing this object:

@iolufemi
iolufemi / custom-error.js
Created June 6, 2016 20:20 — forked from justmoon/custom-error.js
Creating custom Error classes in Node.js
'use strict';
module.exports = function CustomError(message, extra) {
Error.captureStackTrace(this, this.constructor);
this.name = this.constructor.name;
this.message = message;
this.extra = extra;
};
require('util').inherits(module.exports, Error);
@iolufemi
iolufemi / AuthController.js
Created January 21, 2016 10:03 — forked from robwormald/AuthController.js
Sails + passport + oauth2orize stuffs
/**
* AuthController
*
* @module :: Controller
* @description :: Contains logic for handling auth requests.
*/
var passport = require('passport');
var GoogleStrategy = require('passport-google').Strategy;
@iolufemi
iolufemi / CountryCodes.json
Created January 15, 2016 16:42 — forked from Goles/CountryCodes.json
Country and Dial or Phone codes in JSON format
[{"name":"Israel","dial_code":"+972","code":"IL"},{"name":"Afghanistan","dial_code":"+93","code":"AF"},{"name":"Albania","dial_code":"+355","code":"AL"},{"name":"Algeria","dial_code":"+213","code":"DZ"},{"name":"AmericanSamoa","dial_code":"+1 684","code":"AS"},{"name":"Andorra","dial_code":"+376","code":"AD"},{"name":"Angola","dial_code":"+244","code":"AO"},{"name":"Anguilla","dial_code":"+1 264","code":"AI"},{"name":"Antigua and Barbuda","dial_code":"+1268","code":"AG"},{"name":"Argentina","dial_code":"+54","code":"AR"},{"name":"Armenia","dial_code":"+374","code":"AM"},{"name":"Aruba","dial_code":"+297","code":"AW"},{"name":"Australia","dial_code":"+61","code":"AU"},{"name":"Austria","dial_code":"+43","code":"AT"},{"name":"Azerbaijan","dial_code":"+994","code":"AZ"},{"name":"Bahamas","dial_code":"+1 242","code":"BS"},{"name":"Bahrain","dial_code":"+973","code":"BH"},{"name":"Bangladesh","dial_code":"+880","code":"BD"},{"name":"Barbados","dial_code":"+1 246","code":"BB"},{"name":"Belarus","dial_code":"+375","
@iolufemi
iolufemi / meteor-async.md
Created October 21, 2015 07:23 — forked from possibilities/meteor-async.md
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

@iolufemi
iolufemi / social-sharing-alignment.html
Last active August 26, 2015 17:39 — forked from thebigreason/social-sharing-alignment.html
Align Facebook Like, Twitter Tweet and Google +1 buttons
<div class="social">
<span class="twitter">
<a href="http://twitter.com/share" class="twitter-share-button" data-url="[your-url-here]">Tweet</a>
</span>
<span class="google">
<g:plusone size="medium" href="[your-url-here]"></g:plusone>
</span>
<span class="Facebook">
<iframe src="https://www.facebook.com/plugins/like.php?href=[your-url-here]&amp;show_faces=false&amp;layout=button_count" scrolling="no" frameborder="0" style="height: 21px; width: 100px" allowTransparency="true"></iframe>
</span>

WordPress Unit Tests Quick Start Guide

This quick start guide is geared towards installing PHPUnit on OSX in order to run the WordPress unit tests. It uses homebrew to install PHP using homebrew-php. You can likely skip this step if you've already got php and pear installed properly.

If you use MAMP, then try these instructions to use MAMP's php and pear to install PHPUnit.

install homebrew

ruby &lt;(curl -fsSkL raw.github.com/mxcl/homebrew/go)

Here's all you have to do to add clustering to your node.js application.

  • save this code as cluster.js, and run cluster.js instead of server.js (or /bin/www, or whatever it's called for your project)
  • the only line you'll need to change is the last line - it needs to point to the location of your server.js file
var cluster = require('cluster');

if (cluster.isMaster) {
  // Count the machine's CPUs
 var cpuCount = require('os').cpus().length;