Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Marlos marlosirapuan

🏠
Working from home
  • João Pessoa, PB - Brazil
View GitHub Profile
@marlosirapuan
marlosirapuan / file-upload.tsx
Created Apr 30, 2021 — forked from Sqvall/file-upload.tsx
File Upload with Chakra UI and react-hook-form
View file-upload.tsx
import { ReactNode, useRef } from 'react'
import { Button, FormControl, FormErrorMessage, FormLabel, Icon, InputGroup } from '@chakra-ui/react'
import { useForm, UseFormRegisterReturn } from 'react-hook-form'
import { FiFile } from 'react-icons/fi'
type FileUploadProps = {
register: UseFormRegisterReturn
accept?: string
multiple?: boolean
children?: ReactNode
View apollo_client.ts
import ApolloClient, { FetchPolicy } from "apollo-client"
import { HttpLink } from "apollo-link-http"
import { InMemoryCache, NormalizedCacheObject } from "apollo-cache-inmemory"
// import { setContext } from "apollo-link-context"
import ActionCable from "action-cable-react-jwt"
import ActionCableLink from "graphql-ruby-client/dist/subscriptions/ActionCableLink"
import { ApolloLink } from "apollo-link"
import { handleAuthentication, refreshToken } from "utils/oauth"
import { Observable } from "apollo-link"
import { onError } from "apollo-link-error"
@marlosirapuan
marlosirapuan / Dokku v0.5.6 Rails App.md
Created Jul 30, 2020 — forked from Epigene/Dokku v0.5.6 Rails App.md
Knowledge-Base for getting a Rails5 app with Cable running on dokku v0.5.6
View Dokku v0.5.6 Rails App.md

Dokku v0.5.6 Rails workflow

Straight to Maintenance

0. Set up Droplet

Initialize the droplet with dokku app pre-setup
@marlosirapuan
marlosirapuan / example_activejob.rb
Created Oct 5, 2019 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
View example_activejob.rb
class MyJob < ActiveJob::Base
queue_as :urgent
rescue_from(NoResultsError) do
retry_job wait: 5.minutes, queue: :default
end
def perform(*args)
MyService.call(*args)
end
View ruby_custom_field_with_postgresql_and_metaprogramming.rb
begin
require 'bundler/inline'
rescue LoadError => e
$stderr.puts 'Bundler version 1.10 or later is required. Update your Bundler'
raise e
end
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '5.1.3'
@marlosirapuan
marlosirapuan / apns.sh
Created Nov 20, 2018 — forked from unnamedd/apns.sh
cURL the APNS HTTP/2 API
View apns.sh
# Note: You MUST have curl 7.47+ with http/2 support compiled in
curl -v \
-d '{"aps":{"alert":"<message>","badge":42}}' \
-H "apns-topic: <bundle id>" \
-H "apns-priority: 10" \
--http2 \
--cert <certificate file> \
https://api.development.push.apple.com/3/device/<device token>
View Installing wkhtmltopdf 0.12.4 - Ubuntu 16.04.md

You can check here for getting the latest version. Change the wget url to download newer versions.

Install

$ wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz
$ cd wkhtmltox/bin/
$ sudo mv wkhtmltopdf /usr/bin/wkhtmltopdf
@marlosirapuan
marlosirapuan / bulma_breadcrumbs_builder.rb
Last active Oct 10, 2017 — forked from SaladFork/bootstrap4_breadcrumbs_builder.rb
`breadcrumbs_on_rails` builder with Bulma compatible output
View bulma_breadcrumbs_builder.rb
# `BulmaBreadcrumbsBuilder `is a Bulma compatible breadcrumb
# builder. It is designed to work with the `breadcrumbs_on_rails` gem as a
# drop-in builder replacement.
#
# BulmaBreadcrumbsBuilder accepts a limited set of options:
#
# | option | default | description |
# | ---------------- | ------- | ------------------------------------------ |
# | `:container_tag` | `:ol` | What tag to use for the list container |
# | `:tag` | `:li` | What HTML tag to use for breadcrumb items |
@marlosirapuan
marlosirapuan / gulpfile.js
Created Feb 26, 2016 — forked from plasticbrain/gulpfile.js
gulp.js task to deploy code to remote servers
View gulpfile.js
/*******************************************************************************
* Description:
*
* Gulp file to push changes to remote servers (eg: staging/production)
*
* Usage:
*
* gulp deploy --target
*
* Examples: