Skip to content

Instantly share code, notes, and snippets.

@sebkouba
sebkouba / ParentChild.es6
Created February 17, 2016 06:00
Basic example to pass values between parent and child components in React.
/**
* Basic example to pass values between parent and child components in React
* Seems to be in line with this
* http://stackoverflow.com/questions/24147331/react-the-right-way-to-pass-form-element-state-to-sibling-parent-elements
* Now I have the state in parent and child. Is that good or bad? Why would I need it in child?
* Could probably take that out
* */
class Parent extends React.Component {
constructor(props) {
super(props);
@chantastic
chantastic / on-jsx.markdown
Last active May 30, 2024 13:11
JSX, a year in

Hi Nicholas,

I saw you tweet about JSX yesterday. It seemed like the discussion devolved pretty quickly but I wanted to share our experience over the last year. I understand your concerns. I've made similar remarks about JSX. When we started using it Planning Center, I led the charge to write React without it. I don't imagine I'd have much to say that you haven't considered but, if it's helpful, here's a pattern that changed my opinion:

The idea that "React is the V in MVC" is disingenuous. It's a good pitch but, for many of us, it feels like in invitation to repeat our history of coupled views. In practice, React is the V and the C. Dan Abramov describes the division as Smart and Dumb Components. At our office, we call them stateless and container components (view-controllers if we're Flux). The idea is pretty simple: components can't

@alexkasko
alexkasko / gfx_tosvg_ie8.html
Created November 26, 2014 10:42
Dojo gfx toSVG pie chart in IE8 example
<!DOCTYPE html>
<html>
<head>
<title>toSVG problem in IE8</title>
<script src="dojo-latest/dojo/dojo.js" data-dojo-config="isDebug: 1, async: 1, parseOnLoad: 0"></script>
<script>
require([
"dojox/charting/Chart",
"dojox/charting/plot2d/Pie",
"dojox/gfx/utils",
@davidfowl
davidfowl / dotnetlayout.md
Last active July 19, 2024 17:51
.NET project structure
$/
  artifacts/
  build/
  docs/
  lib/
  packages/
  samples/
  src/
 tests/
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@davidfowl
davidfowl / client.js
Last active December 19, 2015 04:49
Stress harness
/// <reference path="Scripts/jquery-1.6.4.min.js" />
/// <reference path="Scripts/jquery.signalR-1.1.2.js" />
$(function () {
var connection = $.hubConnection(),
hub = connection.createHubProxy('harness');
hub.on('update', function (data) {
console.log(data);
});
@davidfowl
davidfowl / hub.cs
Last active December 14, 2015 17:38
Future of filtering in SignalR
public class MyHub : Hub
{
public Task SendToQuery(string query, string value)
{
// Call the send to everybody that has the specified query string value
return Clients.Query(c => c.QueryString[query] == value).send();
}
}
<!doctype html>
<!-- http://taylor.fausak.me/2015/01/27/ios-8-web-apps/ -->
<html>
<head>
<title>iOS 8 web app</title>
<!-- CONFIGURATION -->
@davidfowl
davidfowl / MyHub.cs
Created October 29, 2011 11:19
C# Hubs API
using System;
using System.Threading;
using System.Threading.Tasks;
using SignalR.Hubs;
namespace Server
{
public class MyHub : Hub
{
public void Foo()