This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <nan.h> | |
using namespace v8; | |
void IsPalindrome(const FunctionCallbackInfo<Value>& info) { | |
Nan::Utf8String arg0(info[0]); | |
char *str = *arg0; | |
size_t len = arg0.length(); | |
int half = len / 2; | |
int start = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var xhr = new XMLHttpRequest(); | |
xhr.onreadystatechange = callback; | |
xhr.open("GET", "https://api.github.com/users/zzarcon"); | |
xhr.send(); | |
function callback() { | |
if (xhr.readyState == 4 && xhr.status == 200) { | |
var json = JSON.parse(xhr.responseText); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.get('https://api.github.com/users/zzarcon', callback); | |
function callback(user) { | |
console.log(user.name) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//: 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"], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {parse} from 'gh-emoji'; | |
async function() { | |
const result = await parse('hi :alien:'); | |
console.log(result === 'hi <img src=".......'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const elements = document.querySelectorAll('a') | |
elements.forEach(a => console.log(a.getAttribute('href'))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="www.medium.com">Medium</a> | |
<a href="www.google.com">Google</a> | |
<a href="www.github.com">github</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.slice.call(elements, 0) | |
//Or | |
[].slice.call(elements, 0) |