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

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

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