Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Gerard Sychay hellogerard

🎯
Focusing
View GitHub Profile
@hellogerard
hellogerard / journal.stories.js
Created November 16, 2017 16:31
"Live" React Native Storybook story
View journal.stories.js
/* eslint-disable import/no-unresolved, indent */
import React from 'react';
import { ScrollView } from 'react-native';
import { gql, graphql, ApolloProvider } from 'react-apollo';
import { storiesOf } from '@storybook/react-native';
import { compose, withStateHandlers, withProps, branch, renderNothing } from 'recompose';
import { get } from 'lodash';
import store from '/app/store';
import client, { networkInterface } from '/app/client';
View why-did-you-update.js
/* eslint-disable no-console */
import _ from 'lodash';
// Drop this into a component that wastes time according to Perf.printWasted()
// to find out what state/props should be preserved. Once it says "Update
// avoidable!" for {state, props}, you should be able to drop in
// React.addons.PureRenderMixin or React.PureComponent.
//
// From: http://benchling.engineering/deep-dive-react-perf-debugging/
@hellogerard
hellogerard / animals.js
Last active March 8, 2017 18:26
Functional JS approach to classic Animals OO example - https://jsfiddle.net/wjkLagf8/1/
View animals.js
const animal = {
type: 'animal',
talk() {
alert('Hello, world!');
},
move() {
alert(`${this.name} the ${this.type} moved forward`);
}
};
@hellogerard
hellogerard / boot.coffee
Created May 30, 2014 15:26
Importing static data on Meteor startup.
View boot.coffee
#
# Using 'node-csv-npm' meteorite package
#
fs = Npm.require 'fs'
Meteor.startup ->
# LOAD ITEMS
@hellogerard
hellogerard / publications.js
Last active August 27, 2020 05:23
Publishing results of a REST API call in Meteor.
View publications.js
// I need to integrate my company's meteor app with a 3rd party legacy application. Both apps will operate independently, but need to perform CRUD on the legacy datasource. Is there a way to use a REST api built on the legacy system as a datasource in the meteor app?
//Basically I'm looking to do something like the below pseudocode:
Meteor.publish("items", function() {
HTTP.get('https://legacy.app.url/api/items',{ },function(err, items){
return items;
//Or return items.toMeteorCollection()
})
});
@hellogerard
hellogerard / lists.coffee
Last active August 29, 2015 13:59
Modifying/transforming a Meteor collection cursor in a publication
View lists.coffee
# Our minimongoid 'List' class, wrapping the 'lists' Meteor.Collection
# (runs on server & client). If not using minimongoid, you could simply
# on the server & client use:
#
# Lists = new Meteor.Collection 'lists'
class @List extends Minimongoid
@_collection: new Meteor.Collection 'lists'
@hellogerard
hellogerard / cow.html
Last active August 29, 2015 13:58
[blaze] Meteor autofocus reactivity bug (https://github.com/meteor/meteor/issues/2011)
View cow.html
<head>
<title>cow</title>
</head>
<body>
{{> hello}}
</body>
<template name="hello">
<h1>Hello World!</h1>
View keybase.md

Keybase proof

I hereby claim:

  • I am hellogerard on github.
  • I am hellogerard (https://keybase.io/hellogerard) on keybase.
  • I have a public key whose fingerprint is C4A1 AA18 EDF3 05A2 735F 8BCF 00F2 8592 CE51 9826

To claim this, I am signing this object: