Skip to content

Instantly share code, notes, and snippets.

class OutShow {
private void out(String msg) {
println("******* " + getClass().simpleName + ": " + msg);
}
public static void main(String[] args) {
new OutShow().out("hi");
}
@finneycanhelp
finneycanhelp / SomethingTests.groovy
Created January 17, 2011 20:23
Test Showing Why "as" operator is important
package com
import grails.test.GrailsUnitTestCase;
import com.SomeService
class SomethingTests extends GrailsUnitTestCase {
void testSomething() {
Something thing = new Something()
// thing.someService = [ get : { a -> throw new Throwable() } ] as SomeService // works
@finneycanhelp
finneycanhelp / Something.groovy
Created January 17, 2011 20:27
simple groovy Something calling a grails service "someService"
package com
class Something {
def someService
boolean methodWeAreTesting() {
someService.get()
}
@finneycanhelp
finneycanhelp / SomeService.groovy
Created January 17, 2011 20:30
SomeService with a "get" method that just returns false
package com
class SomeService {
static transactional = true
boolean get(String something) {
return false
}
}
@finneycanhelp
finneycanhelp / HappyControllerTests.groovy
Created March 6, 2011 19:57
calling demand twice on GrailsMock
package com.fch
import grails.test.*
class HappyControllerTests extends ControllerUnitTestCase {
GrailsMock staticWorldMock
protected void setUp() {
super.setUp()
@finneycanhelp
finneycanhelp / hardcoded_winasmile_request.js
Created June 19, 2011 01:47
hard coded request to winasmile json server
$(function() {
$.getJSON('http://winasmile.finneycanhelp.c9.io', function(data) {
var msg = data.message;
$('.messageContainer').html(msg);
});
@finneycanhelp
finneycanhelp / FetchedResultsControllerTableViewDataSource.swift
Created May 31, 2016 12:26
Showing Why associatedtype had to conform
import Foundation
import RealmSwift
import SwiftFetchedResultsController
protocol FetchedResultsControllerTableViewDataSource: class {
associatedtype T : Object
var fetchedResultsController: FetchedResultsController<T>? { get set }

Keybase proof

I hereby claim:

  • I am finneycanhelp on github.
  • I am finneycanhelp (https://keybase.io/finneycanhelp) on keybase.
  • I have a public key ASAmsimbE-61H5mn5ZjFzHqG6uKcTWCjk1cZEIyXc_--7Ao

To claim this, I am signing this object: