Skip to content

Instantly share code, notes, and snippets.

View gil00pita's full-sized avatar
💭
I may be slow to respond.

Gil Álvaro gil00pita

💭
I may be slow to respond.
View GitHub Profile
@gil00pita
gil00pita / cloudSettings
Last active February 5, 2021 20:48
Mac Home
{"lastUpload":"2021-02-05T20:48:30.504Z","extensionVersion":"v3.4.3"}
const array = [
[ 'one', 1 ],
[ 'two', 2 ]
];
Object.fromEntries(array);
// { one: 1, two: 2 }
<template>
<div>
<h1 class="title">Student Averages</h1>
<table>
<thead>
<tr>
<th>Name</th>
<th>Score</th>
<th>Grade</th>
<th>Teachers</th>
<template>
<section class="container">
<Sites v-bind="sites" />
<Scores v-bind="scores" />
</section>
</template>
<script>
import Scores from '~/components/Scores.vue'
import Sites from '~/components/Sites.vue'

Fire up a terminal.

  1. [IMPORTANT] sudo cp /etc/fstab /etc/fstab.old - Create a backup of the fstab file just in case something unwanted happens.
  2. sudo blkid - Note the UUID of the partition you want to automount.
  3. sudo nano /etc/fstab - Copy the following line to the end of the file, save it and reboot afterwards to check if it worked.
  4. mkdir /my/path/tomount # to quote : "you must create the mount point before you mount the partition." see https://help.ubuntu.com/community/Fstab

Examples

A common setup is:

@gil00pita
gil00pita / class_properties.jsx
Last active February 8, 2019 23:17 — forked from gisderdube/class_properties.jsx
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a ### Class properties & binding Binding functions in JavaScript is a common task. With the introduction of arrow functions in the ES6 spec, we now have
class Counter extends React.Component {
constructor(props) {
super(props)
this.state = { count: 0 }
}
render() {
return(
<div>
<h1>{this.state.count}</h1>
@gil00pita
gil00pita / default.js
Last active February 8, 2019 23:15 — forked from gisderdube/default.js
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a ### Destructuring & default values Let’s return to our previous example where we do the following: ``` const result = axios.get(`https://ironhack-pok
function calculate({operands = [1, 2], type = 'addition'} = {}) {
return operands.reduce((acc, val) => {
switch(type) {
case 'addition':
return acc + val
case 'subtraction':
return acc - val
case 'multiplication':
return acc * val
case 'division':
@gil00pita
gil00pita / async_promise_all.js
Last active February 8, 2019 23:14 — forked from gisderdube/async_promise_all.js
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a Promise.all What if you want to fetch all of the Pokemon in parallel? Since you can await all of Promises, simply use Promise.all :
import axios from 'axios'
let myData = [{id: 0}, {id: 1}, {id: 2}, {id: 3}]
async function fetchData(dataSet) {
const pokemonPromises = dataSet.map(entry => {
return axios.get(`https://ironhack-pokeapi.herokuapp.com/pokemon/${entry.id}`)
})
const results = await Promise.all(pokemonPromises)
@gil00pita
gil00pita / forOf.js
Last active February 8, 2019 23:13 — forked from gisderdube/forOf.js
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a Often times, it is necessary to fetch multiple datasets and do something for each of those or complete a task after all of the async calls have returned
import axios from 'axios'
let myData = [{id: 0}, {id: 1}, {id: 2}, {id: 3}]
async function fetchData(dataSet) {
for(entry of dataSet) {
const result = await axios.get(`https://ironhack-pokeapi.herokuapp.com/pokemon/${entry.id}`)
const newData = result.data
updateData(newData)
@gil00pita
gil00pita / async.js
Last active February 8, 2019 23:12 — forked from gisderdube/async.js
https://levelup.gitconnected.com/9-tricks-for-kickass-javascript-developers-in-2019-eb01dd3def2a If you’re still stuck in callback hell, 2014 wants its code back. Just don’t use callbacks, unless it is absolutely necessary, for example required by a
async function getData() {
const result = await axios.get('https://dube.io/service/ping')
const data = result.data
console.log('data', data)
return data
}
getData()