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
""" | |
Reference: | |
http://www.hankcs.com/nlp/textrank-algorithm-to-extract-the-keywords-java-implementation.html | |
http://www.hankcs.com/nlp/textrank-algorithm-java-implementation-of-automatic-abstract.html | |
""" | |
import numpy as np |
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 flask import Flask | |
app = Flask("proxapp") | |
@app.route('/') | |
def hello_world(): | |
return 'Hello World!' | |
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
function generateAlphabets() { | |
var alphabets = []; | |
var start = 'A'.charCodeAt(0); | |
var last = 'Z'.charCodeAt(0); | |
for (var i = start; i <= last; ++i) { | |
alphabets.push(String.fromCharCode(i)); | |
} | |
return alphabets.join(''); | |
} |
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 i18n from './i18n'; | |
import theme from './theme'; | |
import { bool, string } from 'prop-types'; | |
import { I18nManager, StyleSheet, Text } from 'react-native'; | |
import React, { Component } from 'react'; | |
/** | |
* React Component | |
*/ | |
class AppText extends Component { |
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 collections import defaultdict, deque | |
class Graph(object): | |
def __init__(self): | |
self.nodes = set() | |
self.edges = defaultdict(list) | |
self.distances = {} | |
def add_node(self, value): |
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 React, {useRef, useState} from 'react'; | |
import {FlatList, Image, useWindowDimensions} from 'react-native'; | |
import {Gesture, GestureDetector} from 'react-native-gesture-handler'; | |
import Animated, {useSharedValue} from 'react-native-reanimated'; | |
// array of 3 images | |
const images = [ | |
{id: 1, url: 'https://picsum.photos/id/237/200/300'}, | |
{id: 2, url: 'https://picsum.photos/id/238/200/300'}, | |
{id: 3, url: 'https://picsum.photos/id/239/200/300'}, |
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 { padStart, eq, isEqual } from 'lodash'; | |
export function useDebugDeps(name: string, deps: unknown[]): void { | |
const previousDepsRef = React.useRef(deps); | |
const countRef = React.useRef(0); | |
printDepsChange(name, deps, previousDepsRef.current, countRef.current); | |
previousDepsRef.current = deps; |
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
""" | |
this code is not mine! i shamelessly copied it from http://stackoverflow.com/questions/19790188/expanding-english-language-contractions-in-python | |
all credits go to alko and arturomp @ stack overflow. | |
basically, it's a big find/replace. | |
""" | |
import re | |
cList = { | |
"ain't": "am not", |
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
/* Layout and Text components are my own utility components. Replace them by your own. */ | |
import { memo, useEffect, useMemo, useState } from "react"; | |
import { ViewStyle } from "react-native"; | |
import { A } from "@mobily/ts-belt"; | |
import mitt from "mitt"; | |
import { v4 as uuid } from "@lukeed/uuid"; | |
import Animated, { | |
Layout as REALayout, | |
Easing, |
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 { useEffect, useRef } from "react"; | |
import { AppState, AppStateStatus } from "react-native"; | |
export const useFetchOnAppForeground = () => { | |
const listener = useRef(null); | |
function fetchOnAppForeground(params) { | |
if (AppState.currentState === "active") { | |
return fetch(params); | |
} else { |
OlderNewer