Skip to content

Instantly share code, notes, and snippets.

View tomasperezv's full-sized avatar
🤖
Focusing

Tomás Pérez tomasperezv

🤖
Focusing
View GitHub Profile
@tomasperezv
tomasperezv / README.md
Last active July 29, 2023 08:09
code-test-github

Task: GitHub User Analytics tool

Objective:

Develop a Frontend application that allows user to search for a GitHub user by username and view info about the user and their public repos.

Key Features:

  • Search Functionality: Users should be able to search for GitHub users using usernames. GET https://api.github.com/search/users?q=octocat
@tomasperezv
tomasperezv / gist:5175807
Created March 16, 2013 10:14
Example of listening to local storage changes
if (window.addEventListener) {
window.addEventListener("storage", onStorage, false);
} else {
window.attachEvent("onstorage", onStorage);
};
var onStorage = function(data) {
// Receive changes in the localStorage
}
c => change
d => delete
y => yank
s => deletes the character under the cursor and then enters Insert mode
i => inside
a => around
t => till a character
f => till a character (including character)
@tomasperezv
tomasperezv / gist:5175824
Last active June 12, 2018 21:15
Communication between multiple tabs, using local storage changes
// User has 2 tabs open: Page 1 and Page 2, both in the same domain
// , subdomain and protocotol
// Page1: https://subdomain.domain.com
...
var data = {
a: 5,
// Local storage won't be triggered unless the value is different,
// so we add a random identifier.
id: Math.floor((Math.random()*1000)+1)
@tomasperezv
tomasperezv / linkedin-query.py
Created March 29, 2018 19:59 — forked from rvanbruggen/linkedin-query.py
Python script to query your LinkedIn network and get all your network's connections and their interconnections.
#!/usr/bin/env python
# encoding: utf-8
"""
linkedin-query.py
Created by Thomas Cabrol on 2012-12-03.
Customised by Rik Van Bruggen
Copyright (c) 2012 dataiku. All rights reserved.
Building the LinkedIn Graph
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[
/**
* Access to the spy map to assert accesses over properties and methods.
*/
getPropertyRegister(propertyName: string): Object|null {
const register = this._spyMap.get(propertyName);
return typeof register !== 'undefined' ? register : null;
}
/**
* Returning true for letting the property value assignment to succeed.
*/
set(obj: Object, key: string): boolean {
self._registerAccess(key, typeof target[key] !== 'undefined');
return true;
}
/**
* Registering the acccess to method calls inside of the callback to avoid race
* conditions.
*/
get(obj: Object, key: string): Object {
...
if (typeof originalValue === 'function') {
result = () => {
_registerAccess(key);
...
/**
* Using Reflect for reading the property value without triggering a recursive call.
*/
get(obj: Object, key: string): Object {
const originalValue = Reflect.get(target, key);
...
}