Skip to content

Instantly share code, notes, and snippets.

View Tsugami's full-sized avatar

Yslan Ramos Tsugami

  • Brazil
  • 23:23 (UTC -03:00)
View GitHub Profile
const watchedEpisodesNow = (
media: IMedia,
season: ISeason,
episode: IEpisode,
watched: WatchedDocument | null,
sawPrevius: boolean,
): [IEpisode[], SeasonWatch[]] => {
if (!watched) {
// CREATE NEW WATCHED
@Tsugami
Tsugami / bulk.ts
Last active December 1, 2021 17:50
export enum BulkTypes {
SEQUENCE = 'SEQUENCE',
NOT_SEQUENCE = 'NOT_SEQUENCE',
}
interface NotSequenceValue {
numbers: number[];
type: BulkTypes.NOT_SEQUENCE;
}
<script>
const a = document.querySelector("table tbody");
const getPersons = async (count = 30) => {
const response = await fetch(
"https://randomuser.me/api/?results=" + count
);
const data = await response.json();
return data.results.map((person) => {
@Tsugami
Tsugami / depthEpisodeSum.ts
Last active December 3, 2021 15:39
MONGO - calculate the total of items from one array and another from another array
// Data
// [
// {
// "key": 1,
// "seasons": [
// {
// episodes: [
// 3,
// 3
// ]
import { clearDatabase, closeDatabase, connectDatabase } from '../../../../../tests/mongo';
import { mutate } from '../../../../../tests/app';
import { createUserFixture } from '../../../../../tests/user.factory';
import ERRORS from '../../../../errors';
beforeAll(async () => await connectDatabase());
beforeEach(async () => {
await clearDatabase();
declare function rename<
P extends string,
P2 extends string,
O extends object,
Key extends keyof O
>(
prefix: P,
newPrefix: P2,
obj: O
): {
export const CAST_LIST_FIELDS = gql`
${CAST_FIELDS}
fragment CAST_LIST_FIELDS on Media {
cast(first: 10) {
edges {
node {
id
...CAST_FIELDS
}
}
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react-native';
import { LoginForm } from './LoginForm';
import { withTheme } from '../../../../tests/withTheme';
import { VALIDATION_ERROR_MESSAGES } from '../../../../Constants';
jest.mock('@expo/vector-icons', () => ({
Ionicons: '',
AntDesign: '',
}));
@Tsugami
Tsugami / README.md
Last active December 24, 2021 23:48
My first codemod!
@Tsugami
Tsugami / source.ts
Last active December 29, 2021 02:31
codemod to replace Array.each to for-in in javascript
/**
* Paste or drop some JavaScript here and explore
* the syntax tree created by chosen parser.
* You can use all the cool new features from ES6
* and even more. Enjoy!
*/
const name = 1
const description = 'Yo ' + name + '! How are you doing? ' + 1