Skip to content

Instantly share code, notes, and snippets.

View icfantv's full-sized avatar

Adam Gordon icfantv

View GitHub Profile
@icfantv
icfantv / controller.js
Created December 11, 2015 00:10
Multi Checkbox Example
module.controller('FormlyMultiCheckboxController', ['$scope', FormlyMultiCheckboxController]);
function FormlyMultiCheckboxController($scope) {
var to = $scope.to;
var opts = $scope.options;
$scope.multiCheckbox = {
checked: [],
change: setModel,
selectAll: false,
toggleSelectAll: toggleSelectAll
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 <jaybonci@debian.org>
# This configuration file is read by the start-memcachedx script provided as
# part of the Debian GNU/Linux distribution.
#
# Modified by Arto Jantunen <viiru@debian.org> 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 / AuthService.js
Last active January 6, 2016 20:37
AuthService with promise and cache
angular.service('AuthService', function($q, $http) {
var authStuff, promise;
this.login = function(credentials) {
if (!authStuff) {
promise = $http.post(...).then(function(response) { authStuff = response.data; });
}
return $q(function(resolve, reject) {
@icfantv
icfantv / controllers.js
Last active January 11, 2016 17:50
Modal Example
function ModalController($scope, $uibModalInstance) {
$scope.data = {};
$scope.data.form = {};
$scope.close = function() {
$uibModalInstace.close($scope.data.form);
}
$scope.cancel = function() {
@icfantv
icfantv / MyDirective.js
Created February 4, 2016 02:17
ES6 modules, Angular Directives, and you
export function MyDirective() {
return {
restrict: 'E',
controller: 'MyDirectiveController',
controllerAs: 'snoopy',
scope: {
stuff: '=yoGimmeSomeStuff'
},
templateUrl: 'components/snoopy/views/gimme-some-stuff-template.html'
};
@icfantv
icfantv / function.js
Last active February 10, 2016 19:40
Username Validation
vm.username = function($viewValue, $modelValue, scope) {
// check if username matches regex before validating
var value = $modelValue || $viewValue, deferred = $q.defer();
if (UserConfig.ID_REGEX.test(value)) {
scope.options.templateOptions.loading = true;
UserService.username(value).then(function() {
deferred.reject(false);
@icfantv
icfantv / SampleRouteConfiguration.js
Created February 12, 2016 20:23
Sample Route Provider
export function SampleRouteConfiguration($routeProvider) {
$routeProvider.when('/customer', {
controller: 'CustomerListController',
controllerAs: 'customers',
templateUrl: 'path/to/customers.html',
resolve: {
consumers: ['CustomerService', CustomerService => CustomerService.getAll()]
}
}).when('/customer/:id', {
controller: 'CustomerController',
@icfantv
icfantv / ISSUE_TEMPLATE.md
Created February 18, 2016 01:50
UIBS ISSUE_TEMPLATE.md

Uh oh! So you think you found an issue? We're so embarrassed. Prior to entering anything, please ensure you've read CONTRIBUTING.md as the issues forum is for bugs only and not for suppor-related requests. Support-related requests are best served by and for the community at large. Additionally, please note that we do not release patches for older versions of the library but we have provided some documentation history via the "Previous docs" dropdown on [our demo site] (http://angular-ui.github.io/bootstrap).

If you're upgrading from an older version of the library and you're experiencing console errors or other issues, please make sure you read through the CHANGELOG.md starting with the version from which you're upgrading. Pay particular attention to the breaking changes sections