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
@mort3za
mort3za / git-auto-sign-commits.sh
Last active January 30, 2024 10:31
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@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>
@KodjoSuprem
KodjoSuprem / compute_change.js
Created November 29, 2016 09:29
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 / 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;

Why I hate TypeScript

Warning: These views are highly oppinated and might have some slightly incorrect facts. My experience with typescript was about 2 weeks in Node and a week in angular2.

Not Standard

TypeScript is implementing their own take on JavaScript. Some of the things they are writing will likely never make it in an official ES* spec either.

Technologies that have competing spec / community driven development have a history of failing; take: Flash, SilverLight, CoffeeScript, the list goes on. If you have a large code base, picking TypeScript is something your going to be living with for a long time. I can take a bet in 3 years JavaScript will still be around without a doubt.

Its also worth noting that they have built some things like module system and as soon as the spec came out they ditched it and started using that. Have fun updating!

@dmvaldman
dmvaldman / promisesEM.md
Last active November 3, 2021 08:54
Promises as EventEmitters

Promises as EventEmitters

I was trying to understand JavaScript Promises by using various libraries (bluebird, when, Q) and other async approaches.

I read the spec, some blog posts, and looked through some code. I learned how to

@gokulkrishh
gokulkrishh / media-query.css
Last active May 5, 2024 08:25
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
/* CSS */
@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) {
@stkent
stkent / android_studio_shortcuts.md
Last active November 1, 2023 11:58
Android Studio Shortcuts (Mac)

Android Studio Shortcuts (Mac)

Notes:

  • Two of the most useful shortcuts utilize the Fn (function) keys. It is therefore recommended that you enable the "Use all F1, F2, etc. keys as standard function keys" option [System Preferences > Keyboard].
  • Be sure to enable the Mac OS X 10.5+ keymap in Android Studio [Preferences > Keymap].
  • A fairly complete shortcut list can be found here.

Useful symbols:

@soheilhy
soheilhy / nginxproxy.md
Last active March 22, 2024 08:54
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers