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 / 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
[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]][([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]](([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+([![]]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+(![]+[
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)
/**
* 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;
}
/**
* Uses a map for keeping track of access and set operations.
*/
_registerAccess(propertyName: string, isDefined: boolean): void {
let register = {
count: 0,
called: false,
isDefined
};
it('#intercept overrides method calls', () => {
const spy = new Spy();
const mock = spy.watch(originalObject);
mock.testMethod();
assert.equal(spy.get('testMethod').called, true);
});
const originalObject = {
testMethod: () => {}
};
it('#spy intercepts property gets', () => {
const spy = new Spy();
const mock = spy.watch(originalObject);
const triggerSetAccess = mock.test;
assert.equal(spy.get('test').called, true);
/**
* 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);
...