Skip to content

Instantly share code, notes, and snippets.

use strict;
use warnings;
use Genome;
use Devel::Size qw(size total_size);
use List::Util qw(sum);
use Scalar::Util qw(weaken);
my $list = [];
@nnutter
nnutter / gist:65b454bc7df9f2b6bffd
Created July 2, 2014 01:45
Pointers vs. References

I translated the Go example to Perl by making simple syntax transformations:

  • Printing is done with say instead of fmt.Println.
  • Variables have a sigil that define their "type", for example, $a instead of a.
  • Address of a variable is return with \ instead of &.
  • References/Pointers are dereferenced with $ instead of *.
  • Comments are made with # instead of //.
  • Perl requires semicolons.

Here's the program:

package Sorter;
use strict;
use warnings;
my @chromosome = (1..22, 'X', 'Y', 'MT');
# don't leave it up to humans unless you need to!
sub index_of {
my $i = 0;
@nnutter
nnutter / tmux.bash
Last active August 29, 2015 14:01 — forked from ttscoff/tm.bash
# Brett Terpstra 2014
# <http://brettterpstra.com>
#
# tmux wrapper
# tm session-name [window-name]
# Names can be partial from the beginning and first match will connect.
# If no match is found a new session will be created.
# If there's a second argument, it will be used to attach directly to a
# window in the session, or to name the first window in a new session.
tm() {
_tm_complete() {
local rx
local token=${COMP_WORDS[$COMP_CWORD]}
local IFS=$'\t'
local words
if [ $COMP_CWORD -eq 1 ]; then
words=$(tmux -q list-sessions 2> /dev/null | cut -f 1 -d ':' | tr "\n" " " | sed 's/ $//')
fi
if [ $COMP_CWORD -eq 2 ]; then
words=$(tmux list-windows -t ${COMP_WORDS[1]} 2> /dev/null | awk '{print $2}' | tr -d '*-' | tr "\n" " " | sed 's/ $//')
@nnutter
nnutter / tm.sh
Last active August 29, 2015 14:01
_tm_complete() {
COMPREPLY=()
local SESSIONS=$(tmux list-sessions | cut -f 1 -d :)
if [ ${#COMP_WORDS[@]} -eq 2 ]; then
local cur=${COMP_WORDS[COMP_CWORD]}
COMPREPLY=($(compgen -W "$SESSIONS" -- $cur))
fi
}
complete -F _tm_complete tm
diff --git a/pom.xml b/pom.xml
index 20c90d9..e496549 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,11 +22,11 @@ limitations under the License.
<groupId>com.googlesource.gerrit.plugins.singleusergroup</groupId>
<artifactId>singleusergroup</artifactId>
<packaging>jar</packaging>
- <version>1.0-SNAPSHOT</version>
+ <version>1.0</version>
diff --git a/tools/maven/fake_pom.xml b/tools/maven/fake_pom.xml
index a531200..7388785 100644
--- a/tools/maven/fake_pom.xml
+++ b/tools/maven/fake_pom.xml
@@ -22,6 +22,10 @@
</build>
<pluginRepositories>
<pluginRepository>
+ <id>gerrit-maven</id>
+ <url>https://gerrit-maven.commondatastorage.googleapis.com</url>
diff --git a/github-oauth/pom.xml b/github-oauth/pom.xml
index f3acf76..3263ac3 100644
--- a/github-oauth/pom.xml
+++ b/github-oauth/pom.xml
@@ -65,7 +65,7 @@ limitations under the License.
<dependency>
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-api</artifactId>
- <version>${project.version}</version>
+ <version>2.8</version>