Skip to content

Instantly share code, notes, and snippets.

View xavxyz's full-sized avatar
🎋
growing flex

Xavier Cazalot xavxyz

🎋
growing flex
View GitHub Profile
// Utils to get from raw to exploitable data
// extract two lists of issues & pull requests from a repository list
// note: this fn could return an object, but returning a two-dimensional array
// eases the data manipulation (see bottom of the file). The early implementation
// of this function was written with objects, see comment below
export const createLists = repositoriesList => repositoriesList.reduce(
(doubleList, repo) => ([
// index 0 = issues list
[...doubleList[0], { id: repo.id, count: repo.issues.totalCount }],
// inspired by https://github.com/tmeasday/mongo-find-by-ids/blob/master/index.js
const findBy = async (collection, key) => values => {
try {
const docs = await collection.find({ [key]: { $in: values } }).fetch();
const keyMap = docs.reduce((map, doc) => ({
...map,
[doc.key]: doc,
}), {});

Title ideas

The super powers of your own toolkit based on Apollo tools

Talk abstract

Apollo tools for React & Node environment give you ability to powerful create apps powered with a GraphQL data layer. In creating your own re-usable toolkit on top of these tools, it allows you to build great products even more simply.

Context

State of the art

@xavxyz
xavxyz / whats-nova.md
Created March 3, 2017 16:16
Nova/Vulcan presentation at Flip Flops camps
 ## Background

S 1. Telescope/Sidebar S 2. Discover Meteor S 3. React rewrite (Nova) + Xavier comes on board X 4. Apollo rewrite (Vulcan)

 ## What Is It?
@xavxyz
xavxyz / update.sh
Last active February 1, 2017 14:24
easy-update from Nova repo & your package
echo "// ------ 🔭 Updating Nova"
echo "// ------ Stashing your changes... (if any)"
git add .
git stash
# devel = Nova Apollo stable branch at the moment
git checkout devel
# origin = https://github.com/TelescopeJS/Telescope.git
git pull origin
echo "// ------ 🔭 Nova updated!"
echo "// ------ Applying your changes... (if any)"
// the scene takes place on Nova, NewsletterButton.jsx
// a little fancy way to do with promise and apollo mutation
subscriptionAction() {
this.props[this.props.mutationName]({userId: this.props.user._id}).then(result => {
this.props.successCallback(result);
}).catch(error => {
console.log(error); // eslint-disable-line no-console
this.props.flash(error.message, "error");

Atmosphere packages

Accounts

alanning:roles # easy-peasy permission stuff for your users

Validation

check # check arguments of a function manually
mdg:validation-method # meteor recommended way to use methods
@xavxyz
xavxyz / conditions-initiales.js
Last active January 13, 2017 05:31
Over-engineered experiment, yet interesting, on Nova forms and data loading with GraphQL
// custom field on Categories, querying a list of Categories
{
fieldName: 'attachedTeams',
fieldSchema: {
type: [String],
control: Components.CategoriesAttachedTeams,
optional: true,
insertableBy: ['admins'],
editableBy: ['admins'],
viewableBy: ['members'],
@xavxyz
xavxyz / update_trn.sh
Last active January 12, 2017 08:35
Stash, pull, apply, repeat
echo "// ------ 🔭 Updating Nova"
echo "// ------ Stashing your changes..."
git add .
git stash
# devel = Nova Apollo stable branch at the moment
git checkout devel
# origin = https://github.com/TelescopeJS/Telescope.git
git pull origin
echo "// ------ 🔭 Nova updated!"
echo "// ------ Applying your changes..."
@xavxyz
xavxyz / nova-users-apollo-migration.js
Last active November 17, 2016 07:47
Migration script for Nova Users to run server-side: from user.telescope.settingX to user.__settingX (without removing user.telescope.settingX for backward compatibility)
// Explanation:
// This is a migration script for your users to be compatible with the Apollo version of Nova
// We do not support anymore users properties on the `telescope` namespace. They will be duplicated onto __setting:
// Example: `user.telescope.karma` becomes `user.__karma`
// Note: we do not remove the `user.telescope` object, you'll still be able to go back to your previous full Meteor build if you feel that Apollo doesn't fit your needs
// How to use:
// Copy/paste the script below at the end of the nova:users /packages/nova-users/lib/server.js (package's server entry-point)
Meteor.startup(function runMigrationToApollo() {