Skip to content

Instantly share code, notes, and snippets.

@Aliath
Aliath / animatedScrollTo.ts
Created April 10, 2020 18:53
Function which works as window.scrollTo(0, y), but much prettier. :)
export const animatedScrollTo = (scrollValue: number, duration: number = 350): void =>
{
const value = Math.max(0, scrollValue);
const animationStart = performance.now();
const currentScroll = window.pageYOffset;
const scrollDelta = value - currentScroll;
const update = (): void =>
{
const currentTimestamp = performance.now();
@Aliath
Aliath / main.c
Created January 12, 2020 18:17
WDP - zaliczenie do laborków
#include <stdio.h>
#include <stdlib.h>
#define TAB_LENGTH 8
// zadanie 4
double max_value(double tab[]) {
double result = -1;
for (int i = 0; i < TAB_LENGTH; i++) {
double current_value = tab[i];
@Aliath
Aliath / AttachmentPicker.ts
Last active March 24, 2024 15:26
Wrapper for the react-native-image-picker and react-native-document-picker. Allow to pick media from gallery on iOS.
import { Platform, ActionSheetIOS } from 'react-native';
import DocumentPicker from 'react-native-document-picker';
import ImagePicker from 'react-native-image-picker';
import RNFS from 'react-native-fs';
type Captions = {
image: string,
document: string,
cancel: string,
title: string,
@Aliath
Aliath / Parallax.js
Last active October 9, 2019 09:39
Plugin for creating parallax effects.
export default class Parallax {
elementsToAnimate = [];
// parseElements([HTMLElement, HTMLElement]) or parseElements([{element: HTMLElement, container: HTMLElement}])
parseElements = normalizedList => {
this.elementsToAnimate = normalizedList.map(element => {
if (element instanceof HTMLElement) {
return { element, container: element.parentElement };
}
return element;