Skip to content

Instantly share code, notes, and snippets.

Hector Lorenzo hectorlorenzo

Block or report user

Report or block hectorlorenzo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@hectorlorenzo
hectorlorenzo / aocd3.js
Created Dec 4, 2017
Solution to Advent of Code 3
View aocd3.js
function sum (x) {
var sum = 0;
while(x > 0) {
sum = sum + x;
x--;
}
return sum;
}
@hectorlorenzo
hectorlorenzo / aocd1.js
Created Dec 1, 2017
Advent of code day 1
View aocd1.js
function sumConsecutive (number) {
var arrayOfNumbers = number.split('')
var sum = 0
var currentNumber = null
var nextNumber = null
var arrayLength = arrayOfNumbers.length
for (var i = arrayLength - 1; i >= 0; i--) {
currentNumber = arrayOfNumbers[i]
View medium-vue-custom-elements-6.js
const elemClass = class extends HTMLElement {
constructor() {
super()
}
static get observedAttributes () {
return Object.keys(this.options.data)
}
}
View medium-vue-custom-elements-5.js
const elemClass = class extends HTMLElement {
constructor() {
super()
}
attributeChangedCallback (name, oldValue, newValue) {
const o = this
const options = o.options
options.watch[name].call(o, oldValue, newValue)
}
View medium-vue-custom-elements-4.js
const elemClass = class extends HTMLElement {
constructor() {
super()
}
connectedCallback () {
const o = this
const data = o.options.data
Object.keys(data).forEach((key) => {
Object.defineProperty(o, key, {
View medium-vue-custom-elements-3.js
const customHeading = document.createElement('custom-heading')
document.body.appendChild(customHeading)
View medium-vue-custom-elements-2.js
Vue.component('my-component', {
template: '<div>A custom component!</div>'
})
View medium-vue-custom-elements-1.js
class CustomHeading extends HTMLElement {
constructor () {}
}
customElements.define('custom-heading', CustomHeading)
@hectorlorenzo
hectorlorenzo / Main.md
Last active Feb 6, 2020
Learning React when coming from Vue
View Main.md

Learning React the Vue way

componentDidMount

Part of the component lifecycle, similar to created/mounted.

componentWillUnmount

Part of the component lifecycle, similar to destroyed

View vuejs_2_1.js
import initMixin from './internal/init'
/* ... */
function Vue (options) {
this._init(options)
}
/* ... */
You can’t perform that action at this time.