Skip to content

Instantly share code, notes, and snippets.

View rfreedman's full-sized avatar
🏠
Working from home

Rich Freedman rfreedman

🏠
Working from home
View GitHub Profile
@rfreedman
rfreedman / DebouncedOnClickListener.java
Created May 14, 2013 03:09
A debounced onClickListener for Android
import android.os.SystemClock;
import android.view.View;
import java.util.Map;
import java.util.WeakHashMap;
/**
* A Debounced OnClickListener
* Rejects clicks that are too close together in time.
* This class is safe to use as an OnClickListener for multiple views, and will debounce each one separately.
@rfreedman
rfreedman / Experiment.java
Created October 13, 2018 16:35
Test of LocalDate interoperability with JPA and JDBC
package edu.princeton.gfts.experimental;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;
@Component
@rfreedman
rfreedman / sample-list.component.spec.ts
Created February 12, 2018 17:35
Example of using unroll in an async test for an Angular Component
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
import {SampleService} from './sample.service';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {ConfigurationService, LoggerService, PUDateTimePipe, PUDateTimePipeModule, PULoggerModule} from '@princeton/pu-csi-angular-core';
import {SampleListComponent} from './sample-list.component';
import {CommonModule} from '@angular/common';
import {BrowserModule} from '@angular/platform-browser';
import {SharedAnimationsModule} from '../shared/animations/shared-animations.module';
import {HttpClient, HttpClientModule} from '@angular/common/http';
{
"apiUrl": "http://example.org",
"foo": "bar"
}
@rfreedman
rfreedman / gallery.component.ts
Last active July 31, 2017 13:45
Example for use of angular2-lightbox
@rfreedman
rfreedman / gist:1214540
Created September 13, 2011 18:07
modified Mammal CoffeeScript example
class Mammal
constructor: (@species, @defining_char) ->
print: ->
"Hello I'm a " + @species + ". " +
"I have " + @defining_char + "."
cat = new Mammal('cat', 'claws')
alert(cat.print())
@rfreedman
rfreedman / spock-integration-grails-controller.groovy
Created May 13, 2011 14:41
Spock Integration Test for Grails Controller Example
class CompoundInstanceControllerIntegrationSpec extends ControllerSpec {
static transactional = true
def "saving a new compound instance and compound"() {
setup:
controller.metaClass.message = {args -> "mockMessage"}
@rfreedman
rfreedman / spock-controller-integration-spec.groovy
Created May 19, 2011 13:41
Spock Integration Spec for Grails Controllers
/* Copyright 2011 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@rfreedman
rfreedman / sample
Created April 5, 2011 01:30
sample gist
public class SampleGist {
public static void main(String[] args) {
System.out.println("this is a gist");
}
}