Skip to content

Instantly share code, notes, and snippets.

View robophil's full-sized avatar
🍷
Working from home

Balogun Oghenerobo Philip robophil

🍷
Working from home
View GitHub Profile
@robophil
robophil / .htaccess
Created March 7, 2017 14:45
Getting angular2 to play well with apache
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# not rewrite css, js and images
RewriteCond %{REQUEST_URI} !\.(?:css|js|map|jpe?g|gif|png)$ [NC]
RewriteRule ^(.*)$ /index.html?path=$1 [NC,L,QSA]
@robophil
robophil / vanish-config.sh
Created February 14, 2017 10:23
How to get vanish to work on port 80
sudo vi /lib/systemd/system/varnish.service
sudo systemctl daemon-reload
sudo service varnish restart
# The link below would be helpful
# https://www.digitalocean.com/community/questions/configure-varnish-with-apache-on-ubuntu-14-04
@robophil
robophil / states.html
Created February 7, 2017 19:01
All the states in nigeria
<select class="form-control" id="" name="state">
<option value="Abia State">Abia State</option>
<option value="Adamawa State">Adamawa State</option>
<option value="Anambra State">Anambra State</option>
<option value="Akwa Ibom State">Akwa Ibom State</option>
<option value="Bauchi State">Bauchi State</option>
<option value="Bayelsa State">Bayelsa State</option>
<option value="Benue State">Benue State</option>
<option value="Borno State">Borno State</option>
<option value="Cross River State">Cross River State</option>
@robophil
robophil / compute_change.js
Created February 7, 2017 15:14 — forked from KodjoSuprem/compute_change.js
coin change problem / Knapsack problem
var coinTypes = [25, 10, 5];     
var coinNb = [8, 12, 20]; 
function computeChange(change,coinTypes, coinNb) {   
var rez = [];   
for (var i = 0; i < coinTypes.length; ++i) {       
if (coinTypes[i] === 0) continue;       
var coinsToGet = Math.floor(change / coinTypes[i]);       
if (coinsToGet > coinNb[i]) {           
coinsToGet = coinNb[i];       
}       
@robophil
robophil / sails.socket.ts
Created February 6, 2017 14:08
sample connection to sails socket from angular2
import { Injectable, EventEmitter } from '@angular/core'
import { Subject } from 'rxjs/Subject'
import { Donor } from './donor.interface'
import * as socketIO from 'socket.io-client'
import * as sailsIO from 'sails.io'
const url = 'http://localhost:1337'
@robophil
robophil / php5.6-fpm.conf
Last active August 21, 2018 00:32
Configure apache2.4 and php5.6-fpm
# location for config
# /etc/apache2/conf-available/php5.6-fpm.conf"
<IfModule mod_fastcgi.c>
AddHandler php5.6-fcgi .php
Action php5.6-fcgi /php5.6-fcgi
Alias /php5.6-fcgi /usr/lib/cgi-bin/php5.6-fcgi
FastCgiExternalServer /usr/lib/cgi-bin/php5.6-fcgi -socket /var/run/php/php5.6-fpm.sock -pass-header Authorization -idle-timeout 3600
<Directory /usr/lib/cgi-bin>
Require all granted
</Directory>
@robophil
robophil / Donor.js
Last active January 19, 2017 11:49
Custom validation for phone attribute for sails model Donor
/**
* Donor.js
*
* @description :: TODO: You might write a short summary of how this model works and what it represents here.
* @docs :: http://sailsjs.org/documentation/concepts/models-and-orm/models
*/
const shortid = require('shortid');
module.exports = {
@robophil
robophil / stop all running timer.js
Created November 23, 2016 21:40
Stops all running timer in a page.
for (var i = 1; i < 99999; i++) {
window.clearInterval(i);
window.clearTimeout(i);
if(window.mozCancelAnimationFrame)window.mozCancelAnimationFrame(i); // Firefox
}
@robophil
robophil / Observable_.ts
Last active November 18, 2016 15:40
An implementation of nativescript Observable with a toJson method
export class Observable_ extends Observable {
private _json: Object = {};
constructor(key: string, args: Object) {
super(args);
this._json = (args != null && typeof args === 'object') ? args : {};//initialize object
}
public set(name: string, value: any) {
this._json[name] = value;
@robophil
robophil / tmux-cheatsheet.markdown
Created August 9, 2016 16:10 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname