Skip to content

Instantly share code, notes, and snippets.

View MirceaUngureanu's full-sized avatar
☀️

Mircea Ungureanu MirceaUngureanu

☀️
  • Manchester, UK
View GitHub Profile

There are certain files created by particular editors, IDEs, operating systems, etc., that do not belong in a repository. But adding system-specific files to the repo's .gitignore is considered a poor practice. This file should only exclude files and directories that are a part of the package that should not be versioned (such as the node_modules directory) as well as files that are generated (and regenerated) as artifacts of a build process.

All other files should be in your own global gitignore file. Create a file called .gitignore in your home directory and add anything you want to ignore. You then need to tell git where your global gitignore file is.

Mac

git config --global core.excludesfile ~/.gitignore

Windows

git config --global core.excludesfile %USERPROFILE%\.gitignore

Create a new repository on the command line

echo "# glare-loading-animation" >> README.md

git init

git add README.md

git commit -m "first commit"

@MirceaUngureanu
MirceaUngureanu / event-loop.md
Created November 26, 2018 09:50 — forked from jesstelford/event-loop.md
What is the JS Event Loop and Call Stack?

Regular Event Loop

This shows the execution order given JavaScript's Call Stack, Event Loop, and any asynchronous APIs provided in the JS execution environment (in this example; Web APIs in a Browser environment)


Given the code

@MirceaUngureanu
MirceaUngureanu / cities.json
Created November 21, 2018 10:42 — forked from Miserlou/cities.json
1000 Largest US Cities By Population With Geographic Coordinates, in JSON
[
{
"city": "New York",
"growth_from_2000_to_2013": "4.8%",
"latitude": 40.7127837,
"longitude": -74.0059413,
"population": "8405837",
"rank": "1",
"state": "New York"
},
@MirceaUngureanu
MirceaUngureanu / XMLHttpRequest.js
Last active November 19, 2018 09:19
XMLHttpRequest functions
// GET
function getData(url, headerData) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function() {
// only run if request is complete i.e. 4 == done
if (xhr.readyState !== 4) return;
if (xhr.status == 200) {
console.log('success', JSON.parse(xhr.responseText));
} else {
console.log('error', xhr);
@MirceaUngureanu
MirceaUngureanu / short_reset.css
Last active November 15, 2018 15:35
My custom short CSS reset
/*resets*/
.main-wrapper {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
-webkit-box-sizing: border-box;
box-sizing: border-box;
@MirceaUngureanu
MirceaUngureanu / XMLHttpRequest-send-override.js
Created November 15, 2018 11:42
Add custom functionality to stock XMLHttpRequest.prototype.send or use as a vanilla JS alternative to jQuery ajaxSend()
(function(originalSend){
XMLHttpRequest.prototype.send = function (data) {
// your custom code here
originalSend.call(this, data);
};
})(XMLHttpRequest.prototype.send);
* {
background: #000 !important;
color: #0f0 !important;
outline: solid #f00 1px !important;
}