Skip to content

Instantly share code, notes, and snippets.

Jed Watson JedWatson

Block or report user

Report or block JedWatson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ceejbot
ceejbot / esm_in_node_proposal.md
Last active Jul 17, 2019
npm's proposal for supporting ES modules in node
View esm_in_node_proposal.md

ESM modules in node: npm edition

The proposal you’re about to read is not just a proposal. We have a working implementation of almost everything we discussed here. We encourage you to checkout and build our branch: our fork, with the relevant branch selected. Building and using the implementation will give you a better understanding of what using it as a developer is like.

Our implementation ended up differing from the proposal on some minor points. As our last action item before making a PR, we’re writing documentation on what we did. While I loathe pointing to tests in lieu of documentation, they will be helpful until we complete writing docs: the unit tests.

This repo also contains a bundled version of npm that has a new command, asset. You can read the documentation for and goals of that comma

@export-mike
export-mike / compose-async.js
Last active Jan 23, 2018
compose utility function for async await, A team effort with @cameronbourke and @gwyneplaine. It was a fun discussion.
View compose-async.js
/*
* Requires Node 8+
* Works in chrome, simply copy and paste into console.
*/
const R = require('ramda');
const compose =
(...funcs) =>
(...args) =>
funcs.reduceRight(async (a, f) => {
@jeroenvisser101
jeroenvisser101 / safari.css
Last active Sep 4, 2019
Hide Safari contacts auto-fill when [autocomplete="off"]
View safari.css
input[autocomplete="off"]::-webkit-contacts-auto-fill-button {
visibility: hidden;
display: none !important;
pointer-events: none;
height: 0;
width: 0;
margin: 0;
}
@taion
taion / Button.js
Last active Jul 31, 2016
Embarrassing strawman API proposal that hopefully gets the point across
View Button.js
// This is _not_ supposed to be a real API. It's only intended to describe what
// I'm looking for. It's almost intentionally awful.
export const buttonHook = new OverrideHook({
properties: ['margin'],
});
export default function Button(props) {
return (
<button
View a.js
// Solution #1: Generic Override (like CSS)
var ButtonGroup = React.createClass({
render() {
return <div>{this.props.buttons.map((btn, i) =>
<Button style={{
...(i !== 0 && {marginLeft: 0})
...(i !== this.props.buttons.length - 1 && {marginRight: 0})
}} />
)}</div>;
@mik01aj
mik01aj / README.md
Last active Apr 21, 2017
How to use Tether with React
View README.md

Tether is a great library for positioning stuff (tooltips, modals, hints, etc) in your web app.

But, as I use React, it was pretty problematic for me, as Tether mutates the DOM and React breaks miserably when it sees mutated DOM. The solution is to have the tethered element outside the part of the DOM tree which is controlled by React (in this case, I use document.body).

That's why I created 2 helpers to use Tether with React.

The first one, TetheredElement is a plain JS helper to create a new element, attach it to some other one via Tether, and populate it with some React component.

The second one, TetherTarget is a React component and it uses TetheredElement to integrate it further with React, so that you can attach components to each other with Tether, without leaving the cozy React/JSX world and worrying about manual DOM operations. Just write:

View stubContext.js
var React = require.requireActual('react')
var assign = require.requireActual('object-assign')
function stubContext(Component, context) {
var _component = Component
var _context = context
var _contextTypes = {}
Object.keys(_context).forEach((key) => {
_contextTypes[key] = React.PropTypes.any
View Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@wuhaixing
wuhaixing / views_in_keystone.md
Last active Feb 18, 2019
How to Construct Yourself UI in KeystoneJS
View views_in_keystone.md

#How to Construct Yourself UI in KeystoneJS

KeystoneJS provide Admin UI with one set of route controllers and view templates(list&item) for all of the models.But usually,you will need some custome views other than Admin UI to display models. Although the KeystoneJS documention don't tell us much about how to contruct custome view,we can learn this from the source code in skeleton project generated by yo keystone,or you can just check out the keystone demo project's source code.We will walk through the blog feature's implementation in this demo application to demonstrate how to construct custome UI in KeystoneJS application.

As KeystoneJS documention described in Routes & Views section,there is a routes/index.js file, where we bind application's URL patterns to the controllers that load and process data, and render the appropriate template.You can find following code in it:

app.get('/blog/:catego
@grabbou
grabbou / .travis.yml
Created Aug 19, 2014
Code coverage integration for CodeClimate / TravisCI & Mocha
View .travis.yml
language: node_js
node_js: ["0.11", "0.10"]
env:
CODECLIMATE_REPO_TOKEN: <your_token>
before_script:
- npm install -g istanbul
- npm install -g mocha
- npm install -g codeclimate-test-reporter
You can’t perform that action at this time.