Skip to content

Instantly share code, notes, and snippets.

View tamunoibi's full-sized avatar

Ib Aprekuma tamunoibi

View GitHub Profile
@tamunoibi
tamunoibi / cashRegister.js
Created February 13, 2022 06:58
This is an incomplete attempt at solving the cash register freecodecamp problem
function checkCashRegister(price, cash, cid) {
let change = cash - price;
let total = 0;
let totalCID = cid.forEach((item) => {
total += item[1]
});
console.log(total);
function repeatStringNumTimes(arr) {
if(arr.length%2 === 0) {
return 0;
} else {
const middle = (arr.length - 1) / 2;
const left = isLessMiddle(0, middle - 1, arr, arr[middle]);
const right = isLessMiddle(middle + 1, arr.length - 1, arr, arr[middle]);
console.log(right);
if(left && right) {
return 1;
@tamunoibi
tamunoibi / function.js
Created July 8, 2021 20:09
/Users/tamunoibi/Documents/workspace/frontend/src/helpers/functions.js
// @flow
import Moment from "moment-timezone";
import _ from "lodash";
import { handleAPIError } from "./handleErrors";
function getDateTime(time, date, timezone) {
const hours = Moment(time).format("HH");
const minutes = Moment(time).format("mm");
if (timezone) {
@tamunoibi
tamunoibi / duration.js
Created July 8, 2021 20:07
/Users/tamunoibi/Documents/workspace/frontend/src/helpers/duration.js
// @flow
import Moment from "moment-timezone";
import { format24as12, format12as24 } from "./functions";
export const timeValidator = (time: string) => {
let validation;
const initialValidation = /^\d{1,2}([:.-]?\d{1,2})?([ ]?[A|P|a|p](M|m))?$/;
if (initialValidation.test(time)) {
let valTime = time;
if (/[am|pm]/i.test(valTime)) {
/** @jsxFrag React.Fragment */
/** @jsx jsx */
import React, { useEffect, useRef, useState } from "react";
import { css, jsx } from "@emotion/core";
import Moment from "moment-timezone";
import { gql, useMutation, useQuery } from "@apollo/client";
import uuidv4 from "uuid/v4";
import {
compressToEncodedURIComponent,
decompressFromEncodedURIComponent,
import React, { useEffect, useState, useCallback } from "react";
import MnassaInput from "../../../../components/MnassaInput";
import {
getConnectionRequest,
clearGetConnectionResult,
} from "../../../../store/actions/getConnections";
import { useDispatch, useSelector } from "react-redux";
import { searchConnectionRequest } from "../../../../store/actions/getConnections/searchConnections";
import loadingSpinner from "../../../../images/spinner-icon-gif-10.gif";
import React, { useState } from 'react';
import { ImageBackground, View, StyleSheet, TouchableOpacity } from 'react-native';
import ImagePreview from './ImagePreview';
import { Ionicons } from '@expo/vector-icons';
import Shimmer from './Shimmer';
const RemoveImage = ({ onPress }) => {
return (
<View style={styles.removeContainer}>
<TouchableOpacity style={styles.remove} onPress={onPress}>
<Ionicons name="ios-close" size={30} color={'white'} />
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@babel/code-frame@7.5.5", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.5.5":
version "7.5.5"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.5.5.tgz#bc0782f6d69f7b7d49531219699b988f669a8f9d"
integrity sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==
dependencies:
"@babel/highlight" "^7.0.0"
@tamunoibi
tamunoibi / logo.svg
Created September 30, 2019 10:34
svg for gist
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
{
"presets": ["env"],
"plugins": [
"transform-class-properties",
"transform-object-rest-spread",
[
"transform-runtime",
{
"polyfill": false,
"regenerator": true