/etc/rspamd/local.d/multimap.conf:
IP_WHITELIST {
type = "ip";
prefilter = true;
map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
action = "accept";
}
/* If the browser fails to download the module, it'll try again | |
* 5 times with a 1 second delay between each attempt. If | |
* even after 5 tries it fails to import it, then an error is thrown. | |
*/ | |
export function retry(fn, retriesLeft = 5, interval = 1000) { | |
return new Promise((resolve, reject) => { | |
fn() | |
.then(resolve) | |
.catch((error) => { |
import React, { useState } from 'react'; | |
// Create a Context | |
const MyContext = React.createContext(); | |
// It returns an object with 2 values: { Provider, Consumer } | |
function ParentComponent() { | |
const [counter, setCounter] = useState(0); | |
// Create an object containing both the value and the setter |
import styled, { css } from 'styled-components'; | |
import React from 'react'; | |
interface Border extends React.HTMLAttributes<HTMLElement> { | |
isInEdit: boolean; | |
} | |
const border = css<Border>` | |
border: 1px solid ${({ isInEdit }) => (isInEdit ? 'red' : 'transparent')}; | |
&:hover { |
/etc/rspamd/local.d/multimap.conf:
IP_WHITELIST {
type = "ip";
prefilter = true;
map = "/${LOCAL_CONFDIR}/local.d/ip_whitelist.map";
action = "accept";
}
<body> | |
<div class="content"> | |
my content | |
</div> | |
<footer class="footer"> | |
my footer | |
</footer> | |
</body> |
// useEffect & useState | |
const useCalculate = numberProp => { | |
const [result, setResult] = useState<number>(null); | |
useEffect(() => { | |
setResult(expensiveCalculation(numberProp)); | |
}, [numberProp]); | |
return result; | |
}; |
// useEffect & useState | |
const useCalculate = numberProp => { | |
const [result, setResult] = useState<number>(null); | |
useEffect(() => { | |
setResult(expensiveCalculation(numberProp)); | |
}, [numberProp]); | |
return result; | |
}; |
" ============================================================================ " | |
" === kcoyner's nvim config === " | |
" ============================================================================ " | |
" Plugin/package location: ~/.local/share/nvim/site/pack/git-plugins/start | |
set runtimepath^=~/.vim runtimepath+=~/.vim/after | |
let &packpath = &runtimepath | |
let g:python3_host_prog='/usr/local/bin/python3' | |
" let g:python_host_prog='/usr/bin/python2' | |
" let g:GPGExecutable = 'gpg2 --trust-model auto' |
function getMoneyBack(money) { | |
money = String(money) // force the rejectkk | |
return new Promise((resolve, reject) => { | |
if (typeof money !== 'number') { | |
reject(new Error('money is not a number')) | |
} else { | |
resolve(money) | |
} | |
}) | |
} |
function getMoneyBack(money, callback) { | |
money = String(money) // force the error | |
if (typeof money !== 'number') { | |
callback(null, new Error('money is not a number')) | |
// callback(new Error('money is not a number')) | |
} else { | |
callback(money) | |
} | |
} |