Skip to content

Instantly share code, notes, and snippets.

View zzarcon's full-sized avatar
🦍
Generating legacy code

Hector Zarco zzarcon

🦍
Generating legacy code
View GitHub Profile
[...elements].forEach(a => console.log(a.getAttribute('href')))
Array.from(elements).forEach(a => console.log(a.getAttribute('href')))
@zzarcon
zzarcon / jquery_each.js
Created April 25, 2016 17:46
jquery each
$(elements).each((index, a) => console.log(a.getAttribute('href')));
@zzarcon
zzarcon / slice.js
Created April 25, 2016 17:42
slice
Array.prototype.slice.call(elements, 0)
//Or
[].slice.call(elements, 0)
@zzarcon
zzarcon / elements.html
Created April 25, 2016 17:35
elements
<a href="www.medium.com">Medium</a>
<a href="www.google.com">Google</a>
<a href="www.github.com">github</a>
@zzarcon
zzarcon / query.js
Created April 25, 2016 17:32
Query selector all
const elements = document.querySelectorAll('a')
elements.forEach(a => console.log(a.getAttribute('href')))
server.post('/users', (request, db) => {
let id = request.body.user.id;
let user = db.create(User, {id: id, firstName: '...'});
let user = UserFactory({id: id, firstName: '...'});
db.insert(User, user);
});
@zzarcon
zzarcon / gh.js
Created April 4, 2016 21:26
gh-emoji async
import {parse} from 'gh-emoji';
async function() {
const result = await parse('hi :alien:');
console.log(result === 'hi <img src=".......');
}
//: Playground - noun: a place where people can play
import UIKit
let searchText = "Hector"
let property = "name"
let nameList : [Dictionary<String,String>] = [
["name": "Alex", "lastName": "Manzella"],
["name": "Hector", "lastName": "Zarco"],
@zzarcon
zzarcon / request.js
Created March 20, 2016 20:28
xhr promises
function xhrPromise() {
return new Promise(function(resolve, eject) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = onready;
xhr.open("GET", "https://api.github.com/users/zzarcon");
xhr.send();
function onready() {
if (xhr.readyState == 4 && xhr.status == 200) {