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 / RegManager.java
Last active November 18, 2016 15:44
Registry management @ Tochukwu ogbu
Class RegManager{
public static void main(String[] args){
/**
Create a class and put this methods inside.
1. For inserting your registration key into the registry
2. For reading values from the registry
import the classes in the registry.zip to this class
and add the lib in the lib.zip to this project class path
@robophil
robophil / Infix to postfix.js
Last active October 11, 2019 06:04
## Read me ## Javascript infix to postfix conversion (shunting yard algorithm). It also solves the expression passed to it after conversion to post fix, can be used for building a calculator ---->Reference the js script to your page html page, pass the arithmetic problem you wanna solve and voila it returns an ans, oh.. if there's an error, it r…
Array.prototype.peek = function () {
return this[this.length - 1];
};
/**
*This function accepts a string input for calculation, turns it into
*an array of token in infix notation, futher into postfix notation and
*returns an answer to the inputStr passed in or false if an error was
*found in the inputStr
**/
function infix2postfix(inputStr) {
@robophil
robophil / nginx.conf
Created June 10, 2016 16:55 — forked from turtlesoupy/nginx.conf
node.js upstream nginx config
http {
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m;
proxy_temp_path /var/tmp;
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@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
@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 / 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 / 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 / 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 / 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'