Skip to content

Instantly share code, notes, and snippets.

View mfaridzia's full-sized avatar
📒
storyteller

Muhammad Farid Zia mfaridzia

📒
storyteller
View GitHub Profile
@jvns
jvns / interview-questions.md
Last active May 14, 2024 18:47
A list of questions you could ask while interviewing

A lot of these are outright stolen from Edward O'Campo-Gooding's list of questions. I really like his list.

I'm having some trouble paring this down to a manageable list of questions -- I realistically want to know all of these things before starting to work at a company, but it's a lot to ask all at once. My current game plan is to pick 6 before an interview and ask those.

I'd love comments and suggestions about any of these.

I've found questions like "do you have smart people? Can I learn a lot at your company?" to be basically totally useless -- everybody will say "yeah, definitely!" and it's hard to learn anything from them. So I'm trying to make all of these questions pretty concrete -- if a team doesn't have an issue tracker, they don't have an issue tracker.

I'm also mostly not asking about principles, but the way things are -- not "do you think code review is important?", but "Does all code get reviewed?".

@soheilhy
soheilhy / nginxproxy.md
Last active May 16, 2024 08:59
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

@AugustMiller
AugustMiller / map.js
Last active October 2, 2021 14:14
Map a number in one range to a number in another.
function mapNumber (number, inMin, inMax, outMin, outMax) {
return (number - inMin) * (outMax - outMin) / (inMax - inMin) + outMin;
}
@staltz
staltz / introrx.md
Last active May 30, 2024 18:43
The introduction to Reactive Programming you've been missing
@basham
basham / css-units-best-practices.md
Last active June 1, 2024 09:05
CSS Units Best Practices

CSS units

Recommendations of unit types per media type:

Media Recommended Occasional use Infrequent use Not recommended
Screen em, rem, % px ch, ex, vw, vh, vmin, vmax cm, mm, in, pt, pc
Print em, rem, % cm, mm, in, pt, pc ch, ex px, vw, vh, vmin, vmax

Relative units

Relative units

@unscriptable
unscriptable / ambiguous-race.js
Last active September 25, 2019 13:20 — forked from briancavalier/ambiguous-race.js
Promise.race is a lie
// This is the function we will use to call Promise.race().
// logWinner is simply a function that races two promises
// and logs the "winner" of the race as a side effect.
function logWinner (p1, p2) {
Promise.race([p1, p2]).then(console.log.bind(console));
}
// Here are 2 promises, p1 and p2. p2 always resolves
// first, since p1 resolves in 20 ms, and p2 resolves
// in 10 ms. By any reasonable definition of "race",
@mrtns
mrtns / gist:78d15e3263b2f6a231fe
Last active May 19, 2024 06:53
Upgrade Chrome from Command Line on Ubuntu
# Install
# via http://askubuntu.com/questions/510056/how-to-install-google-chrome
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
# Update
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 31, 2024 07:07
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@deanhume
deanhume / service-worker-register.js
Last active August 25, 2019 01:32
Register a Service Worker
<script>
// Register the service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/service-worker.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}).catch(function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
@benwells
benwells / reduce-example.js
Created May 12, 2016 13:40
Using Array.reduce to sum a property in an array of objects
var accounts = [
{ name: 'James Brown', msgCount: 123 },
{ name: 'Stevie Wonder', msgCount: 22 },
{ name: 'Sly Stone', msgCount: 16 },
{ name: 'Otis Redding', msgCount: 300 } // Otis has the most messages
];
// get sum of msgCount prop across all objects in array
var msgTotal = accounts.reduce(function(prev, cur) {
return prev + cur.msgCount;