Skip to content

Instantly share code, notes, and snippets.

View gabsprates's full-sized avatar
:shipit:
Focusing

Gabriel Prates gabsprates

:shipit:
Focusing
View GitHub Profile
@gabsprates
gabsprates / README.md
Created June 1, 2022 14:49
A helper I built to test Next.js' Middleware functions

Using the helper:

const middlewareDeps = buildMiddlewareDependencies({
  route: '/path/to/[slug]',
  params: { slug: 'acme' },
  cookies: { access_token: 'api_will_deal_with_it' },
});

const response = await middleware(middlewareDeps.request, middlewareDeps.event);
@gabsprates
gabsprates / testes.md
Last active January 8, 2022 21:59
Testes
import React from "react";
type Props = {
onDrop: (x: number) => void;
};
type State = {
left: number;
moving: boolean;
};
@gabsprates
gabsprates / minify-grapqh-loader.js
Created January 12, 2019 18:43
Loader that minify GraphQL queries and mutations. To be used with graphql-tag/loader
module.exports = function(source) {
var minified = source
.replace(/(\s)?\{(\s)?/gm, "{")
.replace(/\s\s/gm, "")
.replace(/(\s)?\}(\s)?/gm, "}");
return minified;
};
import * as React from "react";
import TodoList from "./TodoList";
class TodoApp extends React.Component {
constructor(props) {
super(props);
this.state = { items: [], text: '' };
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
@gabsprates
gabsprates / TodoApp.tsx
Created February 18, 2018 16:41
TodoApp do React
class TodoApp extends React.Component {
constructor(props) {
super(props);
this.state = { items: [], text: '' };
this.handleChange = this.handleChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
render() {
return (
@gabsprates
gabsprates / toggleft.sh
Created November 6, 2017 00:36
as I use mouse on left hand, i made that for change when someone to use my mouse
#!/bin/bash
handed=$(gsettings get org.gnome.desktop.peripherals.mouse left-handed)
if [ $handed == true ]
then
gsettings set org.gnome.desktop.peripherals.mouse left-handed false
else
gsettings set org.gnome.desktop.peripherals.mouse left-handed true
fi
atom-clock
atom-typescript
autocomplete-js-import
autocomplete-php
busy-signal
color-picker
editorconfig
file-icons
highlight-selected
intentions
@gabsprates
gabsprates / .editorconfig
Last active December 19, 2018 21:53
🌐 💻 boilerplate to start a react app
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
{
"perguntas": [
{
"question": "Qual n\u00e3o \u00e9 uma origem do Ingl\u00eas?",
"options": [
"Anglo Sax\u00f4nica",
"Latina",
"Francesa",
"Africana"
],