Skip to content

Instantly share code, notes, and snippets.

View farskid's full-sized avatar
🎯
Focusing

Farzad Yousefzadeh farskid

🎯
Focusing
View GitHub Profile
@farskid
farskid / sort.js
Created January 29, 2018 22:41
Sort object keys alphabetically
function sortObjKeysAlphabetically(obj) {
return Object.keys(obj).sort((a,b) => a > b).reduce((result, key) => {
result[key] = obj[key];
return result;
}, {});
}
@farskid
farskid / memoize.js
Created July 5, 2018 12:30
Memoize functions in Javascript
function memoize(fn) {
let cache = {};
function memoizedFunc (...args) {
const hash = JSON.stringify(args);
if (cahce.hasOwnProperty(hash)) {
return cache[hash];
}
@farskid
farskid / create_github_tag.sh
Created October 16, 2018 03:49 — forked from cliffparnitzky/create_github_tag.sh
Simple way to create a tag via git shell and push it to repo
# creat a tag (more infos at: http://git-scm.com/book/de/ch2-12.html)
git tag -a 1.0.0 -m "Version 1.0.0"
git push origin 1.0.0
git tag -a 1.0.0.alpha1 -m "Version 1.0.0 alpha1"
git push origin 1.0.0.alpha1
# delete a tag
git tag -d 1.0.0
git push origin :refs/tags/1.0.0
const os = require("os");
// install this custom module!!
const babar = require("babar");
function calculateFreeMemPercentage() {
return Number(((os.freemem * 100) / os.totalmem).toFixed(2));
}
function printChart(points) {
console.log(
@farskid
farskid / pdf-viewer.js
Created November 22, 2018 12:39
PDF reader in javascript
async function pdfViewer(pdfSrc) {
let blob = await fetch(pdfSrc);
blob = fetched.blob();
const url = URL.createObjectURL(blob);
return <object data={url} type="application/pdf"></object>
}
@farskid
farskid / readme.md
Created November 27, 2018 11:02 — forked from dominictarr/readme.md
statement on event-stream compromise

Hey everyone - this is not just a one off thing, there are likely to be many other modules in your dependency trees that are now a burden to their authors. I didn't create this code for altruistic motivations, I created it for fun. I was learning, and learning is fun. I gave it away because it was easy to do so, and because sharing helps learning too. I think most of the small modules on npm were created for reasons like this. However, that was a long time ago. I've since moved on from this module and moved on from that thing too and in the process of moving on from that as well. I've written way better modules than this, the internet just hasn't fully caught up.

@broros

otherwise why would he hand over a popular package to a stranger?

If it's not fun anymore, you get literally nothing from maintaining a popular package.

One time, I was working as a dishwasher in a restu

@farskid
farskid / concurrent.js
Last active May 21, 2019 19:11
Concurrent, Parallel and Sequential operations using Javascript Promise.
async function concurrent() {
const fetchA = A.fetch();
const fetchB = B.fetch();
const responseA = await fetchA;
const responseB = await fetchB;
return {a: responseA, b: responseB};
}
@farskid
farskid / remove_tuxera.sh
Last active June 13, 2019 19:40 — forked from miguelmota/remove_tuxera.sh
Completely uninstall and remove Tuxera NTFS on MacOS (resets trial version)
sudo rm -rf /Applications/Tuxera\ Disk\ Manager.app
sudo rm -rf /Library/Application\ Support/Tuxera\ NTFS
sudo rm -rf /Library/Filesystems/fusefs_txantfs.fs
sudo rm -rf /Library/Filesystems/tuxera_ntfs.fs

I bundled these up into groups and wrote some thoughts about why I ask them!

If these helped you, I'd love to hear about it!! I'm on twitter @vcarl_ or send me an email [email protected]

Onboarding and the workplace

https://blog.vcarl.com/interview-questions-onboarding-workplace/

  • How long will it take to deploy my first change? To become productive? To understand the codebase?
  • What kind of equipment will I be provided? Will the company pay/reimburse me if I want something specific?