Skip to content

Instantly share code, notes, and snippets.

View bipoza's full-sized avatar
📱

Bittor Poza bipoza

📱
View GitHub Profile
@bipoza
bipoza / fetch-and-convert-to-base64.js
Last active November 14, 2022 11:35 — forked from n1ru4l/index.js
Fetch blob and convert to base64
export const fetchAsBlob = url => fetch(url)
.then(response => response.blob());
export const convertBlobToBase64 = blob => new Promise((resolve, reject) => {
const reader = new FileReader;
reader.onerror = reject;
reader.onload = () => {
resolve(reader.result);
};
reader.readAsDataURL(blob);
@bipoza
bipoza / sign-in-with-apple.md
Created March 1, 2022 16:18 — forked from aamishbaloch/sign-in-with-apple.md
Sign In with Apple using Django (Python) Backend

Implementing Sign In with Apple in your Django (Python) backend

Apple announced a new feature, "Sign In with Apple" enabling users to sign in to apps using their Apple ID. This new feature is meant to be a secure and privacy-friendly way for users to create an account in apps. Most iOS and Mac users already have an Apple ID, and this new feature lets them use that Apple ID to sign in to other apps and websites.

Apple is taking a firm stance to protect user's privacy, rather than letting applications see the user's real email address, they will provide the app with a fake or random email address unique to each app. Don't you worry! Developers will still be able to send emails to these proxy addresses, it just means developers won't be able to use the email addresses in any other way. This feature will also allow users to disable email forwarding per application.

How it works

Apple adopted the existing standards OAuth 2.0 and OpenID Connect to use as the foundation for their new API. If you're familiar

@bipoza
bipoza / jwt-apple-signin.py
Created December 2, 2021 14:48 — forked from davidhariri/jwt-apple-signin.py
Code required to verify Sign in with app-made Apple JWT tokens server-side in Python
import jwt
from jwt.algorithms import RSAAlgorithm
import requests
from time import time
import json
import os
APPLE_PUBLIC_KEY_URL = "https://appleid.apple.com/auth/keys"
APPLE_PUBLIC_KEY = None
@bipoza
bipoza / Apple_mobile_device_types.txt
Created September 24, 2021 14:23 — forked from adamawolf/Apple_mobile_device_types.txt
List of Apple's mobile device codes types a.k.a. machine ids (e.g. `iPhone1,1`, `Watch1,1`, etc.) and their matching product names
i386 : iPhone Simulator
x86_64 : iPhone Simulator
arm64 : iPhone Simulator
iPhone1,1 : iPhone
iPhone1,2 : iPhone 3G
iPhone2,1 : iPhone 3GS
iPhone3,1 : iPhone 4
iPhone3,2 : iPhone 4 GSM Rev A
iPhone3,3 : iPhone 4 CDMA
iPhone4,1 : iPhone 4S
add_shortcode('wps_event_link', 'wps_event_link');
function wps_event_link() {
$post_id = '{{ post_data:ID }}';
}
@bipoza
bipoza / wc-products-displayed-per-page.php
Created December 16, 2020 09:08 — forked from woogists/wc-products-displayed-per-page.php
[Theming Snippets] Change number of products displayed per page
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
$cols = 9;
return $cols;
@bipoza
bipoza / stop-video.js
Created September 9, 2020 14:26 — forked from cferdinandi/stop-video.js
A simple method to stop YouTube, Vimeo, and HTML5 videos from playing.
/**
* Stop an iframe or HTML5 <video> from playing
* @param {Element} element The element that contains the video
*/
var stopVideo = function ( element ) {
var iframe = element.querySelector( 'iframe');
var video = element.querySelector( 'video' );
if ( iframe ) {
var iframeSrc = iframe.src;
iframe.src = iframeSrc;
@bipoza
bipoza / token.interceptor.ts
Created July 28, 2020 08:29 — forked from danielcrisp/token.interceptor.ts
TokenInterceptor - Async HTTP Interceptors with Angular 4
import { Injectable } from '@angular/core';
import { HttpErrorResponse, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/mergeMap';
import { AuthService } from './auth.service';
@Injectable()
export class TokenInterceptor implements HttpInterceptor {
@bipoza
bipoza / textarea-autosize.directive.ts
Created January 2, 2020 11:40 — forked from kplhub/textarea-autosize.directive.ts
textarea autosize directive for ionic/angular 4 (updated to work with 4.0.0)
import { Directive, ElementRef, OnInit } from '@angular/core';
import { Observable, fromEvent } from 'rxjs';
import { DomController } from '@ionic/angular';
@Directive({
selector: 'ion-textarea[autosize]'
})
export class TextareaAutosizeDirective implements OnInit {