Skip to content

Instantly share code, notes, and snippets.

View MarcinSwierczynski's full-sized avatar

Marcin Świerczyński MarcinSwierczynski

View GitHub Profile
@vinilios
vinilios / install xapian inside virtualenv
Created October 1, 2009 14:53
xapian local installation
apt-get install zlib1g-dev
apt-get install g++
export VENV=$VIRTUAL_ENV
mkdir $VENV/packages && cd $VENV/packages
curl -O http://oligarchy.co.uk/xapian/1.0.16/xapian-core-1.0.16.tar.gz
curl -O http://oligarchy.co.uk/xapian/1.0.16/xapian-bindings-1.0.16.tar.gz
tar xzvf xapian-core-1.0.16.tar.gz
@edavis10
edavis10 / _config.yml
Created November 6, 2009 02:18
Pagination in Jekyll
# ....other stuff here
paginate: 10
@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"}
@ck1125
ck1125 / MySimpleFiltersSpec
Created June 9, 2012 17:37
Filters with dependencies mocking with Spock
package grails_filter_tests
import spock.lang.Specification
import org.springframework.beans.factory.config.MethodInvokingFactoryBean
import grails.test.mixin.*
import grails.test.mixin.support.GrailsUnitTestMixin
import grails.test.mixin.web.FiltersUnitTestMixin
@TestFor(SimpleController)
@TestMixin([GrailsUnitTestMixin,FiltersUnitTestMixin])
@Mock(MySimpleFilters)
@timyates
timyates / sort.groovy
Created August 10, 2012 14:02
Sort with multiple comparators
List list = [
[id:0, firstName: 'Sachin', lastName: 'Tendulkar', age: 40 ],
[id:1, firstName: 'Sachin', lastName: 'Tendulkar', age: 103 ],
[id:2, firstName: 'Ajay', lastName: 'Tendulkar', age: 48 ],
[id:3, firstName: 'Virendra', lastName: 'Sehwag', age: 5 ],
[id:4, firstName: 'Virendra', lastName: 'Sehwag', age: 50 ],
[id:5, firstName: 'Sachin', lastName: 'Nayyar', age: 15 ]
]
Collection.metaClass.sort = { boolean mutate, Closure... closures ->
@agentgt
agentgt / SpringExceptionTranslationExecuteListener.java
Created September 7, 2012 20:23
JOOQ Spring Transaction support.
package com.snaphop.jooq;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
import org.jooq.ExecuteContext;
import org.jooq.impl.DefaultExecuteListener;
@rajatvig
rajatvig / InputStreamMatcher
Last active July 18, 2019 13:49
InputStream Matcher for Mockito
package test.support;
import com.google.common.io.CharStreams;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
import java.io.IOException;
import java.io.InputStream;
@lucko
lucko / auto-sign-commits-mac.md
Last active April 15, 2024 08:26
Auto-sign commits with IntelliJ on MacOS

Run:

  • brew install gnupg pinentry-mac
  • git config --global user.signingkey <key>
  • git config --global commit.gpgsign true
  • git config --global gpg.program gpg

Then add the following line to ~/.gnupg/gpg-agent.conf:

pinentry-program /usr/local/bin/pinentry-mac
@lregnier
lregnier / scala-with-style-by-martin-odersky.md
Last active March 16, 2023 21:41
Scala with Style, by Martin Odersky