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
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"
View minikube_uninstall.sh
minikube stop; minikube delete &&
docker stop $(docker ps -aq) &&
rm -rf ~/.kube ~/.minikube &&
sudo rm -rf /usr/local/bin/localkube /usr/local/bin/minikube &&
launchctl stop '*kubelet*.mount' &&
launchctl stop localkube.service &&
launchctl disable localkube.service &&
sudo rm -rf /etc/kubernetes/ &&
docker system prune -af --volumes
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active Oct 7, 2021
Axios interceptors for token refreshing and more than 2 async requests available
View axios-interceptors-refresh-token.js
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@kimadactyl
kimadactyl / README.sh
Last active Sep 10, 2021
Dokku / Digital Ocean / Rails / Postgres / Let's Encrypt / persistent storage
View README.sh
# Creating a Digital Ocean droplet running Rails + Postgres with persistant storage and https
#--------------------------------------------------------------------------------------------
# For your ctrl-D pleasure...
# SERVER_IP
# APP_NAME
# RAILS_SECRET (generate with `rails secret`)
# ADMIN_EMAIL
@renatoargh
renatoargh / bematech.js
Created Aug 29, 2016
Imprimindo com Bematech MP-4200 com node.js (sem cups nem módulos nativos)
View bematech.js
var fs = require('fs');
String.prototype.toBytes = function() {
var arr = []
for (var i=0; i < this.length; i++) {
arr.push(this[i].charCodeAt(0))
}
return arr;
}
@iliabylich
iliabylich / api_doc.rb
Created Feb 19, 2016
apipie with doc extracted to separate classes
View api_doc.rb
# app/concerns/controllers/api_doc.rb
#
# Controller extension with common API documentation shortcuts
#
module Controllers::ApiDoc
# Apipie doesn't allow to append anything to esisting
# description. It raises an error on double definition.
#
def append_desc(desc = "")
_apipie_dsl_data[:description] << desc << "\n"
@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active Sep 10, 2021
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
@sukima
sukima / XORCipher.js
Last active Aug 7, 2021
A Super simple encryption cipher using XOR and Base64 in JavaScript
View XORCipher.js
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/