Skip to content

Instantly share code, notes, and snippets.

@maybe-joe
maybe-joe / configuration.go
Last active March 30, 2019 05:04
This snippet of code downloads, decrypts, and decodes private keys and config that shouldn't be hard coded or stored in a repository.
package configuration
import (
"bytes"
"cloud.google.com/go/storage"
"context"
"encoding/base64"
"golang.org/x/oauth2/google"
cloudkms "google.golang.org/api/cloudkms/v1"
)
@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
}
@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 / 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 / .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 / 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 / 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;
}
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 / 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();
@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>