Skip to content

Instantly share code, notes, and snippets.

Matt Finucane matfin

Block or report user

Report or block matfin

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
matfin / 4-ways-custom-components.html
Last active Jan 6, 2016
HTML5 Web Components - Snippets from learning
View 4-ways-custom-components.html
<!DOCTYPE html>
<!-- Option One -->
<script type="text/javascript">
View meteor-futures
* A practical example of using Fibers in Meteor JS
var MeteorFiber = {
takeLong: function() {
var future = new this.Future();
Meteor.setTimeout(function() {
matfin / oddness.js
Last active Aug 29, 2015
Iterate through and array and return the first number that occurs an odd number of times.
View oddness.js
var numbers = [1, 1, 2, 3, 2, 3, 7, 8, 8];
var getOddOccurrence = function(numbers) {
var collected = [],
numbers.forEach(function(number) {
if(typeof collected[number] === 'undefined') {
collected[number] = [];
matfin / object_to_array.js
Last active Aug 29, 2015
A simple solution to convert an object map into an array
View object_to_array.js
'use strict';
* Given an object map like this one
var map = {
objectOne: {
attributeOne: 1,
attributeTwo: 2
matfin / Contentful
Last active Jan 5, 2018
Dealing with custom Content-Types and POST requests in node.js and Meteor
View Contentful

This describes how to deal with custom content types and hooks in a Meteor JS based webapp which pulls its content from Contentful.

My goal was to reload content into a Meteor server side collection and have it update any time a user on updated content there. Contentful provide a very helpful hook mechanism, whereby a POST request is made to an endpoint of your choosing when content has been updated.

I was using the server side component of IronRouter to listen for incoming POST requests from Contentful and when they arrived, the request body was empty. This is because Contentful have a custom content type 'application/' and IronRouter does not know how to deal with that out of the box.

I wrote the above, using the nodejs connect and the body parser module. Want to know how to include these in your Meteor app? Look at this handy package - which allows you to include NPM modules in meteor.

Look at line 15 in the above cod

You can’t perform that action at this time.