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
from workalendar.europe import Ireland | |
def irish_bank_holidays(year: int) -> list: | |
calc = Ireland() | |
return [x[0] for x in calc.holidays(year)] |
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
<template> | |
<q-input clearable filled type="text" :value="q" @input="updateQuery" /> | |
</template> | |
<script lang="ts"> | |
import { defineComponent, ref, onMounted } from '@vue/composition-api'; | |
export default defineComponent({ | |
name: 'PageSearchInput', |
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
<template> | |
<q-page padding> | |
<b>Search</b> | |
<q-form> | |
<q-input filled type="text" :value="query" @input="updateQuery" /> | |
</q-form> | |
</q-page> | |
</template> | |
<script lang="ts"> |
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
package main | |
import ( | |
"fmt" | |
"sort" | |
"github.com/tidwall/collate" | |
) | |
type text []string |
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 glob | |
import re | |
from typing import Iterator, List, Set, Tuple | |
from yaml import BaseLoader, load | |
def extract_words(text: str, min_length: int = 2) -> Set: | |
regex_words = re.compile(r"[\W]+", re.U) | |
return set( |
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
def flatten(items: list, result: list = None) -> list: | |
if result is None: | |
result = [] | |
for item in items: | |
if isinstance(item, list): | |
flatten(item, result) | |
else: | |
result.append(item) | |
return result |
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
from django.test import TestCase | |
from portal.lib.verses_parser import extract_verses, refs_with_chapter, split_refs | |
class VersesParserTestCase(TestCase): | |
maxDiff = None | |
def test_split_refs(self): | |
given = split_refs("Gen 1:2; 3:4-5", ["bw"]) |
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
1. Install zsh from packages | |
2. Install oh-my-zsh: | |
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" | |
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
3. configure ~/.zshrc | |
... |
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 * as React from 'react' | |
import {Component} from 'react' | |
class App extends Component { | |
setSvgRef(ref) { | |
console.log('Parrent React got ref:', ref); // this works | |
} | |
render() { | |
return <ScatterPlot svgRef={e => this.setSvgRef(e)}/> |
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
setStateSynchronous(stateUpdate) { | |
return new Promise(resolve => { | |
this.setState(stateUpdate, () => resolve()); | |
}); | |
} | |
// https://stackoverflow.com/questions/42018342/is-there-a-synchronous-alternative-of-setstate-in-reactjs |