Skip to content

Instantly share code, notes, and snippets.

View leon's full-sized avatar

Leon Radley leon

View GitHub Profile
@leon
leon / my.component.txt
Created March 15, 2023 08:10
Angular Wrap Forms component
Template driven forms:
viewProviders: [
{ provide: ControlContainer, useExisting: NgForm }
]
Reactive
viewProviders: [
{ provide: ControlContainer, useExisting: FormGroupDirective }
]
@leon
leon / convert-hrd-to-dds.sh
Created February 16, 2023 16:24
Convert .hdr to .dds
#!/bin/bash
echo "Converting HDR"
# https://github.com/dariomanesku/cmft
SCRIPT_DIR=${0%/*}
HDR_FILE=${1%%.*}
# 8bits 128x128
@leon
leon / CompareTools.plist
Created August 17, 2022 12:32
GitTower VSCode as diff and merge tool - Juli 2022 Edition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>ApplicationIdentifier</key>
<string>com.microsoft.VSCode</string>
<key>ApplicationName</key>
<string>Visual Studio Code</string>
<key>DisplayName</key>
@leon
leon / README.md
Last active April 21, 2023 07:04
NX tailwind 3 setup

Tailwind 3 has jit mode and purge built in.

So we only need to specify a list of globs to the content prop of the tailwind.config.js

@nrwl/workspace contains a function called createGlobPatternsForDependencies which can generate an array of globs that you can pass to tailwind.

@leon
leon / test.yml
Created March 1, 2020 17:51
Nrwl NX github actions
name: Test develop and feature branches
on:
push:
branches:
- develop
- "feature/*"
jobs:
test:
@leon
leon / auth.state.ts
Created April 1, 2018 17:55
NGXS auth state
import { Router } from '@angular/router';
import { Action, Selector, State, StateContext, Store } from '@ngxs/store';
import { AngularFireAuth } from 'angularfire2/auth';
import * as firebase from 'firebase';
import { take, tap } from 'rxjs/operators';
import {
CheckSession,
LoginWithFacebook,
@leon
leon / aframe-map-controls.js
Created October 7, 2017 15:18
Aframe Map Controls
/* global AFRAME THREE */
if (typeof AFRAME === 'undefined') {
throw new Error('Component attempted to register before AFRAME was available.');
}
var radToDeg = THREE.Math.radToDeg;
/**
* Example component for A-Frame.
@leon
leon / index.html
Last active May 11, 2017 11:55
Click bug in d3 v4 and zoom
<!DOCTYPE html>
<meta charset="utf-8">
<svg width="960" height="500"></svg>
<script src="https://d3js.org/d3.v4.min.js"></script>
<script>
var svg = d3.select("svg"),
width = +svg.attr("width"),
height = +svg.attr("height"),
transform = d3.zoomIdentity;;
@leon
leon / localstorage.service.ts
Created February 25, 2017 16:22
Angular LocalStorageService
import { Injectable } from '@angular/core';
@Injectable()
export class LocalStorageService {
public localStorage: any;
constructor() {
if (!localStorage) {
throw new Error('Current browser does not support Local Storage');
@leon
leon / secure-http.service.ts
Created December 30, 2016 18:47
Angular Secure HTTP Service (JWT)
import {
Http,
ConnectionBackend,
Headers,
Request,
RequestOptions,
RequestOptionsArgs,
Response,
RequestMethod,
} from '@angular/http';