Skip to content

Instantly share code, notes, and snippets.

View brad-jones's full-sized avatar

Brad Jones brad-jones

View GitHub Profile
@brad-jones
brad-jones / systemd-boot-kernel-updater
Created June 13, 2018 05:56
Useful for when you want to dual boot with MacOs or not use Grub.
#!/usr/bin/env bash
set -eo pipefail;
echo "Fedora Systemd-Boot Kernel Update Script";
echo "================================================================================";
latestVmlinuz="$(ls -t /boot/vmlinuz* | head -1)";
latestVersion="$(echo $latestVmlinuz | sed -e 's~/boot/vmlinuz-~~' -e 's~.x86_64~~')";
echo "Installing latest kernel ($latestVersion) into systemd-boot";
@brad-jones
brad-jones / post.md
Created June 4, 2018 02:40
Get GOing with golang

Get GOing with golang

After initially starting with golang, I found it very refreshing, it's super fast, has a great supportive toolset, fantatsic IDE integrations, super duper easy cross compilation and so on.

After some time though, especially after building some more complex apps and libraries, I started to feel like I was in a giant mess of go code, sure it worked but many of the princiapls that have been so foundational in other languages, like loose coupling, dependency injection, inversion of control, even simple things like package structure and namespacing seem to have

@brad-jones
brad-jones / index.js
Created November 7, 2017 08:51
Get a list of required polyfill.io features based on browserslist
const semver = require('semver');
const browserslist = require('browserslist');
const polyFillService = require('polyfill-service');
function browserVersionMatches(browsersListVersion, polyFillServiceVersion)
{
// Do some quick and easy checks first
if (browsersListVersion === polyFillServiceVersion) return true;
if (polyFillServiceVersion === '*') return true;
if (browsersListVersion === 'all') return true;
@brad-jones
brad-jones / transpile.ts
Created October 11, 2017 00:41
ts-simple-ast script to add real reflection to typescript/javascript
import * as ts from 'typescript';
import TsSimpleAst, { TypeGuards, GetAccessorDeclaration, SetAccessorDeclaration, PropertyDeclaration, Type, TypeNode, Node, TypedNode, Scope } from "ts-simple-ast";
let ast = new TsSimpleAst
({
tsConfigFilePath: __dirname + '/tsconfig.options.json',
compilerOptions: { outDir: __dirname + '/dist' }
});
ast.addSourceFiles(__dirname + '/src/**/*{.d.ts,.ts}');
@brad-jones
brad-jones / test.cs
Created September 5, 2017 23:00
Intial setup for RazorLight dotnet 2.0
using System;
using Xunit;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Extensions;
using Microsoft.Extensions.PlatformAbstractions;
using Microsoft.AspNetCore.Mvc.Razor.Extensions;
namespace Tests.Razor
{
public class RazorTests
@brad-jones
brad-jones / Dockerfile
Created April 10, 2017 12:57
docker-dotnet-vscode
FROM microsoft/dotnet:latest
# Install Node.js repo
RUN curl -sL https://deb.nodesource.com/setup_7.x | bash -
# Install the VsCode repo
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg && \
mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg && \
echo "deb [arch=amd64] http://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list
@brad-jones
brad-jones / bitbucket-mod.js
Created September 8, 2016 05:43
Bitbucket PR Userscript
// ==UserScript==
// @name bitbucket.com User Script
// @version 0.1
// @description Copies the source branch name into the PR Title.
// @author Brad Jones
// @include https://bitbucket.org/*
// ==/UserScript==
$(document).ready(function()
{
@brad-jones
brad-jones / composer.json
Created February 27, 2016 13:12
Test Case for goaop/parser-reflection
{
"require": {
"goaop/parser-reflection": "^1.0",
"symfony/console": "^3.0"
}
}
@brad-jones
brad-jones / a-class-tpl.php
Last active February 27, 2016 05:56
Foil Nested Blocks Test Case
class AClass
{
public function Bar()
{
echo "Bar";
}
}
@brad-jones
brad-jones / graphdb-ideas.md
Last active September 2, 2015 12:51
Brads Brain Dump on Relationships, Graphs, Objects, etc

Brads Brain Dump on Relationships, Graphs, Objects, etc

How to best store all this info on disk?

I want to build an ORM without the mapping bit. ie: We use objects in our code, we relate objects to one another in our code. So lets store these object as they are and not MAP them into some other form.

NOTE: I use json to describe my data structures but it could be in any format.