Skip to content

Instantly share code, notes, and snippets.

View OwainWilliams's full-sized avatar
:octocat:
Always learning

Owain Williams OwainWilliams

:octocat:
Always learning
View GitHub Profile
DECLARE @langId int
DECLARE @siteNodeId int
DECLARE @currentDomainRecord INT
DECLARE @pageObjectType VARCHAR(100)
DECLARE @domain VARCHAR(250)
SET @domain = 'test.com'
SET @pageObjectType = 'A2CB7800-F571-4787-9638-BC48539A0EFB'
@OwainWilliams
OwainWilliams / readme.md
Last active July 15, 2023 09:53
Things I need to install on a fresh laptop
  • Visual Studio
  • PaperCut (smpt server)
  • VSCode
  • Gitkraken
  • Terminal - with nice mod
  • Slack / Discord
  • Browsers - Edge, Chrome, Brave?
  • Sql Server
  • Spotify / Sonos Controller
  • WhatsApp App

Really? Is that your job title??

Why do I say that?

When it comes to getting jobs, it's not easy for me, I go to the interview, answer all their questions with confidence and ease until the technical questions start. I freeze, panic and more often than not, I don't get the job because I know deep down the technical questions have let me done.

When at university, as part of my studies I was given the chance to do a year working for a company. I applied to a number of different companies and one of them was Microsoft. Thousands of people applied from all over the UK. The selection process went like this

@OwainWilliams
OwainWilliams / wt.json
Created December 2, 2020 17:16
Windows Terminal Settings
"profiles":
{
"defaults": {
"fontFace": "Cascadia Code PL",
"Set-Theme": "Paradox",
"useAcrylic": true,
"acrylicOpacity": 0.5
},
"list":
@inherits UmbracoViewPage<Form>
@{ Layout = null; }
<script src="/umbraco/lib/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
selector: '.textareaRTE',
branding: false,
@OwainWilliams
OwainWilliams / README-badges.md
Created July 10, 2020 09:56 — forked from tterb/README-badges.md
A collection of README badges

Badges

License

MIT License GPLv3 License AGPL License

Version

Version GitHub Release

@OwainWilliams
OwainWilliams / isthissafe.md
Last active May 22, 2020 10:02
Is this safe?

PageData will contact the contents of a div, so there will be HTML within it. I've disabled validateinput to allow for 'potentially dangerous' data.

  public class PDFController:SurfaceController
    {
        [System.Web.Http.HttpPost, ValidateInput(false)]
        public ActionResult GeneratePDF(string fileName)
        {

 var PDFMeContent = Request.Form["PageData"];
@OwainWilliams
OwainWilliams / Umbraco - Delete Older Versions.sql
Created February 4, 2020 15:45 — forked from enkelmedia/Umbraco - Delete Older Versions.sql
Remove older content versions from the Umbraco database (tested on v7.9.2)
/*
This SQL will clean up older versions of content from the umbraco database. Note that that the "tmp.RowNum"-condition
is used to set the number of versions to keep for each content node this can be changed if needed.
Note 2: If you have lots of versions (like we had) you might need to execute the delete-statements with a offset/fetch-setup in steps.
*/
IF OBJECT_ID('tempdb..#tmp') IS NOT NULL DROP TABLE #tmp
Select VersionID into #tmp FROM cmsDocument
@OwainWilliams
OwainWilliams / SQL-To-DataTable.cs
Created September 17, 2019 16:10 — forked from hanssens/SQL-To-DataTable.cs
[C#] SQL Query to Databable to CSV
// Simple example for
// 1.) Read a sql server query to datatable;
// 2.) Export it to .csv
class Program
{
static void Main(string[] args)
{
var connectionString = @"data source=bla bla bla";
var selectQuery = "select * from my-table;";
public object UploadCSV()
{
// http://www.w3spark.com/asp-net/reading-and-writing-csv-files-in-asp-net-using-c-using-csvhelper-nuget-package/
HttpPostedFile attachmentcsv = HttpContext.Current.Request.Files["file"];
var httpRequest = HttpContext.Current.Request;
if (httpRequest.Files.Count < 1)