Sunday, March 5, 2023

using .map() to iterate and modify objects in array

 const myUsers = [

    { name: 'shark', likes: 'ocean' },
    { name: 'turtle', likes: 'pond' },
    { name: 'otter', likes: 'fish biscuits' }
]

const usersByLikes = myUsers.map(item => {
    const container = {};

    container[item.name] = item.likes;
    container.age = item.name.length * 10;

    return container;
})

console.log(usersByLikes);

Source: https://www.digitalocean.com/community/tutorials/4-uses-of-javascripts-arraymap-you-should-know 

Saturday, September 21, 2019

The world's full of lonely people afraid to make the first move. - Tony Lip. Green Book (2018)

Monday, November 26, 2018

Do not remain nameless to yourself - it is too sad a way to be. Know your place in the world and evaluate yourself fairly, not in terms of the naive ideals of your own youth, nor in terms of what you erroneously imagine your teacher's ideals are. - Richard Feynman
Perfectly Reasonable Deviations from the Beaten Track: The Letters of Richard P. Feynman (2005)

Sunday, May 27, 2018

Headless Pi setup

Model used: Raspberry Pi 3 Model B.

1. Install Raspbian onto a micro SD card using etcher. (https://etcher.io/)
2. After installing, create a file in the boot directory, name it ssh.
3. Create another file in the boot directory, name it wpa_supplicant.conf. Within this file, insert the following text, using your ssid and password for your wifi network.

country=AU
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="your_real_wifi_ssid"
    scan_ssid=1
    psk="your_real_password"
    key_mgmt=WPA-PSK
}

4. Turn on the Raspberry Pi.
5. Find out the IP Address of the Raspberry Pi, either by using your router's web interface, or installing a program such as Wireless Network Watcher (http://www.nirsoft.net/utils/wireless_network_watcher.html). 
6. Download Putty from https://www.putty.org/
7. Run Putty, and type in the IP Address where it says Host Name. Click Open
8. The terminal of the Raspberry Pi will open. The default username is pi, and the default password is raspberry. You now have headless access to the Raspberry Pi.

Sources:
https://www.raspberrypi.org/forums/viewtopic.php?t=191252
https://www.howtogeek.com/204057/how-to-see-who%E2%80%99s-connected-to-your-wi-fi-network/

Tuesday, December 26, 2017

Unity: checking errors

If you cannot build to a mobile device for some reason, it may be due to a compiler error. To check, open the console window, click the bottom on the top right corner and 'open editor log'. This will contain detailed information as to why the project could not build.

Friday, December 22, 2017

Unity: Access child of a gameobject

GameObject ChildGameObject = ParentGameObject.transform.GetChild(i).gameObject;

where i is the index of the child transform.