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 / mocha-guide-to-testing.js
Created April 11, 2018 08:10 — forked from samwize/mocha-guide-to-testing.js
Explain Mocha's testing framework - describe(), it() and before()/etc hooks
// # Mocha Guide to Testing
// Objective is to explain describe(), it(), and before()/etc hooks
// 1. `describe()` is merely for grouping, which you can nest as deep
// 2. `it()` is a test case
// 3. `before()`, `beforeEach()`, `after()`, `afterEach()` are hooks to run
// before/after first/each it() or describe().
//
// Which means, `before()` is run before first it()/describe()
@robophil
robophil / magento_url_rewrite.patch
Created April 8, 2018 08:02 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
@robophil
robophil / promisesEM.md
Created January 18, 2018 10:14 — forked from dmvaldman/promisesEM.md
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

@robophil
robophil / NERDTree.mkd
Created November 22, 2017 13:35 — forked from m3nd3s/NERDTree.mkd
My Vim Cheat Sheet

NERDTree

o.......Open files, directories and bookmarks....................|NERDTree-o|
go......Open selected file, but leave cursor in the NERDTree.....|NERDTree-go|
t.......Open selected node/bookmark in a new tab.................|NERDTree-t|
T.......Same as 't' but keep the focus on the current tab........|NERDTree-T|
i.......Open selected file in a split window.....................|NERDTree-i|
gi......Same as i, but leave the cursor on the NERDTree..........|NERDTree-gi|
s.......Open selected file in a new vsplit.......................|NERDTree-s|
gs......Same as s, but leave the cursor on the NERDTree..........|NERDTree-gs|

O.......Recursively open the selected directory..................|NERDTree-O|

@robophil
robophil / gist:b3be8492a423db2af6f034b708a1e7fe
Created September 29, 2017 09:11 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@robophil
robophil / install-elastic-1.5.2-basic-auth
Created June 7, 2017 14:43 — forked from phamquick/install-elastic-1.5.2-basic-auth
Install ElasticSearch 1.5.2 + Basic Auth on Centos 6.x Server
sudo su
yum update -y
#*************** INSTALL JAVA JDK 8*********************#
yum install java-1.8.0-openjdk -y
#*************** INSTALL ELASTICSEARCH 1.5.2 + RECOMMENDED PLUGINS *********************#
wget https://download.elastic.co/elasticsearch/elasticsearch/elasticsearch-1.5.2.noarch.rpm
yum install elasticsearch-1.5.2.noarch.rpm -y
rm -f elasticsearch-1.5.2.noarch.rpm
@robophil
robophil / installvagrant
Created June 2, 2017 15:17 — forked from rrgrs/installvagrant
installs brew, virtualbox, and vagrant in osx
if ! type "brew" > /dev/null; then
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
fi
brew tap phinze/homebrew-cask && brew install brew-cask;
brew cask install vagrant;
brew cask install virtualbox;
@robophil
robophil / env-examples.md
Created April 20, 2017 14:46 — forked from ericelliott/env-examples.md
env-examples

Most configuration really isn't about the app -- it's about where the app runs, what keys it needs to communicate with third party API's, the db password and username, etc... They're just deployment details -- and there are lots of tools to help manage environment variables -- not the least handy being a simple .env file with all your settings. Simply source the appropriate env before you launch the app in the given env (you could make it part of a launch script, for instance).

env files look like this:

SOMEVAR="somevalue"
ANOTHERVAR="anothervalue"

To source it:

$ source dev.env # or staging.env, or production.env, depending on where you're deploying to

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