Skip to content

Instantly share code, notes, and snippets.

View marlosirapuan's full-sized avatar
🏖️
Working from home

Marlos marlosirapuan

🏖️
Working from home
  • João Pessoa, PB - Brazil
  • 10:33 (UTC -03:00)
View GitHub Profile
@marlosirapuan
marlosirapuan / ApolloClient.ts
Created July 19, 2022 21:11 — forked from RobinDaugherty/ApolloClient.ts
Apollo client setup with ActionCable using TypeScript
import ActionCable from 'actioncable';
import { ActionCableLink } from 'graphql-ruby-client';
import { ApolloClient } from "apollo-client";
import { ApolloLink, Operation } from "apollo-link";
import { DefinitionNode, OperationDefinitionNode } from 'graphql';
import { RetryLink } from "apollo-link-retry";
import { createHttpLink } from "apollo-link-http";
import { InMemoryCache } from "apollo-cache-inmemory";
import { onError } from "apollo-link-error";
@marlosirapuan
marlosirapuan / file-upload.tsx
Created April 30, 2021 18:18 — forked from Sqvall/file-upload.tsx
File Upload with Chakra UI and react-hook-form
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
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 / example_activejob.rb
Created October 5, 2019 00:41 — forked from ChuckJHardy/example_activejob.rb
Example ActiveJob with RSpec Tests
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
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 November 20, 2018 16:13 — forked from unnamedd/apns.sh
cURL the APNS HTTP/2 API
# 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>

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 May 22, 2023 20:47 — forked from SaladFork/bootstrap4_breadcrumbs_builder.rb
`breadcrumbs_on_rails` builder with Bulma compatible output
# `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 February 26, 2016 16:22 — forked from plasticbrain/gulpfile.js
gulp.js task to deploy code to remote servers
/*******************************************************************************
* Description:
*
* Gulp file to push changes to remote servers (eg: staging/production)
*
* Usage:
*
* gulp deploy --target
*
* Examples: