Skip to content

Instantly share code, notes, and snippets.

View john-lay's full-sized avatar

John Lay john-lay

  • Cork, Ireland
View GitHub Profile

Create an bash script at /usr/local/bin/soffice with following content

#!/bin/bash

# Need to do this because symlink won't work
# It complains about some .plist files
/Applications/LibreOffice.app/Contents/MacOS/soffice "$@"

Make it executable

@john-lay
john-lay / runfold.scala
Created October 15, 2018 08:56
Scala consuming source with run fold
for {
// List.empty is the starting point we want to add our results to
foundList <- callToSourceFunction.runFold(List.empty) {
// list is a reference to List.empty
(list, newAdditions) => list :+ newAdditions
}
// foundList, instead of adding the results to an empty list we are adding them to our previous results
classifiedList <- callToOtherSourceFunction.runFold(foundList) {
(list, newAdditions) => list :+ newAdditions
}
@john-lay
john-lay / Web.config
Created March 12, 2018 10:51
Request header field Access-Control-Allow-Headers is not allowed by itself in preflight response
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Content-Type,Access-Control-Allow-Origin,Authorization" />
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Credentials" value="true" />
</customHeaders>
</httpProtocol>
TO_CHAR(TO_TIMESTAMP(creation_timestamp / 1000), 'DD/MM/YYYY HH24:MI:SS')
module Assets {
'use strict';
export var heroSprite: Phaser.Sprite;
export var zombieSprite: Phaser.Sprite;
}
// produces the following js
var Assets;
(function (Assets) {
'use strict';
@john-lay
john-lay / Web.config
Created February 18, 2016 09:15
Umbraco CORS
<httpProtocol>
<customHeaders>
<remove name="X-Powered-By" />
<add name="Access-Control-Allow-Methods" value="GET, PUT, POST, DELETE, HEAD" />
<add name="Access-Control-Allow-Headers" value="Origin, X-Requested-With, Content-Type, Accept" />
</customHeaders>
</httpProtocol>
@john-lay
john-lay / directive.ts
Last active February 16, 2016 11:21
Angular TypeScript Directive
module DatePickerModule {
'use strict';
export class DatePickerDirective {
constructor($rootScope: ng.IScope) {
var directive: ng.IDirective = {
restrict: 'A', // Attribute
link: ($scope: ng.IScope, element: JQuery, attrs: ng.IAttributes) => {
var d = new Date();
@john-lay
john-lay / Settings.Stylecop.xml
Last active February 16, 2016 11:24
Stylecop settings with PrefixLocalCallsWithThis and PrefixCallsCorrectly disabled
<StyleCopSettings Version="4.3">
<GlobalSettings>
<CollectionProperty Name="DeprecatedWords">
<Value>preprocessor,pre-processor</Value>
<Value>shortlived,short-lived</Value>
</CollectionProperty>
</GlobalSettings>
<Parsers>
<Parser ParserId="StyleCop.CSharp.CsParser">
<ParserSettings>
@john-lay
john-lay / umbraco.cshtml
Created October 9, 2015 08:49
Umbraco view
@using Newtonsoft.Json
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
Layout = null;
var page = (IPublishedContent)this.CurrentPage;
var isPreview = Request.Cookies["UMB_PREVIEW"] != null;
Dictionary<string, object> dictionary = new Dictionary<string, object>();
addNode(Model.Content, dictionary);
@john-lay
john-lay / Windows startup shell
Last active October 15, 2018 08:49
Windows 10 startup
1. Open run dialog (Win+R)
2. shell:Startup