Skip to content

Instantly share code, notes, and snippets.

View kn9ts's full-sized avatar
🌠
I am one with the force!

Eugene Mutai kn9ts

🌠
I am one with the force!
View GitHub Profile

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

@media (min-width:320px) { /* smartphones, iPhone, portrait 480x320 phones */ }
@media (min-width:481px) { /* portrait e-readers (Nook/Kindle), smaller tablets @ 600 or @ 640 wide. */ }
@media (min-width:641px) { /* portrait tablets, portrait iPad, landscape e-readers, landscape 800x480 or 854x480 phones */ }
@media (min-width:961px) { /* tablet, landscape iPad, lo-res laptops ands desktops */ }
@media (min-width:1025px) { /* big landscape tablets, laptops, and desktops */ }
@media (min-width:1281px) { /* hi-res laptops and desktops */ }
<?php
class EpaymentsRedirectorPage extends RedirectorPage {
private static $db = array(
"IconColor" => "Text",
"IconType" => "Text"
);
private static $singular_name = 'Epayments Redirector Page';
public function PaginatedPages() {
$blogHolderId = $this->ID;
$list = BlogEntry::get()->filter(array("ParentID" => "{$blogHolderId}"))->sort('Date DESC');
$paginatedItems = new PaginatedList($list, $this->request);
$paginatedItems->setPageLength(4);
return $paginatedItems;
}
@kn9ts
kn9ts / ajax.js
Last active January 14, 2016 14:03
Custom Ajax Request
$.ajax({
url: URI,
type: "POST",
xhr: function() { // Custom XMLHttpRequest
var xhr = $.ajaxSettings.xhr();
if (xhr.upload) { // Check if upload property exists
xhr.upload.addEventListener('progress', function(e) {
if (e.lengthComputable) {
//Show the uploading progress
setTimeout(function() {
@kn9ts
kn9ts / bootstrap-square.css
Created February 19, 2015 19:11
Make all elements in bootstrap have sharp corners
/*
Bootflat 1.0.1
Designed & Built by flathemes, http://www.flathemes.com
Licensed under MIT License, http://opensource.org/licenses/mit-license.html
Thanks for supporting our website and enjoy!
*/
/*------------------------------------*\
$default
\*------------------------------------*/
@kn9ts
kn9ts / mistreated.js
Created February 21, 2015 12:39
Friends do not mistreat friends algorithmn
/**
*@Author - Eugene Mutai
*@Twitter - Jheneknights
*@Email - eugenemutai@gmail.com
*
* Date: 21/03/14
* Time: 2:00 pm
*
*/
@kn9ts
kn9ts / login.html
Created February 21, 2015 13:11
A Login form powered by AngularJS directives [Form Validation]
<!-- SPLASH: LOGIN PAGE -->
<section id="signup-login" data-transition="slide">
<article class="active splash">
<img src="./images/html5logos/white.png" class="logo">
<div class="form">
<form name="signup" novalidate ng-submit="signIn(signup)">
<fieldset class="radius-top" data-icon="user">
<input type="text" name="fullNames" ng-model="fullNames" ng-pattern="/^[\w]+(\s)[\w]+$/" ng-class="{'error': !signup.fullNames.$valid}" placeholder="Your username" id="txt-signup-name" value="" required>
</fieldset>
<fieldset class="radius-bottom shadow" data-icon="phone">

Deploy your own PaaS!

Setting up Dokku with DigitalOcean and Namecheap

..or how I made my own heroku in a few hours for $3.98.

This write-up owes a great deal to dscape's Node.js Deployments with Docker, Dokku, & Digital Ocean, the dokku project itself, and the fine folks working on dokku's issues. I took dscape's article as a starting point when trying this out but found some details lacking so I documented my own process for getting dokku up and running.

1. Get a domain

@kn9ts
kn9ts / laravel_cors_in_filter.php
Last active January 14, 2016 14:03
Enabling CORS in Laravel
// Allow No 'Access-Control-Allow-Origin' header in Laravel
// http://stackoverflow.com/questions/28096827/allow-no-access-control-allow-origin-header-in-laravel
App::before(function ($request, $response)
{
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: GET, POST, OPTIONS');
header('Access-Control-Allow-Headers: Origin, Content-Type, Accept, Authorization, X-Request-With');
header('Access-Control-Allow-Credentials: true');
});