Skip to content

Instantly share code, notes, and snippets.

View sophiebits's full-sized avatar

Sophie Alpert sophiebits

View GitHub Profile
@fson
fson / rapid-prototyping-with-relay.md
Created October 18, 2015 20:08
Rapid prototyping with Relay (Reactive 2015 lightning talk proposal)

This is a proposal for a lightning talk at the Reactive 2015 conference.

NOTE: If you like this, star ⭐ the Gist - the amount of stars decides whether it makes the cut!

Rapid prototyping with Relay

Relay makes data fetching in React apps simpler, by letting you declare the data needs of your components instead of writing complex imperative code. React, Relay, GraphQL and the other complementary tools are changing how apps are built.

@sebmarkbage
sebmarkbage / Move.md
Last active August 29, 2015 14:01
Object Rest Destructuring and Spread Initializer (ES7 proposal)
@sebmarkbage
sebmarkbage / react-warning-descriptors.md
Created February 11, 2014 02:10
React Warning - Invalid access to component property

You're probably getting this warning because you're accessing methods on a component before it gets mounted. This will be soon be an unsupported use case.

The component that gets created by invoking the convenience constructor MyComponent(props, children) or using the JSX syntax <MyComponent /> is not guaranteed to be the instance that actually gets mounted. It's a description of what the actual mounted instance should look like.

Anti-pattern:

The component also doesn't have access to state or other important information such as the final props. As a consequence you shouldn't be calling custom methods on this object.

var MyComponent = React.createClass({
@petehunt
petehunt / React sortable
Created December 9, 2013 22:30
Here's an example of React + jQuery UI sortable. The key thing to note is that we have the render() method do absolutely nothing and use componentDidUpdate() + React.renderComponent() to proxy updates through to the children. This lets us manage the DOM manually but still be able to use all the React goodies you know and love.
<html>
<head>
<title>Test</title>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://fb.me/react-0.5.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.5.1.js"></script>
</head>
import os
import json
import subprocess
import sys
def relativize(path):
return os.path.relpath(os.path.abspath(path), os.path.abspath('.'))[:-3]
DEPS_MEMO = {}
@kamens
kamens / gist:4613457
Created January 23, 2013 21:15
How to limit the events that trigger a Github hook message
>>> import requests
>>> import json
>>> r = requests.get('https://api.github.com/repos/kamens/gae_mini_profiler/hooks', auth=('kamens', 'dontyouwish'))
>>> r.text
u'[{"config":{"restrict_to_branch":"","auth_token":"monkeysmonkeysmonkeys","room":"1s and 0s"},"url":"https://api.github.com/repos/kamens/gae_mini_profiler/hooks/629092","active":true,"test_url":"https://api.github.com/repos/kamens/gae_mini_profiler/hooks/629092/test","updated_at":"2013-01-23T18:59:08Z","last_response":{"status":"ok","message":"OK","code":200},"events":["commit_comment","download","fork","fork_apply","gollum","issues","issue_comment","member","public","pull_request","push","watch"],"name":"hipchat","id":629092,"created_at":"2013-01-04T19:53:44Z"}]'
# Note the id from the hook that you're interested in. In this case, it's 629092
id = 629092