Skip to content

Instantly share code, notes, and snippets.

@logie17
logie17 / indexer-simple.pl
Created September 22, 2011 23:47
An example indexer using Lucy::Simple
#! /usr/bin/env perl
# Example from https://metacpan.org/module/Lucy::Simple
use Lucy::Simple;
my $index = Lucy::Simple->new(
path => './index',
language => 'en',
);
@logie17
logie17 / search-simple.pl
Created September 22, 2011 23:49
An example of querying Lucy with Lucy::Simple
#! /usr/bin/env perl
use strict;
use warnings;
use Lucy::Simple;
my $index = Lucy::Simple->new(
path => './index',
language => 'en',
@logie17
logie17 / dezi_config.pl
Created October 14, 2011 15:01
Dezi Config Example
# example Dezi server config file, in Perl format
# Dezi uses Config::Any, so any format supported by
# that module should work as well.
#use SWISH::Prog::Config;
use CHI;
my $c = {
engine_config => {
package Shutterstock::Si::Schema::Result::Message;
use Shutterstock::Si::Schema::Candy;
primary_column id => { data_type => 'int', is_auto_increment => 1, extra => { unsigned => 1 } };
column message => { data_type => 'text' };
column created => { data_type => 'datetime', set_on_create => 1, };
#belongs_to ( channel => 'Shutterstock::Si::Schema::Result::Channel', 'channel_id' );
@logie17
logie17 / lucy
Created August 15, 2012 16:24
Errno with unsuccessful remove
using src/Charmonizer/Test/TestLargeFiles.c as example:
Line:138
if ( -1 == remove("_charm_large_file_test") ) {
Util_warn("Error removing file %s\n", strerror(errno));
}
@logie17
logie17 / gist:3802495
Created September 28, 2012 22:54
Build Errors
make: Nothing to be done for `tests'.
cc -I../core -Ixs -I. -Iautogen/include -I/Users/loganbell/perl5/perlbrew/perls/perl-5.16.0/lib/5.16.0/darwin-2level/CORE -std=gnu99 -D_GNU_SOURCE -fvisibility=hidden -c -fno-common -DPERL_DARWIN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -O3 -o ../core/Clownfish/ByteBuf.o ../core/Clownfish/ByteBuf.c
In file included from ../core/Clownfish/ByteBuf.c:27:
In file included from autogen/include/Clownfish/VTable.h:36:
autogen/include/parcel.h:183:5: error: use of undeclared identifier 'lucy_VTable'
cfish_VTable **parent_ptr
^
autogen/include/parcel.h:104:22: note: expanded from macro 'cfish_VTable'
#define cfish_VTable lucy_VTable
^
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :tag => 'v7-3-712'
version '7.3.712'
head 'https://vim.googlecode.com/hg/'
def install
#! /usr/bin/perl
package Foo;
use Moose;
use Test::More;
has foo => ( is => 'rw');
has bar => ( is => 'ro', writer => 'bar' );
has baz => ( is => 'ro', writer => 'set_baz');
my $obj = Foo->new;
[9:44]:rake
Building Charmonizer Tests
cd /Users/loganbell/work/lucy-git/charmonizer
make CC=clang DEFS=-fno-common -DFCRUBY -fno-strict-aliasing -pipe -fstack-protector -std=gnu99 -D_GNU_SOURCE -I/Users/loganbell/work/lucy-git/clownfish/runtime/ruby tests
make: Nothing to be done for `tests'.
cd /Users/loganbell/work/lucy-git/clownfish/runtime/ruby
Building Clownfish
cd ../../compiler/ruby
Building Clownfish compiler...
@logie17
logie17 / gist:4700281
Created February 3, 2013 02:14
rekey
use Benchmark qw{cmpthese};
sub rekey1(\%\%) {
my ($key_map, $old_hash) = @_;
return
map { exists $key_map{$_}
? ( $key_map{$_} => $old_hash{$_} )
: ( $_ => $old_hash{$_} )
}
keys %old_hash;