Skip to content

Instantly share code, notes, and snippets.

View zaosoula's full-sized avatar
🤖

Zao Soula zaosoula

🤖
View GitHub Profile
window.am5geodata_switzerlandLow = (function () {
const map = {"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"MultiPolygon","coordinates":[[[[-3.288,34.226],[-3.288,34.217],[-3.278,34.217],[-3.278,34.18],[-3.269,34.175],[-3.269,34.156],[-3.283,34.147],[-3.32,34.147],[-3.32,34.152],[-3.334,34.152],[-3.334,34.147],[-3.348,34.147],[-3.353,34.156],[-3.362,34.156],[-3.362,34.17],[-3.353,34.18],[-3.344,34.184],[-3.334,34.194],[-3.33,34.203],[-3.32,34.203],[-3.316,34.212],[-3.316,34.221],[-3.297,34.221],[-3.288,34.226]]],[[[-2.44,34.258],[-2.432,34.255],[-2.417,34.255],[-2.403,34.245],[-2.395,34.236],[-2.391,34.227],[-2.373,34.214],[-2.362,34.213],[-2.335,34.195],[-2.325,34.183],[-2.309,34.178],[-2.277,34.158],[-2.266,34.148],[-2.235,34.127],[-2.224,34.126],[-2.209,34.121],[-2.194,34.112],[-2.175,34.112],[-2.157,34.094],[-2.143,34.089],[-2.128,34.088],[-2.124,34.084],[-2.118,34.064],[-2.11,34.054],[-2.109,34.04],[-2.095,34.026],[-2.095,34.019],[-2.085,34.009],[-2.087,33.989],[-2.065,33.
@zaosoula
zaosoula / vite.config.js
Created December 27, 2023 18:11
VITE + SVGR + SVGO: Unique svg's ids prefix
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from "vite-plugin-svgr";
import { customAlphabet } from 'nanoid';
const prefixList = new Set();
const nanoid = customAlphabet("0123456789abcdefghijklmnopqrstuvwxyz", 10);
const uniquePrefix = () => {
let prefix;
do {
@zaosoula
zaosoula / microsoft.strategy.ts
Created December 17, 2023 17:46
FeatherJS OAuth Strategy for Microsoft
import { AuthenticationRequest } from '@feathersjs/authentication'
import { OAuthProfile, OAuthStrategy } from '@feathersjs/authentication-oauth'
import { GeneralError } from '@feathersjs/errors'
import { Params } from '@feathersjs/feathers'
import axios from 'axios'
import { logger } from '../../../logger'
export class MicrosoftStrategy extends OAuthStrategy {
async getProfile(authResult: AuthenticationRequest, _params: Params) {
const { accessToken } = authResult
@zaosoula
zaosoula / scriptable.js
Created January 27, 2023 00:32
Scriptable's WebView with externals links opening in Safari
const view = new WebView();
view.shouldAllowRequest = request => {
if(request.url.startsWith("http")) {
Safari.open(request.url);
return false;
}
return true;
}
@zaosoula
zaosoula / relative-time.js
Last active May 4, 2022 10:10 — forked from danott/relative_time.php
Twitter style relative time.
const computeRelativeTime = (time) => {
if(typeof time === 'string') {
return computeRelativeTime(new Date(time));
}
const plural = (val) => val !== 1 ? 's' : '';
const format = (val, unit) => `${val} ${unit}${plural(val)} ago`;
let diff = (Date.now() - time.getTime()) / 1000;
@zaosoula
zaosoula / gitToZipArchive.sh
Last active December 20, 2021 19:48 — forked from betweenbrain/gist:4731411
Git archive changes made between two commits
git archive --format zip --output=./changes.zip HEAD $(git diff --name-only <SHA> <SHA>)
alias ls='ls -G'
alias ..='cd ..'
alias start='npm run start'
alias updalias='source ~/.bashrc'
alias wget='wget -c '
alias makepass="openssl rand -base64 20"
alias ipe='curl ipinfo.io/ip'
alias ipl='ipconfig getifaddr en0'
alias c='clear'
@zaosoula
zaosoula / extractor.js
Last active August 12, 2017 14:22
HTML Select with all font-awesome icon by group (v4.7)
//Need to be run on : http://fontawesome.io/icons/
$.map($("h2.page-header").map(function(){
var a = $(this).nextAll(".row:first").find("a").map(function(){
return $(this).attr('href').split("/").slice(-1)[0];
});
return {title: $(this).html(), options: a}
}), function(object){ return "<optgroup label='"+object.title+"'>"+$.map($.unique(object.options), function(option){ return "<option>"+option+"</option>"; }).join("")+"</optgroup>"; }).join("");
@zaosoula
zaosoula / fontawesome-brand-array.json
Created October 22, 2016 21:52
JSON FontAwesome Brand Array
{
"500px.com": {
"color": "#0099e5",
"name": "500px",
"unicode": "\\f26e "
},
"amazon.com": {
"color": "#ff9900",
"name": "amazon",
"unicode": "\\f270 "