Skip to content

Instantly share code, notes, and snippets.

View arthurdenner's full-sized avatar
🤓
Always trying to improve my skills and knowledge to apply them everywhere.

Arthur Denner arthurdenner

🤓
Always trying to improve my skills and knowledge to apply them everywhere.
View GitHub Profile
@arthurdenner
arthurdenner / busca-gulosa-arthur-denner.js
Created April 19, 2018 21:08
Busca Gulosa - Arthur Denner
const map = {
iasi: [
{ city: 'neamt', distance: 87 },
{ city: 'vaslui', distance: 92 },
],
vaslui: [
{ city: 'urziceni', distance: 142 },
{ city: 'iasi', distance: 92 },
],
urziceni: [
@arthurdenner
arthurdenner / semantic.min.css
Created March 15, 2019 15:11
Minified version of Semantic UI 2.2.10
/*
* # Semantic UI - 2.2.10
* https://github.com/Semantic-Org/Semantic-UI
* http://www.semantic-ui.com/
*
* Copyright 2014 Contributors
* Released under the MIT license
* http://opensource.org/licenses/MIT
*
*/
@arthurdenner
arthurdenner / machine.js
Created October 21, 2019 11:38
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@arthurdenner
arthurdenner / get-dependencies-list-yarn.js
Created November 5, 2019 15:51
Gist to get the commands to update your dependencies and devDependencies with yarn
const { dependencies, devDependencies } = require('./package.json');
const depKeys = Object.keys(dependencies).join(' ');
const devDepKeys = Object.keys(devDependencies).join(' ');
const depInstall = `yarn add ${depKeys}`;
const devDepInstall = `yarn add -D ${devDepKeys}`;
console.log(depInstall);
console.log('');
@arthurdenner
arthurdenner / generate-ios.sh
Last active January 3, 2020 17:21 — forked from monmonja/generate-ios.sh
generate ios from command line
# download this file to your project folder and excute
# chmod +x generate-ios.sh
# then run using
# ./generate-ios.sh
# flutter build defaults to --release
flutter build ios --no-codesign
# make folder, add .app then zip it and rename it to .ipa
mkdir -p Payload
@arthurdenner
arthurdenner / expansion_tile_sample.dart
Last active February 27, 2020 18:23
Custom version of expansion_tile_sample example from Flutter repo
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'dart:math';
import 'package:flutter/material.dart';
class ExpansionTileSample extends StatelessWidget {
@override
Widget build(BuildContext context) {
import 'package:flutter/material.dart';
class BasicAppBarSample extends StatefulWidget {
@override
_BasicAppBarSampleState createState() => _BasicAppBarSampleState();
}
class _BasicAppBarSampleState extends State<BasicAppBarSample> {
Choice _selectedChoice = choices[0];
@arthurdenner
arthurdenner / custom-matchers.ts
Last active May 20, 2020 12:13
Jest custom `toMatch` with string normalization
import { matcherHint, printReceived, printExpected } from 'jest-matcher-utils';
const matches = (received: string, expected: string | RegExp) =>
typeof expected === 'string'
? received.includes(expected)
: expected.test(received);
const normalize = (text: string) => text.replace(/\s+/g, ' ').trim();
expect.extend({
@arthurdenner
arthurdenner / fs-promises-proxy.js
Last active May 8, 2021 14:22
Intercepting fs.promises methods to customize behaviour at runtime with Proxies
// Original source code: https://github.com/ErickWendel/securing-files-using-nodejs-crypto-yt
// Proxy documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy
// app.js
// `promises` is now a param instead of an import
async function run(promises) {
...
}
// index.js
// Place the code below in the file below to reproduce it:
// https://github.com/remotion-dev/remotion/blob/main/packages/example/src/RemoteVideo/index.tsx
import {useRef} from 'react';
import {interpolate, useCurrentFrame, Video} from 'remotion';
const RemoteVideo: React.FC = () => {
const frame = useCurrentFrame();
const ref = useRef<HTMLVideoElement>(null);
return (