Skip to content

Instantly share code, notes, and snippets.

Peter Hudec peterhudec

View GitHub Profile
View deepMerge.js
var R = require('ramda')
var one = {
test: {
a: 1,
b: 2
},
pemento: "sipi",
arr: ['a', 'b']
}
@paulirish
paulirish / what-forces-layout.md
Last active Jul 9, 2020
What forces layout/reflow. The comprehensive list.
View what-forces-layout.md

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
View Authomatic and Flask-Login
@app.route('/login/<provider_name>', methods=['GET', 'POST'])
@authomatic.login('g')
@requires_ssl
def login(provider_name):
if g.user is not None and g.user.is_authenticated():
return redirect(url_for('index'))
if authomatic.result:
if authomatic.result.error:
return 'Something went wrong: {0}'.format(authomatic.result.error.message)
if authomatic.result.user:
@staltz
staltz / introrx.md
Last active Jul 9, 2020
The introduction to Reactive Programming you've been missing
View introrx.md
@alonho
alonho / flask_pdb.py
Created Dec 27, 2012
Flask: drop into pdb on exception
View flask_pdb.py
def drop_into_pdb(app, exception):
import sys
import pdb
import traceback
traceback.print_exc()
pdb.post_mortem(sys.exc_info()[2])
# somewhere in your code (probably if DEBUG is True)
flask.got_request_exception.connect(drop_into_pdb)
@datagrok
datagrok / gist:2199506
Last active Jan 7, 2020
Virtualenv's `bin/activate` is Doing It Wrong
View gist:2199506
@lucasfais
lucasfais / gist:1207002
Created Sep 9, 2011
Sublime Text 2 - Useful Shortcuts
View gist:1207002

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@clintel
clintel / gist:1155906
Created Aug 19, 2011
Fenced code in bullet lists with GitHub-flavoured MarkDown??
View gist:1155906

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created Jan 23, 2011
Sphinx documentation to github gh-pages without submodules
View sphinx_to_github.sh
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
You can’t perform that action at this time.