Skip to content

Instantly share code, notes, and snippets.

View cassmtnr's full-sized avatar
☀️
Praise the Sun

Cassiano cassmtnr

☀️
Praise the Sun
  • DKB Code Factory GmbH
  • Leipzig, Germany
  • 18:40 (UTC +02:00)
View GitHub Profile
@marco79cgn
marco79cgn / spotify-now-playing.js
Last active May 2, 2024 15:22
A Scriptable iOS widget that shows what‘s playing on Spotify
let spotifyCredentials
let widget = await createWidget()
Script.setWidget(widget)
Script.complete()
async function createWidget() {
let widget = new ListWidget()
let spotifyIcon = await getImage("spotify-icon.png")
widget.backgroundColor = new Color("1e2040")
@ModPhoenix
ModPhoenix / axios-interceptors-refresh-token.js
Last active January 30, 2024 07:14
Axios interceptors token refresh for few async requests. ES6
import axios from "axios";
import { settings } from "../settings";
import { authAPI } from ".";
const request = axios.create({
baseURL: settings.apiV1,
});
request.interceptors.request.use(
(config) => {
@hkan
hkan / whatsapp-web-emoji-keywords.txt
Created April 30, 2018 16:25
Emoji shortcut keywords for Whatsapp Web
0⃣ 0, keycap, zero
1⃣ 1, number, one
🕜 1, 30, clock, time, one, thirty, 1:30, one-thirty
🕐 1, clock, time, one, 00, o’clock, 1:00, one o’clock
2⃣ 2, number, two
🕝 2, 30, clock, time, two, thirty, 2:30, two-thirty
🕑 2, clock, time, two, 00, o’clock, 2:00, two o’clock
3⃣ 3, keycap, three
🕞 3, 30, three, clock, time, thirty, 3:30, three-thirty
🕒 3, three, clock, time, 00, o’clock, 3:00, three o’clock
@wharley
wharley / aws-s3.js
Last active January 26, 2018 12:26
upload
'use strict'
const AWS = require('aws-sdk')
const env = require('../../.env')
const formidable = require('formidable')
const fs = require('fs')
const sendErrorsFromDB = (res, dbErros) => {
const errors = []
_.forIn(dbErros.errors, error => errors.push(error.message))
return res.status(400).json({ errors })
@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 => {
@myusuf3
myusuf3 / delete_git_submodule.md
Created November 3, 2014 17:36
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
// Experimental : Detect background color brightness and change the font color accordingly
$(".subject-icon").each(function() {
var isBright = (parseInt(get_brightness(rgb2hex($(this).css("background-color")))) > 160);
if (!isBright) $(this).addClass('subject-icon-dark');
});
// Check color brightness
// returns brightness value from 0 to 255
// http://www.webmasterworld.com/forum88/9769.htm
function get_brightness(hexCode) {