Skip to content

Instantly share code, notes, and snippets.

View GaProgMan's full-sized avatar
💭
Somewhere on the call stack

Jamie Taylor GaProgMan

💭
Somewhere on the call stack
View GitHub Profile
@GaProgMan
GaProgMan / program.cs
Created March 24, 2020 10:49
Comparing nullables without having to use a .HasValueCheck
using System;
namespace comparingNullables
{
public class Program
{
private int? nullableInt = default;
private int nonNullableInt = 7;
private bool? nullableBool = default;
// default for bools is false, so let's use a value which
@GaProgMan
GaProgMan / startup.cs
Last active January 8, 2019 09:12
CORS example - .NET Core
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy("nameOfPolicyHere", builder =>
{
builder.WithOrigins("array of strings", "representing origins");
// headers can be complext to start with, so I would start with
//builder.AllowAnyHeader();
// just to get it working first, then reduce the number of headers
@GaProgMan
GaProgMan / avconv-bash-script.sh
Last active August 24, 2016 12:31
Calls avconv on all mkv container files found in the folder on which it is run.
# assumes that all subtitles have been removed
# and only one audio stream (and it is located at 0:1)
# TODO: add support for all subtitle and audio tracks
for file in *.mkv
do
# extract and convert audio
echo Extracting audio from "$file"
avconv -i "$file" -map 0:1 -c:a aac -b:a 160k -strict experimental audio_$(basename "$file" .mkv).m4a
@GaProgMan
GaProgMan / SmsFixer.cs
Last active February 24, 2016 20:17
Sms XML fixer
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Xml.Serialization;
namespace SmsFixer
{
static class Program
{
@GaProgMan
GaProgMan / CV.tex
Last active September 15, 2020 21:48
The LaTeX Template that I have used for typesetting my C.V for several years.
%%% LaTeX Template: Curriculum Vitae
%%%
%%% Source: http://www.howtotex.com/
%%% Feel free to distribute this template, but please keep the referal to HowToTeX.com.
%%% Date: July 2011
%%% Edited by Jamie Taylor (http://gaprogman.com)
%%% Added a definition for a "hobbies" section
%%% Added pdfinfo call to add metadata to outputted PDF
%%% Date April 2015
@GaProgMan
GaProgMan / JavaScriptPlayground
Last active August 29, 2015 14:04
A scratch-pad (playground) for javascript stuff, as I learn it.
/* Invoking functions via parameters to other functions */
var work = function() {
console.log("this is being invoked");
};
var doWork = function(f) {
console.log("invoking work");
try {
f();
} catch (ex) {
@GaProgMan
GaProgMan / EqualsOverloading.cs
Last active April 24, 2019 07:49
An example of how to over load the ==, !=, Equals and GetHashCode operators and methods for a custom class in C#
using System;
namespace ScratchPad
{
public class Foo
{
private string _name;
private string _title;
private string _address;
private bool _contacted;
/*
* Project Name: BigDipper
* Solution Name: BigDipper
* Original creation date: 24/03/2008
* Edit date: 19/01/2013
* Programmer name: Jamie Taylor (aka "GaProgMan")
* File name: VBigDipper.cpp
*
* Purpose of the project:
* My favourite constellation is the Big Dipper. So
@GaProgMan
GaProgMan / Parents.pl
Last active December 25, 2015 07:49
A short Prolog script that works with a family dataset. There are basic commands to reason the relationships of the members of the family.
/*
* Project Name: Parents
* Solution Name: Parents
* Original creation date: 01/10/2006
* Edit date: 11/10/2013
* Programmer name: Jamie Taylor (aka "GaProgMan")
* File name: parents.pl
*
* Purpose of the project:
* This project was undertaken as coursework in class
@GaProgMan
GaProgMan / yuv.c
Created February 3, 2013 09:53
A VERY basic code implementation for converting from RGB colour space to YUV colour space
/*
* Project Name: RGB to Y'UV
* Solution Name: RGB to Y'UV
* Original creation date: 19/11/2011
* Edit date: 18/01/2013
* Programmer name: Jamie Taylor (aka "GaProgMan")
* File name: YUV.c
*
* Purpose of the project:
* I was reading through a wikipedia article on