Skip to content

Instantly share code, notes, and snippets.

const fs = require('fs-extra');
const cal = require('./cal.js');
(async function() {
const uniq = [];
const newCal = [];
cal.map(event => {
const hash = `${event.match(/SUMMARY:(.*)\n/)[1]}::${event.match(/DTSTART(.*)\n/)[1]}`;
if (!uniq.includes(hash)) {
uniq.push(hash);
@MartinCura
MartinCura / ManyToManyReactAdminComponents.tsx
Last active April 24, 2024 19:36
react-admin (w/ hasura backend) components for many-to-many (M2M) relationship management
/**
* I couldn't find online any way of managing entities with a M2M relationship in react-admin with hasura backend,
* so here are mine.
* Example of what you can do: to the Edit view of your Movie resource, add DeletableRelatedResourceList
* to list and delete associated actors, and M2MRelatedResourceSelectInput to add new associated actors
* (with an intermediary table movie_actors).
*
* Done with react-admin@3.19.0
*/
@cyk
cyk / ember-data.dependent-relations.js
Last active December 12, 2020 21:17 — forked from slindberg/ember-data.dependent-relations.js
Dependent Relationships in Ember Data (for Ember Data v1.13.x)
/**
Ember Data: Dependent Relationships (Ember Data v1.13.x)
This package extends Ember Data to support creating relationships
where a model's dirty state depends not only on its own attributes
but on the dirty state of models in dependent relationships as well.
```javascript
App.Thing = DS.Model.extend({
name : DS.attr('string'),