Skip to content

Instantly share code, notes, and snippets.

@uris77
uris77 / wherequery1.groovy
Created May 25, 2013 16:03
grails where query
def query = MeetingRequest.where{
requestor == meetingRequestToRemove.requestor
requestee == meetingRequestToRemove.requestee
event == meetingRequestToRemove.event
active == true
}
@uris77
uris77 / nrg_domain_model_notes.md
Created May 9, 2013 14:41
NRG Domain Modelling

Shifts

Are Shifts the same as Schedules ?

Jobs

Job:
   name: String
   label: String
 location: Location 
cart = (fudge.Fake('cart')
.provides('add')
.with_args('book')
.returns({'contents': ['book']})
.next_call()
.with_args('dvd')
.returns({'contents': ['book', 'dvd']}))
{
"_index": "introcloud",
"_type": "attendee",
"_id": "511c1f6bf44daf677e1d1ffa",
"_version": 1,
"exists": true,
"_source": {
"userId": "53FA4F27-5C81-4EC9-A2D4-0123383BCD3E",
"firstName": "Jane",...
"events": [
@uris77
uris77 / es_delete_index
Last active December 16, 2015 01:30
Elasticsearch tidbits
$ curl -XDELETE 'http://localhost:9200/index_name/'
@uris77
uris77 / drop_database
Created April 10, 2013 15:49
Mongo Tidbits
use databasename;
db.dropDatabase();
@uris77
uris77 / repo_pattern.py
Last active May 8, 2024 14:20
Example of Repository Pattern with SQLAlchemy
# This is a very crud example of using the Repository Pattern with SQLAlchemy. It allows me to completely ignore interactions with
# the database. This is only pulled in whenever I require to persist or retrieve an object from the database. The domain/business
# logic is entirely separated from persistence and I can have true unit tests for those.
# The tests for persistence are then limited to very specific cases of persistence and retrieving instances, and I can do those
# independent of the business logic. They also tend to be less tests since I only need to test them once.
@uris77
uris77 / FreshbooksToken.groovy
Created January 12, 2013 16:53
Obtaining request token from freshbooks with groovy
def index() {
String url = "https://sample.freshbooks.com/oauth/oauth_request.php"
HttpClient httpClient = new DefaultHttpClient()
def params = [
oauth_consumer_key: URLEncoder.encode("mdlabs", "UTF-8"),
oauth_callback: URLEncoder.encode("http://127.0.0.1:8080/FreshbooksOauth/oauth/callback", "UTF-8"),
oauth_version: URLEncoder.encode("1.0", "UTF-8"),
@uris77
uris77 / cache.log
Created November 26, 2012 02:06
Cache Errors
2012-11-25 20:00:36,323 [pool-7-thread-1] WARN hibernate.AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.UpdateTimestampsCache]; using defaults.
2012-11-25 20:00:36,368 [pool-7-thread-1] WARN hibernate.AbstractEhcacheRegionFactory - Couldn't find a specific ehcache configuration for cache named [org.hibernate.cache.StandardQueryCache]; using defaults.
2012-11-25 20:00:40,130 [pool-7-thread-1] WARN framework.Cglib2AopProxy - Unable to proxy method [public static final java.util.regex.Pattern stufftodo.normalizers.chicagoreader.event.ChicagoReaderEventNormalizationService.getiCalReplacePattern()] because it is final: All calls to this method via a proxy will be routed directly to the proxy.
2012-11-25 20:00:40,545 [pool-7-thread-1] WARN servlet.DefaultGrailsApplicationAttributes - ApplicationContext not found in org.codehaus.groovy.grails.APPLICATION_CONTEXT attribute of servlet context.
@uris77
uris77 / nested_definitions.groovy
Created November 21, 2012 03:15
Nested Definitions in Spock
def "parse page offset request"(){
scenario "should return default OFFSET when no value is present"
given:
when:
then:
scenario "should return the integer representation of the present value"
given:
when:
then:
scenario: "should return the default OFFSET if a non numeric value is present"