This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react"; | |
const FeatureFlags = React.createContext(null); | |
export function FeatureProvider({ features = null, children }) { | |
if (features === null || typeof features !== "object") { | |
throw new TypeError("The features prop must be an object or an array."); | |
} | |
return ( | |
<FeatureFlags.Provider value={features}>{children}</FeatureFlags.Provider> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This component comes from https://github.com/tj/react-click-outside. | |
* | |
* It was copied and converted to use hooks and TypeScript | |
*/ | |
import React, { useEffect, useRef } from "react"; | |
export interface Props { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getTheThings(urls) { | |
return await Promise.all(urls.map(url => fetch(url))); | |
} | |
// usage | |
const [post, comments] = getTheThings(['/post', '/comments']); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Translate3d uses GPU acceleration for increased performance with translate fallback | |
@mixin translate-x($value) { | |
will-change: transform | |
transform: translateX($value); | |
@supports (transform: translate3d($value, 0, 0)) { | |
transform: none; | |
transform: translate3d($value, 0, 0); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* a mixin for easy generation of type styles with RTL and Breakpoint support | |
* uses x-rem: https://gist.github.com/webgefrickel/4530526 | |
* uses Bootstrap media breakpoint mixin - could swap out for your own | |
* uses RTL mixin: https://gist.github.com/loopdream/ad7b77bd4b88c68afdc74bc0ec58f34b | |
* Usage: | |
h5 { | |
@include type-factory( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin rtl() { | |
// sass-lint:disable force-attribute-nesting no-qualifying-elements | |
html[dir='rtl'] & { | |
@content; | |
} | |
// sass-lint:enable force-attribute-nesting no-qualifying-elements | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# credit: http://www.freytag.org.uk/html/web/gaehttpauth.html | |
# app engine auth handler class | |
# The script handler collects the requests for the static HTML and does the HTTP Auth. | |
# If it is OK, it reads the file off the GAE disk and sends it back. | |
# This is the same code as the rationalpie blog post, but modified for webapp2 and to include file reading: | |
# to be used in conjuction with https://gist.github.com/loopdream/7403c12109ddc8d6ca66cafe80616899 | |
""" | |
auth.py | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://www.freytag.org.uk/html/web/gaehttpauth.html | |
# app engine handlers for serving static files behind basic auth | |
- url: /your_static_dir/.*.html | |
script: auth.application | |
- url: /your_static_dir | |
static_dir: /your_static_dir | |
application_readable: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from google.appengine.api import users | |
from base import handlers | |
class RootHandler(handlers.BaseHandler): | |
def get(self, path): | |
email = users.get_current_user().email() | |
is_google = email.endswith('@somedomain.com') | |
is_rga = email.endswith('@someotherdomain.com') | |
is_admin = users.is_current_user_admin() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Url helper functions | |
* http://jamesallardice.com/urlutils-a-little-set-of-javascript-url-utility-methods/ | |
*/ | |
urlUtils = { | |
getParam: function(name) { | |
var regex = new RegExp('[?&]' + name + '=([^&#]*)'), | |
results = regex.exec(window.location.href); | |
if(results) { | |
return results[1]; |
NewerOlder