Skip to content

Instantly share code, notes, and snippets.

@maybe-joe
maybe-joe / ToolbarA.xaml
Last active November 16, 2018 20:26
A basic example of how to show a dialog box using prism and the mvvm pattern in wpf
<UserControl x:Class="Example.ToolbarA"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:interactionRequest="http://www.codeplex.com/prism"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
@maybe-joe
maybe-joe / View.xaml
Created May 18, 2014 22:39
An example of event handling with prism
<Button Command="{Binding Path=RaiseNotificationCommand}">Click Me</Button>
@maybe-joe
maybe-joe / magento_test.php
Created June 27, 2014 04:28
Magento -> Test Harness
<?php
# Place this in the root of your magento dir
# navigate to this script to test classes
include "app/Mage.php";
Mage::app();
trigger EmailMessageTrigger on EmailMessage(after insert, after update) {
Set<Id> emailsWithAttachments = new Set<Id>();
for(EmailMessage email : Trigger.New){
if (email.Incoming) {
emailsWithAttachments.add(email.Id);
}
}
List<Attachment> attachments = [
@maybe-joe
maybe-joe / fx-listview.css
Created April 5, 2016 04:49
Remove the default border from JavaFX Listviews
.list-view {
-fx-background-insets: 0;
-fx-padding: 0;
}
@maybe-joe
maybe-joe / fx-listcell.css
Created April 5, 2016 04:50
Remove the selection effect and row colours from JavaFX Listview Listcells
.list-cell:filled:selected:focused,
.list-cell:filled:selected,
.list-cell:even,
.list-cell:odd {
-fx-background-color: transparent;
}
@maybe-joe
maybe-joe / .csscomb.json
Created July 2, 2016 02:25
Css Comb Config
{
"remove-empty-rulesets": true,
"always-semicolon": true,
"color-case": "lower",
"block-indent": " ",
"color-shorthand": false,
"element-case": "lower",
"eof-newline": true,
"leading-zero": true,
"quotes": "single",
@maybe-joe
maybe-joe / flat.js
Last active July 15, 2016 05:55
Flatter abs in just 3 refactorings!
// Run $node flat.js to test
// Test data
let context = {
succeed: () => console.log('Context Succeed')
};
function authenticateToSalesforce () {
return new Promise((resolve, reject) => resolve({data: 'authorization data'}));
}
@maybe-joe
maybe-joe / DynamicQuery.cs
Created September 15, 2016 23:16
Duct typing and using
/*
* This is a silly little test to remove the word using from data access classes.
* Beware that null will be returned if the dynamic object doesn't match the return type of the calling function.
*/
private dynamic IHateTheWordUsing(Func<UmbracoDBDataContext, dynamic> command)
{
using (var context = new UmbracoDBDataContext(sqlConnection))
{
return command(context);
@maybe-joe
maybe-joe / Main.elm
Created December 19, 2018 00:35
Example of a basic elm app using flags
module Main exposing (main)
import Browser exposing (..)
import Html exposing (..)
type alias Model =
{ url : String
, title : String
}