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:20 (UTC -03:00)
View GitHub Profile
@michaellihs
michaellihs / tmux-cheat-sheet.md
Last active April 4, 2024 04:10
tmux Cheat Sheet
@sukima
sukima / XORCipher.js
Last active March 20, 2024 07:28
A Super simple encryption cipher using XOR and Base64 in JavaScript
// 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/
@mkjiau
mkjiau / axios-interceptors-refresh-token.js
Last active March 13, 2024 10:59
Axios interceptors for token refreshing and more than 2 async requests available
let isRefreshing = false;
let refreshSubscribers = [];
const instance = axios.create({
baseURL: Config.API_URL,
});
instance.interceptors.response.use(response => {
return response;
}, error => {
@ChuckJHardy
ChuckJHardy / example_activejob.rb
Last active March 3, 2024 20:10
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
@renatoargh
renatoargh / bematech.js
Created August 29, 2016 02:57
Imprimindo com Bematech MP-4200 com node.js (sem cups nem módulos nativos)
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;
}
@kimadactyl
kimadactyl / README.sh
Last active August 29, 2022 20:47
Dokku / Digital Ocean / Rails / Postgres / Let's Encrypt / persistent storage
# 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
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
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"