Skip to content

Instantly share code, notes, and snippets.

View PhilippSpo's full-sized avatar

Philipp Sporrer PhilippSpo

View GitHub Profile
import React, { useEffect, useState } from "react";
import { render as defaultRender } from "@testing-library/react";
import { createMemoryHistory, Location } from "history";
import { RouterContext } from "next/dist/next-server/lib/router-context";
import { NextRouter } from "next/router";
export * from "@testing-library/react";
// --------------------------------------------------
// Override the default test render with our own
@PhilippSpo
PhilippSpo / 0_reuse_code.js
Created August 10, 2017 19:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@PhilippSpo
PhilippSpo / TableMeasurer.js
Last active August 22, 2016 07:20
Function as a child component, that takes CellMeasurer's `getRowHeight` and `getColumnWidth` as input and calculates the total height and width of the table.
export const TableMeasurer = React.createClass({
propTypes: {
children: PropTypes.any,
getRowHeight: PropTypes.func,
getColumnWidth: PropTypes.func,
rowCount: PropTypes.number,
colCount: PropTypes.number,
},
calcRowHeight () {
const { props: { getRowHeight, rowCount } } = this
@PhilippSpo
PhilippSpo / customers-from-grid-to-ctp.md
Last active June 20, 2016 13:48
Possible transformation of GRID customer data to CTP customer data

Possible transformation of GRID customer data to CTP customer data

Since there are some fields that exist and are used in GRID, that are not present in the CTP, we need to find a way of storing this data in CTP custom fields.

Since all the problematic fields are already identified, we can create a custom customer type "grid-customer" that contains all of these fields. Later when importing customers, we need to append all these fields as custom fields of the custom type "grid-customer".

This is how the structure for importing using a generic importer could look like:

{
@PhilippSpo
PhilippSpo / findPrincipalsForUser.js
Created August 25, 2015 21:37
Finds all principals that represent a message for the current user
var userId = Meteor.userId();
Principals.find({
dataType: ‘message’,
‘encryptedPrivateKeys.userId’: userId
});
@PhilippSpo
PhilippSpo / encryptedCollection.js
Created August 25, 2015 21:35
Encrypts the field "message" in the collection "Messages"
if (Meteor.isClient) {
// define fields to be encrypted
var fields = [‘message’];
// init encryption on collection Messages
MessagesEncryption = new CollectionEncryption(
Messages,
fields,
{}
);
}
@PhilippSpo
PhilippSpo / signIn.js
Created August 25, 2015 21:30
Generate keypair for users
AccountsTemplates.configure({
onSubmitHook: function (error, state) {
if (error) {
return;
}
var password = $('#at-pwd-form :input#at-field-password').val();
if (state === 'signIn' || state === 'signUp') {
EncryptionUtils.onSignIn(password);
}
}
@PhilippSpo
PhilippSpo / tutorial.md
Last active May 7, 2018 08:44
How to integrate Polymer with Meteor

How to integrate Polymer with Meteor

  1. Make sure you have a public and client folder in your project
  2. create a .bowerrc file at your project root:
  {
    "directory": "public/components/"
  }