- Copy by reference vs copy by value Strings and numbers are passed by value. Arrays and objects are passed by reference. -- Example
// Nums
> a = 0
0
I checked mail delivery from 3 servers to google. All mail is from [email protected]
gmail with outbound server set as zoho delivered in 0 seconds. gmail to gmail with from set to zoho
Message ID <CABaOn_z82JMJsDX62fTQ0vG76HPVTn60iVEDxD1GCzEQVy0foA@mail.gmail.com>
Created at: Mon, Nov 4, 2019 at 12:17 PM (Delivered after 0 seconds)
From: Kaustav Haldar <[email protected]>
To: Kaustav haldar <[email protected]>
/** | |
* Returns a normal iterable array from an array with -ve numbers, padding any missing elements with the provided filler | |
* Use case - algo problems where we move in 2d space to -ve numbered places in an arr or matrix | |
* @param {Array} obj An array containing -ve numbers as indices, behaves like an object at times | |
* @param {*} filler Filler material to populate missing members e.g. array or string | |
* @param {Number} maxPos maximum positive value of a key in array | |
* @param {Number} maxNeg max -ve value of a key in the incoming array | |
* @returns {Array} Sorted array | |
*/ | |
function _objToArr(obj, filler, maxPos, maxNeg) { |
// cd to the dir// or open a iterm window - rclick , new console/iterm2 | |
// > node | |
let arr = fs.readdirSync('.'), dupcheck = [], outarr = [], | |
add = a => a[0] + a[1]; | |
arr.forEach(i => { | |
if (i.split(' ').length > 1) { | |
if (dupcheck.indexOf(add(i.split(' '))) !== -1) { | |
outarr.push(i.split(' ')); | |
} |
// Get a list of all the names of all the projects on a github org page | |
s = []; | |
document.querySelectorAll('.col-12').forEach(e => {x = e.firstChild.nextSibling.firstChild.nextSibling.innerText; s.push(x.replace(' Private', ''))}); | |
// Break the list into lines to easily copy paste into a spreadsheet | |
s.forEach(e => console.log(e)); |
document.querySelector('video').playbackRate = 1.5
Videos on any page using a video tag. Youtube, vimeo etc
(Right click/2 finger click on mac -> inspect element); on the video to reveal the <video></video>
tag, otherwise you might get a var v = document.querySelector('video'); var t = prompt('Set the playback rate'); v.playbackRate = parseFloat(t)
err.
Paste this into the console (go to console from the window that pops up from inspect element or cmd + option + i
):
0xB64762d24e24a27468ab09aA0D19244a2832e893 |
Pre-setup:
Setup:
git clone https://github.com/kaustavha/learn_eth.git && cd learn_eth && npm install
npm install -g truffle ethereumjs-testrpc && mkdir pet-shop-tutorial && cd pet-shop-tutorial && truffle unbox pet-shop
Links:
0xB64762d24e24a27468ab09aA0D19244a2832e893 |