Skip to content

Instantly share code, notes, and snippets.

Avatar

ab5tract ab5tract

  • Amsterdam, Netherlands
View GitHub Profile
View bag.patch
commit d96dccd1737ed4ab7e5cf293a178f7d28aa1e1f1
Author: ab5tract <john.haltiwanger@gmail.com>
Date: Sat Aug 29 11:41:11 2015 +0200
Coercion from Set.list (via Any) is bonkers
diff --git a/src/core/Setty.pm b/src/core/Setty.pm
index e86b44d..4e491e0 100644
--- a/src/core/Setty.pm
+++ b/src/core/Setty.pm
View jr.rbuby compatible Rakefile
begin
$: << 'lib'; %w( rubygems rake/testtask rake/rdoctask rake/gempackagetask extensions/all
utilities/string utilities/symbol date).each { |dep| require dep }
rescue LoadError => e
if e.message == 'no such file to load -- extensions/all'
puts "Better do `rake setup` to get all the fancies you're missing"
puts
else
raise e
end
View database-uri.rb
# I was hoping something like this might work ....
# The hope was that config.database could as easily be a string as a hash....
+++configurations/development.rb
module Blog
module Configurations
class Development < Default
View gist:2016
<ab5tract> we are trying to figure out the best/preferred way to interface with sequel
<ab5tract> so if thats what you recommend, we'l write a converter function that takes the hash and turns it into a URI
<jeremyevans> ab5tract: That function is already there. Database#uri
<ab5tract> well, thats handy :)
* wishdev (n=jwh@67.170.158.202) has joined #sequel
<ab5tract> jeremyevans, does Database#uri take a hash?
<ab5tract> its sort of a stupid question, but im not getting the kind of uri i would expect by doing:
<ab5tract> irb(main):007:0> q = Sequel::Database.new :adapter => 'jdbc', :database_type => 'postgresql', :host => 'localhost', :database => 'jblog', :user => 'waves'
<ab5tract> => #<Sequel::Database: "://waves@localhost/jblog">
<ab5tract> irb(main):009:0> q.uri
View Pattern Store
//////////////////////////
// Pattern Store
/////////////////////////
// parameters declaration
const PATTERNs = 8;
const STEPs = 32;
const IOs = 4;
var MEMs : integer;
View IndexOfChangedArray.cpp
//-----------------------------------------------------------------------------
// includes
//-----------------------------------------------------------------------------
#include "IndexOfChangedArray.h"
#include <vector>
//----------------------------------------------------------------------------
// create, general info and destroy methodes
//----------------------------------------------------------------------------
View gist:b0421b4ecd03942d1ebc
diff --git a/src/core/set_operators.pm b/src/core/set_operators.pm
index 841851f..7f72e91 100644
--- a/src/core/set_operators.pm
+++ b/src/core/set_operators.pm
@@ -108,16 +108,35 @@ only sub infix:<<"\x2216">>(|p) {
infix:<(-)>(|p);
}
-proto sub infix:<(^)>($, $ --> Setty) {*}
-multi sub infix:<(^)>(Any $a, Any $b --> Setty) {
@ab5tract
ab5tract / gist:5b65a86e7a1926079187
Created Oct 28, 2014
experiments in lookup inlining - perl 6
View gist:5b65a86e7a1926079187
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> $message.split(' ')
it go
> (@words Z 1 xx @words.elems).hash
"does" => 1, "go" => 1, "how" => 1, "it" => 1
> (@words Z 1 xx @words.elems).hash<$_> for @words
> (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
> say (@words Z 1 xx @words.elems).hash<$_> for $message.split(' ')
(Any)
@ab5tract
ab5tract / leaning on MMD
Last active Aug 29, 2015
Two possible approaches to coercion in set comparisons
View leaning on MMD
multi sub infix:<<(<)>>(Bag $a, Bag $b --> Bool) {
[&&] $a.keys.map({ $a{$_} < $b{$_} });
}
multi sub infix:<<(<)>>(Bag $a, Any $b --> Bool) {
$b = $b.bag(:view);
[&&] $a.keys.map({ $a{$_} < $b{$_} });
}
multi sub infix:<<(<)>>(Any $a, Bag $b --> Bool) {
@ab5tract
ab5tract / adventorator
Last active Aug 29, 2015
Adventures in Perl 6 Document Publishing
View adventorator
# The Plural of Advent is Adventerati
use v6;
#use XML;
#use XML::Parser::Tiny;
use HTML::Parser::XML;
use HTTP::UserAgent;