Skip to content

Instantly share code, notes, and snippets.

View alonWang's full-sized avatar
😁

alonwang alonWang

😁
View GitHub Profile
@alexanderscott
alexanderscott / ZSUM.lua
Created January 26, 2015 08:53
Redis Lua script to return the sum of all scores in a ZSET
-- @desc: Return the sum of all scores in a sorted set
-- @usage: redis-cli eval "$(cat ZSUM.lua)" N <zset1> <zset2> ... <zsetN>
-- @return: integer sum
local function ZSUM(keys)
local sum = 0
local function sumKeyScores(key)
@jeffsheets
jeffsheets / AccountControllerTest.groovy
Created June 20, 2014 20:18
Spock test with Mocks of Spring MVC Rest Controller using standaloneSetup and mockMvc
import groovy.json.JsonSlurper
import org.springframework.test.web.servlet.MockMvc
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.*
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*;
import static org.springframework.http.HttpStatus.*
import spock.lang.Specification
/**
* A Spock Spring MVC Rest unit test that doesn't require a full spring context
*/