Skip to content

Instantly share code, notes, and snippets.

View Splaktar's full-sized avatar

Michael Prentice Splaktar

View GitHub Profile
@Splaktar
Splaktar / PieChart.java
Last active December 27, 2015 17:19
Quick example of how to draw a pie chart on an HTML5 canvas with GWT. It uses hard coded values. For real use, you would want to pass those percentages into the method.
import com.google.gwt.canvas.client.Canvas;
import com.google.gwt.canvas.dom.client.Context2d;
import com.google.gwt.canvas.dom.client.CssColor;
import com.google.gwt.core.client.GWT;
private void drawChart()
{
// Initialize the canvas.
final Canvas canvas = Canvas.createIfSupported();
@Splaktar
Splaktar / AlertAndConfirmHandlers.java
Last active January 1, 2016 20:39
Alert and Confirm handlers for a JavaFX WebView hosted in a Swing application.
engine.setOnAlert(new EventHandler<WebEvent<String>>() {
@Override
public void handle(WebEvent<String> event) {
JOptionPane.showMessageDialog(
myPanel,
event.getData(),
"Alert Message",
OptionPane.ERROR_MESSAGE);
}
});
@Splaktar
Splaktar / Firebug.java
Last active June 21, 2023 18:40
Enable Firebug Lite in a JavaFX WebView.
if (isDebugging())
engine.documentProperty().addListener(new ChangeListener<Document>() {
@Override
public void changed(ObservableValue<? extends Document> prop,
Document oldDoc, Document newDoc) {
enableFirebug(engine);
}
});
/**
@Splaktar
Splaktar / app.css
Created May 16, 2014 01:01
AngularJS Animations (ng-enter, ng-leave, fade, slide) in a ng-repeat div
.fade {
transition:0.5s linear all;
}
.fade.ng-enter-stagger,
.fade.ng-leave-stagger {
transiton-delay:0.1s;
transition-duration:0s;
}
.fade.ng-enter {
opacity:0;
@Splaktar
Splaktar / auto-fill-sync
Created October 23, 2014 18:43
Directive to fix input fields that need to support browser autofill such as username and password
/**
* @ngDoc directive
* @restrict A
* @description Add this attribute to input fields that need to support browser autofill such as username and password.
*/
main.directive('autoFillSync', function($timeout) {
return {
require: 'ngModel',
restrict: 'A',
link: function(scope, elem, attrs, model) {
@Splaktar
Splaktar / gist:8c955d31bc5db42e64fe
Created February 13, 2015 22:42
Using the Google Fit API via Google Play Services on Android
package com.devintent.fitness.app;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.app.TimePickerDialog;
import android.content.Intent;
import android.content.IntentSender;
@Splaktar
Splaktar / .gitignore_global
Last active October 5, 2015 03:37
Git Ignore Global
# https://github.com/github/gitignore/blob/master/Global/JetBrains.gitignore
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
@Splaktar
Splaktar / flexBox.md
Last active November 2, 2015 05:29 — forked from ThomasBurleson/flexBox.md
Angular Material - FlexBox styles for Layout features
[flex] { 
  box-sizing: border-box;
 }

[flex]           { flex: 1;         } // == { flex: 1 1 0%; }
[flex="grow"]    { flex: 1 1 100%;  }
[flex="initial"] { flex: 0 1 auto;  }
[flex="auto"]    { flex: 1 1 auto;  }
[flex="none"] { flex: 0 0 auto; }
@Splaktar
Splaktar / replicationController.json
Last active April 16, 2016 22:05
Replication Controller config spec for Kubernetes code lab
{
"apiVersion": "v1",
"kind": "ReplicationController",
"metadata": {
"name": "hello-node"
},
"spec": {
"replicas": 2,
"selector": {
"app":"hello-node"
@Splaktar
Splaktar / app.component.ts
Last active July 14, 2016 05:27 — forked from StephenFluin/app.component.ts
Angular 2 Analytics via Routing
//...
import {ROUTER_DIRECTIVES, Router, Event, NavigationEnd} from '@angular/router';
import {environment} from './environment';
//...
declare var ga : any;
//..
constructor(private router: Router ) {