This file contains hidden or 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 statistics import median | |
d={} | |
flag=True | |
def load_from_file(filename): | |
try: | |
# Load data from file | |
f=open(filename, "r") |
This file contains hidden or 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 'package:firebase_auth/firebase_auth.dart'; | |
import 'package:flutter/services.dart'; | |
import 'package:google_sign_in/google_sign_in.dart'; | |
class SignInUtility { | |
static final FirebaseAuth _auth = FirebaseAuth.instance; | |
static final GoogleSignIn googleSignIn = GoogleSignIn(); | |
static Future<FirebaseUser> signInWithGoogle() async { | |
final GoogleSignInAccount googleSignInAccount = await googleSignIn.signIn(); |
This file contains hidden or 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 { useRef, useEffect, useCallback, useState } from 'react'; | |
const useIsMounted = (): () => boolean => { | |
const ref = useRef(false); | |
useEffect(() => { | |
ref.current = true; | |
return () => { | |
ref.current = false; | |
}; |
This file contains hidden or 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 { useState } from 'react' | |
const Card = ({ title, onClick }) => ( | |
<div onClick={onClick} className="card"> | |
<h1>{title}</h1> | |
</div> | |
) | |
const Modal = ({ title, onClose }) => ( | |
<div> |
This file contains hidden or 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 escape from 'sql-template-strings'; | |
import { Except } from 'type-fest'; | |
import { query } from '../lib/db'; | |
import { QueryOutput } from '@interfaces/util'; | |
export interface Schoolr_Partner { | |
id?: number; | |
name: string; | |
deleted: boolean; | |
} |
This file contains hidden or 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
extension URL { | |
var canBeOpened: Bool { | |
return UIApplication.shared.canOpenURL(self) | |
} | |
init(string main: String, fallback secondary: String) { | |
let url = URL(string: main) |
This file contains hidden or 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 { ValidationOptions, useFormContext, ErrorMessage } from 'react-hook-form'; | |
import {FunctionComponent, useEffect} from 'react'; | |
import cx from 'classnames'; | |
import { ClassValue } from 'classnames/types'; | |
import Select from "./Select"; | |
export interface Props { | |
label?: string; | |
name: string; | |
placeholder?: string; |
This file contains hidden or 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 { useState } from 'react'; | |
type StorageType = 'local' | 'session'; | |
type SetValueFn<T> = ((item: T) => T) | T; | |
interface StorageModifiers<T extends {}> { | |
set: <K extends keyof T = keyof T>(key: K, value: SetValueFn<T[K]>) => void; | |
get: <K extends keyof T = keyof T>(key?: K) => T[K]; | |
} |
This file contains hidden or 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 toTS(text: string): string { | |
return text | |
.replace(/\n/, '') | |
.split(';') | |
.map((row) => | |
row | |
.replace(/public|private|internal|static/gi, '') | |
.trim() | |
.replace(/String|Boolean/gi, (v) => v.toLowerCase()) | |
.replace(/Int|Long|Double/gi, 'number') |
This file contains hidden or 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
//: A UIKit based Playground for presenting user interface | |
import UIKit | |
import PlaygroundSupport | |
enum Section: CaseIterable { | |
case one | |
case two | |
} |