Skip to content

Instantly share code, notes, and snippets.

View leolanese's full-sized avatar
💻
[] === []; // false ¯\_(ツ)_/¯

Leo Lanese leolanese

💻
[] === []; // false ¯\_(ツ)_/¯
View GitHub Profile
@leolanese
leolanese / removeUrlParameter.js
Created April 10, 2020 04:36
Remove url parameter from url path using fallback for IE and legacy browsers
function removeUrlParameter(url, param) {
if (typeof URLSearchParams !== 'undefined') {
// modern browsers
var r = new URL(url);
r.searchParams.delete(param);
return r.href;
} else {
// IE version
return url.replace(new RegExp('^([^#]*\?)(([^#]*)&)?' + parameter + '(\=[^&#]*)?(&|#|$)' ), '$1$3$5').replace(/^([^#]*)((\?)&|\?(#|$))/,'$1$3$4')
}
@leolanese
leolanese / FE-Object-Composition.txt
Last active April 10, 2020 04:38
Functional Programming: Object Composition
// 1
```javascript
function sum(a) {
return function(b) {
return function(c) {
return a + b + c;
};
};
}
```
// - WAIT FOR ME! - I PROMISE.
// resolve NESTED promises waiting for inner promises
function nestedPromisesThatresolveAfter4Seconds() {
return new Promise(resolve => {
setTimeout(() => {
setTimeout(() => {
console.log('setTimeout1')
resolve('Promise resolved');
}, 4000);
console.log('setTimeout2')
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin git@github.com:<YOUR ACCOUNT>/<YOUR REPOS>.git
DELETE LOCAL BRANCH
To delete the local branch use one of the following:
$ git branch -d branch_name
$ git branch -D branch_name
-=-=-=-=-=-
DELETE REMOTE BRANCH
@leolanese
leolanese / GIT_squashing
Created December 11, 2018 14:51
GIT SQUASHING (another branch):
GIT SQUASHING (another branch):
ok, do work on branches branches … lalala
git add -A
git commit -m 'TEAM-XXX'
Switch to the master branch and make sure you are up to date:
git checkout master && git fetch && git pull
@staltz
staltz / introrx.md
Last active April 25, 2024 04:18
The introduction to Reactive Programming you've been missing
@leolanese
leolanese / lynx_install
Created March 13, 2014 09:40
Lynx on Maverick
##
## http://lynx.isc.org/
##
cd /usr/local/src
curl -O http://lynx.isc.org/lynx2.8.7/lynx2.8.7.tar.gz
tar -xzvf lynx2.8.7.tar.gz
cd lynx2-8-7
./configure --mandir=/usr/share/man
make