Skip to content

Instantly share code, notes, and snippets.

View faceyspacey's full-sized avatar

James Gillmore faceyspacey

View GitHub Profile
@faceyspacey
faceyspacey / html_match_spacebars.js
Last active August 29, 2015 14:19
match html to spacebars template algorithm
function findMatchingSpacebarsTemplate(nodes, templates, lineIndex) {
var lineIndex = lineIndex || 0,
templateMatches = templatesWhoseFirstLineMatchesNode(node.shift(), templates, lineIndex),
isMultipleMatches = templateMatches.length > 1;
//nodes has first element removed, and templateMatches is reduced to those that match on the first line
if(isMultipleMatches) return findMatchingSpacebarsTemplate(nodes, templateMatches, lineIndex + 1);
else return templateMatches.pop(); //we have found the one matching template! yay!!
}
// pages are purged when
// on userApproval in UserModel.approveCeleb
// on user update denies.js
var cloudflare_api_interface = "https://www.cloudflare.com/api_json.html";
var cloudflare_token = "YOUR_TOKEN";
var cloudflare_email = "YOUR_CLOUDFLARE_EMAIL";
var domain = 'FILL_IN_YOUR_DOMAIN";
var urls_to_purge = [
@faceyspacey
faceyspacey / suggestion.md
Last active October 24, 2015 05:53
Suggestion on the future of Meteor + "The React Stack"

There's been a lot of talk here about React and its impact on Meteor/Blaze--what about RethinkDB and GraphQL?? In other words, following React farther down what is clearly their intended stack?

What about making a strong (public) long bet on the future of web development through these adjacent tools and MDG rallying behind it? The result would be strengthening challenging undertakings, specifically in the coordination of the teams behind the other such projects, i.e. getting as much help as we can from them to make Meteor something they want to integrate with (and early on). Why not break the mold, take a stand, make a hard break from their past strategy, and embrace would-be competing products: Webpack? React? GraphQL? RethinkDB? Their might be a stack already evolving here that can integrate quite nicely with Meteor if we get appropriate buy-in from these teams.

To make clear what I'm saying, here's an example: the RethinkDB team right now is pondering deep integration of GraphQL (vs a higher level less-

@faceyspacey
faceyspacey / blaze-react-refactoring-proposal.md
Last active November 14, 2015 11:57
Blaze React ("Sideburns") refactoring proposal

####1) FLATTEN COMPILATION PROCESS (remove recursion--Templates should not compile themselves) so this:

replace: function(match, className, code) {
	const markup = ReactTemplate.compile(className, code || ''); 
	return `ReactTemplate["${className}"] = (component, context) => { return (${markup}) }; RT.body("${className}");`
}

becomes:

@faceyspacey
faceyspacey / test.js
Created November 28, 2015 13:32
test
var diff = require('deep-diff');
@faceyspacey
faceyspacey / lookup_and_transpiler.js
Created December 1, 2015 13:01
meteor-react notes for Tim Brandin
Plugin.registerCompiler({
extensions: ['jsx'],
}, function () {
return new BabelCompiler({
react: true
});
});
var oldProcessFilesForTarget = BabelCompiler.prototype.processFilesForTarget;
@faceyspacey
faceyspacey / original-lookup.jsx
Last active December 5, 2015 07:45
original Blaze React helper lookup
if(Meteor.isServer) return HelperLookupBlazeReact = {}; //so server side rendering isn't broken
/**
* PARAMS:
* @param {String} path - eg: 'obj.prop.etc.method'
* @param {Array} args - eg: [param1 param2 `paramString` 123 keywordArg=bla]
*
*
* REGEX REPLACE:
* `this._lookup('$1', [$2])` //$2 contains a list of variables+values+kwarg
@faceyspacey
faceyspacey / README.md
Last active December 7, 2015 17:26
sdf
git clone http://github.com/ultimatejs/meteor-component-example.git
cd meteor-component-example
meteor
var express = require(‘express’);
var app = express();
app.get(‘/’, function (req, res) {
 res.send(‘Hello World!’);
});
var server = app.listen(3000, function () {
 var host = server.address().address;
 var port = server.address().port;

Tracker.autorun(func, { subscriptionsReady: [‘posts’, ‘comments’], isTrue: () => Session.get(‘foo’) userIs: ‘admin’ templateIsVisible: ‘AllPosts’ });