This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useCallback, useReducer, Reducer, useRef, useEffect } from 'react'; | |
export const useIsMounted = () => { | |
const isMounted = useRef<boolean>(false); | |
useEffect(() => { | |
isMounted.current = true; | |
return () => { | |
isMounted.current = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const keysDeep = (obj, prefix = '') => { | |
const isObject = (obj) => (typeof obj === 'object') | |
const getKeysDeep = (obj, prefix) => _.keys(obj).map(key => isObject(obj[key]) ? getKeysDeep(obj[key], prefix + key + '.') : prefix + key) | |
return _.flattenDeep(getKeysDeep(obj, '')).map(key => key.replace(/\.(\d+)/g, '[$1]')) | |
} | |
let keys = keysDeep({ | |
foo: 'bar', | |
file: { name: 'lodash' }, | |
person: { name: 'gunar', age: 17 }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "electron-webpack-quick-start", | |
"version": "0.0.0", | |
"license": "MIT", | |
"scripts": { | |
"dev": "electron-webpack dev", | |
"compile": "electron-webpack", | |
"dist": "yarn compile && electron-builder", | |
"dist:dir": "yarn dist --dir -c.compression=store -c.mac.identity=null" | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from toolkit import * | |
I = int(sys.argv[1]) | |
J = int(sys.argv[2]) | |
# ===================================================================== | |
def fr (r, alpha): | |
sr = np.where(r == 0, 1, r) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import h5py | |
import inspect | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from scipy.optimize import curve_fit, minimize | |
# ===================================================================== | |
refC = np.zeros((256, 5), dtype=int) | |
refC[0, 0] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.image as img | |
N = 128 | |
def relCov(ax, ay, bx, by): | |
d2 = np.square(ax - bx) + np.square(ay - by) | |
return 32 / (1 + d2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <string.h> | |
#include <stdio.h> | |
#include "Image.hh" | |
#include "morfo.hh" | |
#include "tpmorpho1.hh" | |
#include "tpmorpho2.hh" | |
#include "tptoolbox.hh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _ from 'lodash' | |
import Vue from 'vue' | |
import Router from 'vue-router' | |
Vue.use(Router) | |
const routes = [] | |
const viewFiles = require.context('views', true, /\.vue$/) | |
viewFiles.keys().forEach(key => { | |
let view = viewFiles(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Vuex | |
import Vue from 'vue' | |
import Vuex from 'vuex' | |
Vue.use(Vuex) | |
import { merge, mapValues } from 'lodash' | |
const actions = {} | |
const getters = {} | |
const modules = {} |