Skip to content

Instantly share code, notes, and snippets.

View icfantv's full-sized avatar

Adam Gordon icfantv

View GitHub Profile
@icfantv
icfantv / FontResource.java
Last active April 20, 2018 13:03
font resource
public interface FontResource extends ClientBundle
{
FontResource INSTANCE = GWT.create(FontResource.class);
@Source("font1.otf")
DataResource font1();
@Source("font2.otf")
DataResource font2();
public class AccessDeniedException_CustomFieldSerializer extends CustomFieldSerializer<AccessDeniedException>
{
public static void deserialize(SerializationStreamReader streamReader, AccessDeniedException instance) {}
public static AccessDeniedException instantiate(SerializationStreamReader streamReader)
throws SerializationException {
return new AccessDeniedException(streamReader.readString());
}
public static void serialize(SerializationStreamWriter streamWriter, AccessDeniedException instance)
@icfantv
icfantv / Snippet.java
Created March 26, 2013 19:23
JHighlight and GWT/GXT
String xml = "<root><elt>sum stuff</elt><elt anAttribute=\"attr_value\">more stuff</elt></root>";
XmlXhtmlRenderer renderer = new XmlXhtmlRenderer();
try
{
result = renderer.highlight("some-text-can-be-anything", xml, "UTF-8", true);
LOGGER.trace("added syntax highlighting to XML: {}", result);
}
catch (IOException ex)
{
LOGGER.error("unable to syntax hightlight adi xml for asset: {}", assetKey, ex);
@icfantv
icfantv / memcachedb.conf
Created August 15, 2013 21:01
memcachedb.conf file
# memcachedb default config file
# 2003 - Jay Bonci <[email protected]>
# This configuration file is read by the start-memcachedx script provided as
# part of the Debian GNU/Linux distribution.
#
# Modified by Arto Jantunen <[email protected]> for use with memcachedb
# Run memcachedb as a daemon. This command is implied, and is not needed for the
# daemon to run. See the README.Debian that comes with this package for more
# information.
@icfantv
icfantv / snippet.gwt.xml
Created February 6, 2014 20:45
gwt.xml snippet
<!-- this will cause both a production and debug version of the code to be built. in the event of
a client-side error, the user can specify ?debug=true on the URI as the query string and the
debug version of the code will be used such that an emulated stacktrace will be displayed.
This has the effect of us being able to see exactly on what lines of code the error is
occurring.
Additionally, the debug flag is used to dictate what type of error dialog is presented to the
user in the event of an exception being thrown. In production mode, only a simple dialog
with the exception error is displayed. In debug mode, a dialog is displayed with the
exception stacktrace (if available). -->
@icfantv
icfantv / app-controllers.js
Last active August 29, 2015 14:04
Using AngularJS with RequireJS
define(['authorization'], function () {
'use strict';
angular.module('app-controllers', [])
.controller('MainController',
['$scope', '$timeout', 'AuthorizationService',
function ($scope, $timeout, authorizationService) {
// stuff
@icfantv
icfantv / DateFormatProvider.java
Last active August 29, 2015 14:05
Date/Time Format Provider for GWT/GXT
package com.foo.bar.shared;
public interface DateFormatProvider
{
public Date format(String pattern, String dateString);
}
@icfantv
icfantv / directive.js
Created August 14, 2014 17:18
Angular Watch Firing
define(function () {
'use strict';
angular.module('qualifier-directives', [])
.directive('qualifierStatistics',
function () {
function processStatistics($scope, mode) {
// sort the normalized statistics in decending order based on the count
@icfantv
icfantv / example.html
Created May 6, 2015 16:47
ControllerAs Syntax
<html>
<head>
<!-- include angular -->
</head>
<body data-ng-app='app'>
<div data-ng-controller='MyController as MyController'>
<!-- bound once -->
Controller Loaded: {{ ::MyController.someModel.controllerLoaded }}
<hr/>
<!-- two-way binding -->
@icfantv
icfantv / IsolateFormDirective.js
Created May 18, 2015 18:50
Isolate Form Directive
function IsolateFormDirective() {
return {
restrict: 'A',
require: '?form',
link: function link(scope, $element, attrs, formController) {
if (!formController) {
return;
}