Skip to content

Instantly share code, notes, and snippets.

View domjtalbot's full-sized avatar

Dom Talbot domjtalbot

  • Wiltshire, UK
  • 04:29 (UTC +01:00)
View GitHub Profile
@domjtalbot
domjtalbot / mac-unlock-all-files.sh
Last active July 23, 2020 10:13
Mac - Unlock all files and subfolders
chflags -R nouchg [directory]
# Example
# chflags -R nouchg ~/documents
{"lastUpload":"2021-04-12T08:52:09.378Z","extensionVersion":"v3.4.3"}
@domjtalbot
domjtalbot / promise-operation.swift
Created May 9, 2019 17:44
PromiseKit Operation & Queue
import Foundation
import PromiseKit
public class PromiseOperation<T>: Operation {
public enum State: String {
case executing
case finished
case ready
fileprivate var keyPath: String {
@domjtalbot
domjtalbot / pending-promise.swift
Created May 9, 2019 17:37
Create a pending PromiseKit Promise and delay execution
import Foundation
import PromiseKit
/// Create a Promise pending execution
///
/// By default Promises will execute on creation and
/// wait to be resolved. In general this behaviour is fine,
/// however there may be circumstances where this causes
/// unexpected behaviour.
/// For example when using nested promises.
@domjtalbot
domjtalbot / Webpack.cs
Created January 19, 2017 13:06
Webpack build integrated with C# MVC.net - Useful for access to Webpack build hash for generating asset urls
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
namespace Test.Models
@domjtalbot
domjtalbot / Icon.cs
Created January 19, 2017 12:38
SVG icon class for c# mvc.net env. Specifically intended for Icons8 to allow easy Icon injection, without copying and pasting embed code in mulitple places.
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Xml;
namespace Test.Models
{
/// <summary>
@domjtalbot
domjtalbot / _externalLinks.scss
Created January 9, 2017 15:46
Style external links against a list of approved internal domains using only Scss
@domjtalbot
domjtalbot / scss2json.js
Created December 15, 2016 16:13
Convert scss comments to json using sassdoc
import { magenta, yellow, red } from 'ansicolors';
import { writeFile } from 'fs';
import glob from 'glob';
import Ora from 'ora';
import { resolve, basename } from 'path';
import { parse } from 'sassdoc';
import '../../Scripts/env.es6';
import { Debug, Error } from '../../Scripts/debug.es6';
@domjtalbot
domjtalbot / js2json.js
Last active December 15, 2016 16:12
Use documentation.js to get comments from a glob of javascript files then output to a json file.
import { magenta, yellow, red } from 'ansicolors';
import { buildSync, formats } from 'documentation';
import { writeFile } from 'fs';
import glob from 'glob';
import Ora from 'ora';
import { resolve, basename } from 'path';
import '../../Scripts/env.es6';
import { Debug, Error } from '../../Scripts/debug.es6';
@domjtalbot
domjtalbot / xml2json.js
Last active January 12, 2017 09:52
Convert XML comments to Json.Specially intended for C# XML documentation files.
import { green, yellow, magenta, red } from 'ansicolors';
import { readFileSync, writeFile } from 'fs';
import mkdirp from 'mkdirp';
import Ora from 'ora';
import { resolve, basename } from 'path';
import { parseString } from 'xml2js';
import '../../Scripts/env.es6';
import { Debug, Error } from '../../Scripts/debug.es6';