Skip to content

Instantly share code, notes, and snippets.

View pedroteixeira's full-sized avatar

Pedro Henriques dos Santos Teixeira pedroteixeira

View GitHub Profile
@koriaf
koriaf / auth.py
Created April 30, 2017 15:34
django-oidc-provider and DRF example
"""
NOT PRODUCTION READY
Usage:
REST_FRAMEWORK = {
...
'DEFAULT_AUTHENTICATION_CLASSES': (
....
'ibr.users.accounts_api_v0.auth.OidcOauth2Auth'
var str = 'class ಠ_ಠ extends Array {constructor(j = "a", ...c) {const q = (({u: e}) => {return { [`s${c}`]: Symbol(j) };})({});super(j, q, ...c);}}' +
'new Promise((f) => {const a = function* (){return "\u{20BB7}".match(/./u)[0].length === 2 || true;};for (let vre of a()) {' +
'const [uw, as, he, re] = [new Set(), new WeakSet(), new Map(), new WeakMap()];break;}f(new Proxy({}, {get: (han, h) => h in han ? han[h] ' +
': "42".repeat(0o10)}));}).then(bi => new ಠ_ಠ(bi.rd));';
try {
eval(str);
} catch(e) {
alert('Your browser does not support ES6!')
}
@adstage-david
adstage-david / page_helpers.clj
Created September 9, 2016 21:09
Smoke Test Examples
(ns page-helpers
"All of the following page helpers take a \"page\", which is a map with
key names for named elements tied to their CSS selectors.
Page is expected to always have keys:
- :page-name (string)
- :page-id (css selector string)
- :page-url (regex to match url)
Using this as the first argument allows us to use the while-on and
within-modal macros to fill in the page in repeated series of steps (they both
@adstage-david
adstage-david / build.boot
Created September 9, 2016 20:50
Example of Visual Regression test
(require '[visual-regression :as vr])
(deftask compare-screenshots
"Run visual regression specs over the devcards."
(let [tmp (core/tmp-dir!)]
(fn [next-task]
(fn [file-set]
(vr/compare-cards "vr")
(next-task file-set)))))
@paulirish
paulirish / what-forces-layout.md
Last active May 9, 2024 07:00
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

2015-01-29 Unofficial Relay FAQ

Compilation of questions and answers about Relay from React.js Conf.

Disclaimer: I work on Relay at Facebook. Relay is a complex system on which we're iterating aggressively. I'll do my best here to provide accurate, useful answers, but the details are subject to change. I may also be wrong. Feedback and additional questions are welcome.

What is Relay?

Relay is a new framework from Facebook that provides data-fetching functionality for React applications. It was announced at React.js Conf (January 2015).

@xzyfer
xzyfer / gulpfile.js
Last active August 24, 2019 09:05
True incremental sass compilation
var production = process.env.APP_ENV === "test";
var gulp = require('gulp');
var gutil = require('gulp-util');
var sass = require('gulp-sass');
var cssmin = require('gulp-minify-css');
var prefix = require('gulp-autoprefixer');
var newer = require('gulp-newer');
var print = require('gulp-print');
var notify = require('gulp-notify');
var batch = require('gulp-batch');
@mikaelbr
mikaelbr / gulpfile.js
Last active February 8, 2021 00:32 — forked from Sigmus/gulpfile.js
Gulp + Browserify + Reactify + OS Notification
var source = require('vinyl-source-stream');
var gulp = require('gulp');
var gutil = require('gulp-util');
var browserify = require('browserify');
var reactify = require('reactify');
var watchify = require('watchify');
var notify = require("gulp-notify");
var scriptsDir = './scripts';
var buildDir = './build';
@jlongster
jlongster / a-results
Last active April 16, 2017 07:49
transducers w/immutable-js
# benchmark immutable.js with my transducers lib: https://github.com/jlongster/transducers.js
% node bench/immut.js
Immutable map/filter (1000) x 5,497 ops/sec ±2.63% (91 runs sampled)
transducer map/filter (1000) x 7,309 ops/sec ±0.73% (100 runs sampled)
Immutable map/filter (100000) x 62.73 ops/sec ±0.85% (67 runs sampled)
transducer map/filter (100000) x 80.15 ops/sec ±0.48% (71 runs sampled)
@Tvaroh
Tvaroh / TransitSvc.js
Last active June 2, 2017 19:40
transit-js bridge to immutable 3.0
define(['transit', 'immutable'], function (Transit, Imm) {
'use strict';
var reader = Transit.reader('json', {
arrayBuilder: {
init: function () { return Imm.List.of().asMutable(); },
add: function (ret, val) { return ret.push(val); },
finalize: function (ret) { return ret.asImmutable(); },
fromArray: function (arr) { return Imm.List(arr); }
},