Skip to content

Instantly share code, notes, and snippets.

@yoojene
yoojene / writeBlob.ts
Created November 3, 2022 14:30
Couple of ways to write Blobs / Files from base64 strings
const writeBase64StringAsBlob = (dataUrl: string): Blob => {
const mimeType = dataUrl.slice('data:'.length, dataUrl.indexOf(';'));
const data = dataUrl.slice(doc.indexOf(';base64,') + ';base64,'.length);
const arrayBufferView = base64ToArrayBuffer(data);
const blob = new Blob([arrayBufferView], {
type: mimeType });
@yoojene
yoojene / deleteRemoteTrackingBranches.sh
Last active November 3, 2022 14:32
Prune remote git branches then delete local tracking equivalents
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -d
@yoojene
yoojene / mock-active-router.ts
Created December 3, 2021 11:54 — forked from dvaJi/mock-active-router.ts
Mock ActivatedRoute (with snapshot, queryParams and params), tested in Angular 7+
import { Params } from '@angular/router';
import { BehaviorSubject } from 'rxjs';
export class MockActivatedRoute {
private innerTestParams?: any;
private subject?: BehaviorSubject<any> = new BehaviorSubject(this.testParams);
params = this.subject.asObservable();
queryParams = this.subject.asObservable();
@yoojene
yoojene / fetchXMLHttpRequest.js
Created March 18, 2021 10:50
fetch / XMLHttpRequest
const myHeaders = new Headers();
myHeaders.append('mobileorigin-device', 'true');
myHeaders.append('Content-Type', 'application/pdf')
myHeaders.append('Cookie', localStorage.getItem('set-cookie'))
fetch(url, {method: 'GET', mode: 'cors', headers: myHeaders}).then(res => console.log(res))
const oReq = new XMLHttpRequest();
oReq.open('GET', url, true);
oReq.setRequestHeader("mobileorigin-device", "true");
@yoojene
yoojene / pfizerGrv.js
Last active March 20, 2020 12:15
pfizerGrv.js HL PoC
function janrainCaptureWidgetOnLoad() {
janrain.events.onCaptureLoginStart.addHandler(function (event) {
console.log('** on capture login start ***');
console.log(event);
})
janrain.events.onCaptureLoginSuccess.addHandler(function (event) {
// do stuff
console.log('** on capture login success ***');
@yoojene
yoojene / pre_store_submission_checks.py
Created May 24, 2019 07:14
Pre App Store Submission Checks
# Check for common build submission issues
# Description for Camera / Calendar plist entries
# Androud min and target SDK matches standards
# Icons must not contain alpha channels
# Adobe Anaylics app name etc
import plistlib
import sys
import json
@yoojene
yoojene / skeleton.html
Created April 10, 2019 09:18
Skeleton html
<div class="skeleton-board" [class.fade-out]="hasDataLoaded">
<div class="skeleton-board--circle"></div>
<div class="skeleton-board--remaining-days-container">
<div class="skeleton-board--remaining-days">{{remainingDays}} {{daysText}}</div>
<h2 class="until-quit-date">{{untilYourQuitDateText}}</h2>
</div>
@yoojene
yoojene / skeleton.scss
Created April 10, 2019 09:17
Skeleton SCSS
skeleton-board {
$skeletonColor : #ececec;
$animationDuration : 1500ms;
.skeleton-dashboard {
// position the skeleton cards absolute,
// this way a nice crossfade is possible
position: absolute;
@yoojene
yoojene / email_form.scss
Created April 10, 2019 09:05
Angular reactive form SCSS
page-create-account-email {
.div-terms-body{
float: right;
width: 90%;
text-align: -webkit-left;
}
.page-create-account-email {
@yoojene
yoojene / email_form.html
Created April 10, 2019 09:04
Angular reactive form HTML example
<ion-header>
<ion-navbar>
<ion-title>{{createAccountTitle}}</ion-title>
</ion-navbar>
</ion-header>
<ion-content class="page-create-account-email" padding>
<div class="page-create-account-email--main-text" text-center [innerHTML]="this.createAccountBodyText">
</div>
<ion-list>
<form [formGroup]="emailForm" (ngSubmit)="onSubmit()">