Skip to content

Instantly share code, notes, and snippets.

Avatar

Alfonso Muñoz-Pomer Fuentes alfonsomunozpomer

View GitHub Profile
@alfonsomunozpomer
alfonsomunozpomer / doc-without-children-and-descendants.json
Created Dec 11, 2020
SRR10340954-AGATTGCTCTCGCATC – Document extracted from scxa-analytics-v5 without child and descendant document references (cf. https://gist.github.com/alfonsomunozpomer/d7ef72bef02fb8990cb8abd423cd6ca2)
View doc-without-children-and-descendants.json
{
"experiment_accession": "E-GEOD-139324",
"cell_id": "SRR10340954-AGATTGCTCTCGCATC",
"characteristic_name": [
"organism_part"
],
"facet_characteristic_name": [
"organism_part"
],
"characteristic_value": [
@alfonsomunozpomer
alfonsomunozpomer / doc-with-children-and-descendants.json
Last active Dec 11, 2020
SRR10340954-AGATTGCTCTCGCATC – Document extracted from scxa-analytics-v4 with child and descendant document references (cf. https://gist.github.com/alfonsomunozpomer/5944e7aa271a34c53c7c62371fe98436)
View doc-with-children-and-descendants.json
{
"experiment_accession": "E-GEOD-139324",
"cell_id": "SRR10340954-AGATTGCTCTCGCATC",
"factor_name": [
"organism_part"
],
"facet_factor_name": [
"organism_part"
],
"factor_value": [
@alfonsomunozpomer
alfonsomunozpomer / firefox-developer-edition.desktop
Created Jan 10, 2020
GNOME 3 launcher for Firefox Developer Edition ~/.local/share/applications/firefox-developer-edition.desktop
View firefox-developer-edition.desktop
[Desktop Entry]
Version=1.0
Name=Firefox Developer Edition
Comment=The browser made for developers
Exec=/home/amunoz/Applications/firefox/firefox-bin %u
Terminal=false
X-MultipleArgs=false
Type=Application
Icon=/home/amunoz/Applications/firefox/browser/chrome/icons/default/default128.png
Categories=Network;WebBrowser;Development;
@alfonsomunozpomer
alfonsomunozpomer / ArbitraryStringComparator.java
Last active Mar 25, 2019
Comparator of strings that sorts them in any arbitrary order, giving precedence to prescribed stings
View ArbitraryStringComparator.java
public class ArbitraryStringComparator implements Comparator<String> {
private final ImmutableList<String> stringsInOrder;
private ArbitraryStringComparator(String... stringsInOrder) {
this.stringsInOrder = ImmutableList.copyOf(stringsInOrder);
}
@Override
public int compare(String o1, String o2) {
if (stringsInOrder.contains(o1) && stringsInOrder.contains(o2)) {
@alfonsomunozpomer
alfonsomunozpomer / MatrixMarketReader.java
Created Nov 24, 2017
A minimal implementation of a Matrix Market parser of real values for Java 8
View MatrixMarketReader.java
package uk.ac.ebi.atlas.commons.readers;
import org.apache.commons.lang3.tuple.Triple;
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
@alfonsomunozpomer
alfonsomunozpomer / highcharts.js
Last active Mar 18, 2021
A Highcharts mock for Jest (place it in yout __mocks__ directory) to test components that depend on React Highcharts
View highcharts.js
const highcharts = jest.genMockFromModule(`highcharts`)
// So that Boost and Exporting modules don’t complain when running tests
highcharts.getOptions = () => ({ plotOptions: {} })
module.exports = highcharts
@alfonsomunozpomer
alfonsomunozpomer / Fetch.test.js
Created Sep 28, 2017
How to test a React component that sets its state in componentDidMount with fetch, and how to mock it, in Jest
View Fetch.test.js
// https://github.com/alfonsomunozpomer/react-fetch-mock
import React from 'react'
import fetchMock from 'fetch-mock'
import Enzyme from 'enzyme'
import {shallow, mount, render} from 'enzyme'
import Adapter from 'enzyme-adapter-react-16'
Enzyme.configure({ adapter: new Adapter() })