Skip to content

Instantly share code, notes, and snippets.

View mornir's full-sized avatar
🎮
Gaming

Jérôme Pott mornir

🎮
Gaming
View GitHub Profile
@mornir
mornir / gist:9d495b2b0b15df45ae6c654ac5e35099
Created February 15, 2018 18:16 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@mornir
mornir / elasticsearch.md
Created February 17, 2018 17:12
Connecting bonsai to Google Sheet
  1. Go the 'Access' tab in the bonsai dashboard
  2. Host field = the url in that tab
  3. Port = 443
  4. Check box SSL
  5. Username = access key (in that tab)
  6. Password = secret key (in that tab)
@mornir
mornir / caching_strategies.md
Last active April 5, 2018 16:34
Caching Strategies

Cache with Network Fallback

Fist try to access then cache, if it fails reach for the network.

Cache only

Only access the cache... usually not a good strategy

Network only

Only access the network... usually not a good strategy but can be useful for assets that never changes

Network with Cache Fallback

@mornir
mornir / firebase_array.js
Created February 22, 2018 20:39
firebase array
const dataArray = Object.keys(data).map(id => ({
id,
...data[id],
}))
@mornir
mornir / reduce.js
Created February 28, 2018 19:51
Use_Cases for reduce
const javDetails = detailsList.reduce((acc, detail) => {
let key = detail.childNodes[0].textContent
let value = detail.childNodes[1].textContent
return { ...acc, [key]: value }
}, {})
@mornir
mornir / sorting_array_objects.js
Created March 13, 2018 07:58
sorting array of objects
function sortListBy(Parameter, List) {
return List.sort((a, b) => {
if (a[Parameter] > b[Parameter]) {
return 1
} else {
return -1
}
})
}
@mornir
mornir / fetch_get.js
Created March 14, 2018 20:50
Passing parameters to fetch when making fetch requests
const params = { a: 'foo', b: 'bar' };
const urlParams = new URLSearchParams(Object.entries(params));
fetch('/some/url?' + urlParams);

background-color: #f5f5f5 nice to the eyes nice yellow : #ffc600 or #ffc40e nice gray: #222;

@mornir
mornir / path.md
Created April 5, 2018 16:47
Absolute path vs Relative path

absolut path: /images/flower.png relative path: ./images/flower.png (or images/flower.png) or ../../images/flower.png