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 React from 'react' | |
export default function useIntersectionObserver({ | |
root, | |
target, | |
onIntersect, | |
threshold = 1.0, | |
rootMargin = '0px', | |
enabled = true, | |
}) { |
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
const seconds = 1619798400 | |
const date = new Date(1970, 0, 1) // Epoch | |
date.setSeconds(seconds) |
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/material.dart'; | |
class RegistrationScreen extends StatefulWidget { | |
static const routeName = '/register'; | |
@override | |
State<StatefulWidget> createState() { | |
return _RegistrationState(); | |
} |
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
#include <iostream> | |
using namespace std; | |
//enum Months { Jan=1, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov,Dec}; | |
char skip; | |
char response; | |
int m = 0, d = 0, y = 0; | |
int OrdDay = 0, priorDays = 0; | |
bool IsLeapYear(int y, int priorDays) |
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 { fakeAsync, tick } from '@angular/core/testing'; | |
describe('brainstorming test', () => { | |
test('ngOnInit() should initiate autocomplete and its dataset', fakeAsync(() => { | |
// const mockedTemplateOptions = jest.fn() as any as FormlyTemplateOptions; | |
// component.to = mockedTemplateOptions; | |
// const mockedTemplateOptions = jest.spyOn(component.to, 'search').mockReturnValue('a'); |
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
def Fib_Checker(lst): | |
size = len(lst) | |
if size == 0: | |
return False | |
start = lst[0] | |
previous, current = 0, 1 |
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
if settings.TESTING: | |
import coverage | |
cov = coverage.coverage(source=['entities'], omit=['*/tests/*']) | |
cov.set_option('report:show_missing', True) | |
cov.erase() | |
cov.start() | |
execute_from_command_line(sys.argv) |
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
# Write a function that takes an (unsigned) integer as input, and returns the number of bits that are equal to one in the binary representation of that number. | |
# Example: The binary representation of 1234 is 10011010010, so the function should return 5 in this case | |
def countBits(n): | |
binary = bin(n)[2:] | |
return len(filter(lambda x: x == '1', binary)) | |
# Alternative solution | |
# def countBits(n): |
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
def sum_two(a, b): | |
return int(a) + int(b) | |
def compare_versions(version_a, version_b): | |
a = map(int, version_a.split('.')) | |
b = map(int, version_b.split('.')) | |
first_a, first_b = int(a[0]), int(b[0]) | |
# check if a release number is greater |
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
def answer(xs): | |
negatives = [] | |
result = 0 | |
if len(xs) == 1: | |
return xs[0] | |
for element in xs: | |
if element > 0: | |
if result == 0: |
NewerOlder