Skip to content

Instantly share code, notes, and snippets.

@ffbit
ffbit / ArrayAndArraysAsListTest.java
Created February 10, 2013 22:01
Array and its Derived List in Java
package com.ffbit.collections;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
@ffbit
ffbit / SortTest.java
Last active December 12, 2015 10:39
Sorting in Java
package com.ffbit.fun.array;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import java.util.Arrays;
import java.util.Collection;
import static org.hamcrest.CoreMatchers.is;
@ffbit
ffbit / scopes.txt
Last active December 13, 2015 17:09
Request and Page scopes
{
Request scope
{
Page scope 1
}
{
Page scope 2
}
@ffbit
ffbit / PermutationNumber.java
Last active December 14, 2015 04:09
Find sequence number of a particular permutation in a lexicographical order.
package com.ffbit.permutation;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertThat;
import java.util.Arrays;
import java.util.Collection;
import org.junit.Test;
import org.junit.runner.RunWith;
@ffbit
ffbit / sbt-useful-commands.md
Created February 25, 2013 13:03
SBT useful commands

Download sources and javadoc for all dependencies

sbt update-classifiers

For further information read Useful SBT Commands.

@ffbit
ffbit / sonar-prepare.sql
Created March 3, 2013 12:19
Sonar PostgreSQL preparation
CREATE ROLE sonar WITH LOGIN PASSWORD 'password';
CREATE DATABASE sonar
WITH OWNER = sonar
ENCODING 'UTF8';
GRANT ALL PRIVILEGES ON DATABASE sonar TO sonar;
@ffbit
ffbit / pr.md
Created March 21, 2013 08:31 — forked from piscisaureus/pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@ffbit
ffbit / pom.xml
Created March 23, 2013 13:48
Java 1.6 Maven pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ffbit</groupId>
<artifactId>some-artifact</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
@ffbit
ffbit / pass-gen-apg.sh
Created April 13, 2013 18:07
apg password generator
#!/bin/bash
apg -a 0 -t -s
function asyncForeach(array, fn, callback) {
var completed = 0;
var arrayLength = array.length;
if(arrayLength === 0) {
callback();
}
for(var i = 0; i < arrayLength; i++) {
fn(array[i], i, function() {
completed++;
if(completed === arrayLength) {