Skip to content

Instantly share code, notes, and snippets.

View Stringsaeed's full-sized avatar
🏗️
building something that matters

Muhammad Saeed Stringsaeed

🏗️
building something that matters
View GitHub Profile
@infinityfuture
infinityfuture / textrank_keywords.py
Last active February 15, 2019 16:01
TextRank extract keywords
"""
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
@zbuc
zbuc / multithreaded_flask.py
Created February 18, 2015 05:38
Example Multithreaded Flask App
from flask import Flask
app = Flask("proxapp")
@app.route('/')
def hello_world():
return 'Hello World!'
@mreigen
mreigen / generate-alphabets.js
Created November 20, 2017 05:55
Javascript generate alphabet string
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('');
}
@necolas
necolas / AppText.js
Last active April 17, 2022 19:13
Localized typography with React Native
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 {
@mdsrosa
mdsrosa / dijkstra.py
Created November 21, 2015 04:36
Modified Python implementation of Dijkstra's Algorithm (https://gist.github.com/econchick/4666413)
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):
@terrysahaidak
terrysahaidak / Gallery.tsx
Created April 25, 2023 05:09
Control scroll
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;
@nealrs
nealrs / contractions.py
Created May 31, 2015 01:33
Expand common (and some very uncommon) english contractions
"""
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",
@derekstavis
derekstavis / Toast.tsx
Last active October 2, 2023 18:02
React Native Toast, without Context hell
/* 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,
@intergalacticspacehighway
intergalacticspacehighway / use-fetch-on-app-foreground.tsx
Created January 28, 2022 04:10
app fetch request failing in background
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 {