Skip to content

Instantly share code, notes, and snippets.

Avatar
💻
null !== undefined but null == undefined ¯\_(ツ)_/¯

Leo Lanese leolanese

💻
null !== undefined but null == undefined ¯\_(ツ)_/¯
View GitHub Profile
@leolanese
leolanese / removeUrlParameter.js
Created Apr 10, 2020
Remove url parameter from url path using fallback for IE and legacy browsers
View removeUrlParameter.js
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 Apr 10, 2020
Functional Programming: Object Composition
View FE-Object-Composition.txt
// 1
```javascript
function sum(a) {
return function(b) {
return function(c) {
return a + b + c;
};
};
}
```
View wait-async-nested-promises.js
// - 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')
View create-new-git
-- 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
View gist:3f1234fa5948b51c997361a2331b7bbe
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 Dec 11, 2018
GIT SQUASHING (another branch):
View GIT_squashing
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 Nov 29, 2021
The introduction to Reactive Programming you've been missing
View introrx.md
@leolanese
leolanese / lynx_install
Created Mar 13, 2014
Lynx on Maverick
View lynx_install
##
## 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