Skip to content

Instantly share code, notes, and snippets.

View BinaryMuse's full-sized avatar
🏳️‍🌈
Just gayin' up the place the best I can

Michelle Tilley BinaryMuse

🏳️‍🌈
Just gayin' up the place the best I can
View GitHub Profile
@brigand
brigand / html-editor.directive.js
Last active August 29, 2015 13:56
react components in an angular directive
angular.module('app.common.directives.html-editor', [])
.directive('htmlEditor', function() {
return {
restrict: 'E',
scope: {
'html': '='
},
link: function (scope, element, attrs, ctrl) {
// this is a browserify bundle where my react components live
@BinaryMuse
BinaryMuse / gist:9592591
Last active August 29, 2015 13:57
Highlight react DOM
setInterval(function() {
Array.prototype.slice.call(document.querySelectorAll('[data-reactid]')).forEach(function(node) {
node.style.backgroundColor = 'rgba(255, 0, 0, 0.1)';
})
}, 500)
/** @jsx React.DOM */
var Dashboard = React.createClass({
render: function() {
return (
<div>
<h1>Dashboard!</h1>
<ul>
<li><Link to="inbox">Inbox</Link></li>
</ul>

BoardMVC

Note: this is a draft. The rules and requirements will be finalized on July 1st 2014.

You may have seen TodoMVC which shows the same todo list, created with many different frameworks and libraries.

It's very helpful, but people often find it lacking in common requirements for a web app. It doesn't handle users, persistence, reusable components, modals, AJAX, etc.

@fishcakez
fishcakez / enter_loop.ex
Last active August 29, 2015 14:04
EnterLoop
defmodule EnterLoop do
use GenServer
require Logger
def start_link(opts) do
spawn_opts = Keyword.get(opts, :spawn_opt, [])
# :infinity start timeout
:proc_lib.start_link(__MODULE__, :init_it, [opts], :infinity, spawn_opts)
end
@dandelany
dandelany / create-flux-client.js
Created November 7, 2014 21:36
Fluxxor flux-client
var Fluxxor = require('fluxxor');
var _ = require('underscore');
// A FluxClient is a special Fluxxor.Store constructor that is a wrapper around a 'client' object.
// Client objects are generally an object containing all the server calls your app can make
// FluxClient allows you to listen for Fluxxor actions and cause them to trigger requests in the client,
// this way your actions can remain pure and don't have to call the client directly.
// It can also dispatch Fluxxor actions when the client request begins and upon request success/failure
// createFluxClient creates a FluxClient constructor from two arguments:
@orientalperil
orientalperil / template_graph.py
Created December 10, 2014 18:15
Create Graphviz diagrams of Django templates
import os
import functools
import fnmatch
import re
import collections
import pydot
def Walk(root='.', recurse=True, *patterns):
"""
@arathunku
arathunku / NewsfeedStore.js
Last active August 29, 2015 14:12
Request Action, wrapper for all requests
var NewsfeedStore = Fluxxor.createStore({
initialize () {
this.loading = false;
this.error = null;
PaginatedStoreWrapper(this);
_.extend(this, (localStorage.get('NewsfeedStore') || {}));
this.bindActions(
AppBarConstants.REFRESH, this.onRefresh,
import React from 'react';
import shallowEqual from 'react/lib/shallowEqual';
class PureRenderComponent extends React.Component {
shouldComponentUpdate(nextProps, nextState) {
return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
}
}
@phated
phated / 1.good.js
Last active August 29, 2015 14:16
Idiomatic React - Rule #1: Don't generate children; Always forward them.
/*
List is an abstract React component for building lists.
Think of it like a wrapper around <ul> or <ol>
*/
var List = require('custom-components/list');
/*
ListItem is an abstract React component for adding items to the List component.
Think of this like a <li> that might have styling, classes, etc to work nicer in the List.
*/
var ListItem = require('custom-components/list-item');