Skip to content

Instantly share code, notes, and snippets.

View alfonsomunozpomer's full-sized avatar

Alfonso Muñoz-Pomer Fuentes alfonsomunozpomer

View GitHub Profile
@alfonsomunozpomer
alfonsomunozpomer / doc-without-children-and-descendants.json
Created December 11, 2020 15:49
SRR10340954-AGATTGCTCTCGCATC – Document extracted from scxa-analytics-v5 without child and descendant document references (cf. https://gist.github.com/alfonsomunozpomer/d7ef72bef02fb8990cb8abd423cd6ca2)
{
"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 December 11, 2020 15:50
SRR10340954-AGATTGCTCTCGCATC – Document extracted from scxa-analytics-v4 with child and descendant document references (cf. https://gist.github.com/alfonsomunozpomer/5944e7aa271a34c53c7c62371fe98436)
{
"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 January 10, 2020 12:52
GNOME 3 launcher for Firefox Developer Edition ~/.local/share/applications/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 March 25, 2019 14:57
Comparator of strings that sorts them in any arbitrary order, giving precedence to prescribed stings
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 November 24, 2017 10:13
A minimal implementation of a Matrix Market parser of real values for Java 8
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 November 17, 2023 03:15
A Highcharts mock for Jest (place it in yout __mocks__ directory) to test components that depend on React Highcharts
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 September 28, 2017 12:51
How to test a React component that sets its state in componentDidMount with fetch, and how to mock it, in Jest
// 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() })