Skip to content

Instantly share code, notes, and snippets.

View blaenk's full-sized avatar

Jorge Israel Peña blaenk

  • Los Angeles, California
  • 22:48 (UTC -07:00)
View GitHub Profile
@alanhamlett
alanhamlett / api.py
Last active October 21, 2024 14:30
Serialize SQLAlchemy Model to dictionary (for JSON output) and update Model from dictionary attributes.
import uuid
import wtforms_json
from sqlalchemy import not_
from sqlalchemy.dialects.postgresql import UUID
from wtforms import Form
from wtforms.fields import FormField, FieldList
from wtforms.validators import Length
from flask import current_app as app
from flask import request, json, jsonify, abort
@bitemyapp
bitemyapp / gist:8739525
Last active May 7, 2021 23:22
Learning Haskell
; east asian ambiguous settings
(defun set-east-asian-ambiguous-width (width)
(cond ((= emacs-major-version 22) (set-east-asian-ambiguous-width-22 width))
((> emacs-major-version 22) (set-east-asian-ambiguous-width-23 width))))
; for emacs 22
(defun set-east-asian-ambiguous-width-22 (width)
(if (= width 2)
(utf-translate-cjk-set-unicode-range
@paulirish
paulirish / what-forces-layout.md
Last active May 8, 2025 05:49
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@tykurtz
tykurtz / grokking_to_leetcode.md
Last active May 9, 2025 04:32
Grokking the coding interview equivalent leetcode problems

GROKKING NOTES

I liked the way Grokking the coding interview organized problems into learnable patterns. However, the course is expensive and the majority of the time the problems are copy-pasted from leetcode. As the explanations on leetcode are usually just as good, the course really boils down to being a glorified curated list of leetcode problems.

So below I made a list of leetcode problems that are as close to grokking problems as possible.

Pattern: Sliding Window