Skip to content

Instantly share code, notes, and snippets.

View lucasmotta's full-sized avatar

Lucas Motta lucasmotta

View GitHub Profile
@bodokaiser
bodokaiser / context.ts
Last active August 10, 2023 01:00
React Hook integration for AWS Amplify Auth
import React from "react"
import { CognitoUser } from "@aws-amplify/auth"
import { useAuth } from "./hooks"
import { SignInInput } from "./types"
interface AuthState {
user: CognitoUser | null
signIn(input : SignInInput): Promise<void>
signOut(): Promise<void>
/* eslint react/jsx-props-no-spreading:0 */
import React, { ReactNode } from 'react';
import { ViewProps } from 'react-native';
import {
SpaceProps,
ColorProps,
LayoutProps,
FlexProps,
FlexDirectionProps,
AlignItemsProps,
@IanColdwater
IanColdwater / twittermute.txt
Last active April 22, 2024 17:26
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@sibelius
sibelius / metro.config.js
Created May 7, 2019 14:38
Metro config that works well with monorepo
/**
* Metro configuration for React Native
* https://github.com/facebook/react-native
*
* @format
*/
const path = require('path');
const { FileStore } = require('metro-cache');
@miljan-aleksic
miljan-aleksic / calendar-matrix.js
Last active August 19, 2022 12:24
Calendar Matrix (date-fns, ES6) inspired by https://github.com/bclinkinbeard/calendar-matrix
import getYear from 'date-fns/get_year'
import getMonth from 'date-fns/get_month'
import addDays from 'date-fns/add_days'
import startOfWeek from 'date-fns/start_of_week'
const rows = range(6)
const cols = range(7)
/**
* Returns a two-dimensional array with calendar represented dates
@MicheleBertoli
MicheleBertoli / demo.js
Created August 31, 2016 10:49
Erdux - Unpredictable state container for JavaScript apps
class DecrementAction extends Error {}
class IncrementAction extends Error {}
const reducer = (state, error) => {
switch (error.constructor) {
case DecrementAction:
return state - 1
case IncrementAction:
return state + 1
@MicheleBertoli
MicheleBertoli / react-router-context.js
Created July 17, 2015 15:42
If you want to test a react 0.13.3 component and you are using the react-router 0.13.3, you need this:
import React, {Component} from 'react';
export default ReactRouterContext = (Element) => {
class RouterStub {}
RouterStub.makePath = () => {};
RouterStub.makeHref = () => {};
RouterStub.transitionTo = () => {};
RouterStub.replaceWith = () => {};
@indieisaconcept
indieisaconcept / gist:936dbf33cfc844d87968
Last active February 2, 2023 19:58
browserify + watchify + viny-transform + multiple bundles
// this setup assumes you are using gulp-config for file.src & file.dest
// but can be adapted to vanilla easily.
'use strict';
var transform = require('vinyl-transform'),
browserify = require('browserify'),
watchify = require('watchify'),
// consider using gulp-load-plugins
@kyohei8
kyohei8 / browserify.coffee
Last active June 25, 2017 01:26
gulp with browserify/watchify multiple file compile task
gulp = require 'gulp'
browserify = require 'browserify'
watchify = require 'watchify'
source = require 'vinyl-source-stream'
colors = require 'colors'
files = [
{
@stonehippo
stonehippo / install_ruby_with_rbenv.md
Last active April 6, 2024 23:44
Installing a new Ruby with rbenv on Mac OS

Install a new Ruby with rbenv on Mac OS (and make yourself a superhero)

If you're doing stuff with Ruby on a Mac, e.g. installling Jekyll or something, by default you'll end up having to use the sudo command to do stuff, since the permission to modify the default config is not available to your user account.

This sucks and should be avoided. Here's how to fix that.

Installing a new Ruby

To make this better, we are going install a new, custom Ruby. This used to be a big, scary thing, but thanks to the awesome tools Homebrew and rbenv, it's a snap.*

A word of warning: you will have to use Terminal to install this stuff. If you are uncomfortable with text, words, and doing stuff with your computer beyond pointing and hoping, this may not work well for you. But if that's the case, I'm not sure why you were trying to use Ruby in the first place.