Skip to content

Instantly share code, notes, and snippets.

View nathandem's full-sized avatar

Nathan de Maestri nathandem

View GitHub Profile
@awachat
awachat / linkedin-v2-oauth2.py
Last active August 12, 2021 19:17
Linkedin client to get firstName, lastName, profilePicture, emailAddress from OAuth2.0 access token using Linkedin 2.0 APIs
class LinkedinClient(object):
"""
Usage:
client = LinkedinClient(access_token)
user_details = client.get_user_details()
"""
FIELD_SELECTORS = ['id', 'firstName', 'lastName',
'profilePicture(displayImage~:playableStreams)',
'emailAddress']
@zaydek-old
zaydek-old / bookmark.min.js
Last active May 28, 2024 19:18
A *simple* CSS debugger. To use, bookmark "Debug CSS" at https://zaydek.github.io/debug.css. Learn more here https://medium.freecodecamp.org/88529aa5a6a3 and https://youtu.be/2QdzahteCCs?t=1m25s (starts at 1:25)
/* debug.css | MIT License | zaydek.github.com/debug.css */ if (!("is_debugging" in window)) { is_debugging = false; var debug_el = document.createElement("style"); debug_el.append(document.createTextNode(`*:not(g):not(path) { color: hsla(210, 100%, 100%, 0.9) !important; background: hsla(210, 100%, 50%, 0.5) !important; outline: solid 0.25rem hsla(210, 100%, 100%, 0.5) !important; box-shadow: none !important; filter: none !important; }`)); } function enable_debugger() { if (!is_debugging) { document.head.appendChild(debug_el); is_debugging = true; } } function disable_debugger() { if (is_debugging) { document.head.removeChild(debug_el); is_debugging = false; } } !is_debugging ? enable_debugger() : disable_debugger();
@pikhovkin
pikhovkin / weasyprint_complex_headers.py
Last active September 12, 2024 18:45
Repeat on each page of complex headers (eg, tables) except the first page
# coding: utf-8
from weasyprint import HTML, CSS
def get_page_body(boxes):
for box in boxes:
if box.element_tag == 'body':
return box