Skip to content

Instantly share code, notes, and snippets.

View matb33's full-sized avatar

Mathieu Bouchard matb33

View GitHub Profile
@matb33
matb33 / DOMDocumentExtended.php
Last active May 23, 2020 21:26
DOMDocument->saveJSON()
<?php
// saveJSON: XML to JSON conversion/transformation
// The saveJSON method is implemented as a method of the example DOMDocumentExtended class, which
// extends DOMDocument. It will transform the currently loaded DOM into JSON using XSLT. Since
// there isn't a reliable automatic way of detecting if certain siblings nodes should be
// represented as arrays or not, a "forceArray" parameter can be passed to the saveJSON method.
// It should be noted that the forceArray functionality doesn't recognize namespaces. This is
// an easy enough fix, I just didn't need it at the time of writing (look for local-name() and
App&
Pages
About*
dashboard -> Dashboard
Dashboard
about -> About
Menu
Closed*
toggle -> Opened
Opened
Intro
next -> Terms
Terms
back -> Intro
accepted -> EULA
Accept Dialog 1
Display 1*
accept -> Accepted 1
Accepted 1
# <- accepted
@matb33
matb33 / SketchSystems.spec
Last active June 13, 2019 13:46
# What I'm attempting to highlight here are 3 things in relation to WireState:
# What I'm attempting to highlight here are 3 things in relation to WireState:
# 1. The need for @include (which you've solved!) -- it's impossible to re-use statecharts
# . with SketchSystems
# 2. The need for being able to re-use state names (... solved?) -- again, SketchSystems
# . unique IDs prevent any kind of composability
# 3. A proposal for a new syntax that actually doesn't technically do anything, but would
# . allow us to mimic the `send` style syntax from our imported machines. We both know
# . that in this case, `accept` is already available as an event while in either the
# . "Condensed" or "Expanded" states since the event will bubble up. But it's not obvious
# . if you're looking at the "Display" tree isolated in a separate statechart that will be
@matb33
matb33 / SketchSystems.spec
Last active June 6, 2019 23:07
Driver Idle
Driver Idle
ping received -> Evaluating Opportunity
Evaluating Opportunity
accept -> On The Way To Merchant
decline -> Driver Idle
On The Way To Merchant
arrived -> Taking Photo
Driver Idle
ping received -> Evaluating Opportunity
Evaluating Opportunity
accept -> On The Way To Merchant
decline -> Driver Idle
On The Way To Merchant
arrived -> Taking Photo
Entry
Credentials Flow*
Loading Credentials*
done -> Credentials Available?
error -> What Kind Of Loading Credentials Error?
What Kind Of Loading Credentials Error?
unauthenticated? -> Unauthorizing
any other error? -> Loading Credentials Error
Credentials Available?
yes? -> Account Flow
@matb33
matb33 / README
Last active October 20, 2016 08:28
WordPress plugin that protects resume uploads for the Job Manager plugin (http://pento.net/projects/wordpress-job-manager-plugin/)
Create this folder:
/wp-content/plugins/job-manager-private-uploads/
Put the two PHP files in there, then activate this plugin via the WordPress admin.
NOTE: your WordPress installation should be configured to allow WP_Rewrite to make modifications to the .htaccess file.
@matb33
matb33 / README.md
Created January 11, 2014 00:31
Reactive async pattern

Example usage:

Template.xyz.value = function () {
  return ReactiveAsync("Template_xyz_value", function (w) {
  	someAsyncFunction(function (result) {
  		w.set(result);
  		w.done();
  	});
 }, {initial: ""});
@matb33
matb33 / README.md
Created August 28, 2013 01:17
Meteor Template layouts with yield keyword, inspired by Iron Router. Will eventually make a proper repo and port to Meteorite... stay tuned

Meteor Template layouts with yield

Example usage:

Layout.helper("modal", function (options) {
  return {
    bgcolor: options.bgcolor || "#fff",
    layout: options.layout || "modalLayout"
 };