Skip to content

Instantly share code, notes, and snippets.

View throughnothing's full-sized avatar

William Wolf throughnothing

View GitHub Profile
@throughnothing
throughnothing / Output.js
Created April 16, 2012 23:18
Compiling Mustache Template to JS function with Pure Perl
function anon140593375716472(view,partials) {
partials = partials || {};
var stack = [view]; // context stack
try {
return fn(view, partials, stack, lookup, escapeHTML, renderSection, render);
} catch (e) {
throw debug(e.error, template, e.line, options.file);
}
@throughnothing
throughnothing / node-output.js
Created April 16, 2012 23:40
Handlebars compilation with Pure Perl
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['test'] = template(function (Handlebars,depth0,helpers,partials,data) {
helpers = helpers || Handlebars.helpers;
var buffer = "", stack1, foundHelper, self=this, functionType="function", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;
foundHelper = helpers.hello;
stack1 = foundHelper || depth0.hello;
if(typeof stack1 === functionType) { stack1 = stack1.call(depth0, { hash: {} }); }
@throughnothing
throughnothing / Hello.mustache
Created April 17, 2012 03:11
Template::Mustache Sub-class example
{{hello}} World!
@throughnothing
throughnothing / Readme.md
Created April 17, 2012 04:41
Compile Hogan Templates in Pure Perl

Hulk.pl

Compile mustache templates in pure perl using JE.

Usage

$ hulk.pl *.mustache > templates.js

@throughnothing
throughnothing / hello.pl
Created April 17, 2012 14:16
Text::Caml Vs Template::Mustache
#!/usr/bin/env perl
use v5.10;
package Hello;
use Any::Moose;
sub hello { "Hello," };
sub world { "World!" };
no moose;
# End of Hello Object
@throughnothing
throughnothing / MANIFEST
Created April 23, 2012 21:35
Dancer Unicode Testing
MANIFEST
bin/app.pl
config.yml
environments/development.yml
environments/production.yml
views/index.tt
views/layouts/main.tt
MANIFEST.SKIP
lib/Unicode/Test.pm
public/css/style.css
@throughnothing
throughnothing / parks.pl
Created April 30, 2012 03:50
spark clone in perl
#!/usr/bin/env perl
# parks - spark clone in perl (https://github.com/holman/spark)
# Alternatives: https://github.com/holman/spark/wiki/Alternative-Implementations
# Wicked Cool Examples: https://github.com/holman/spark/wiki/Wicked-Cool-Usage
use List::Util qw( min max ); local $/;
my ($t, @n) = ( [qw(▁ ▂ ▃ ▄ ▅ ▆ ▇ █)], -t STDIN ? @ARGV : split ' ', <STDIN> );
print map($t->[ int( ( $_ - min(@n) ) / max(@n) * $#$t ) ], @n), "\n";

SYNOPSIS

This is a pod test on github gists.

@throughnothing
throughnothing / gist:2573224
Created May 2, 2012 02:45
ENV Variable for LWP to Ignore Cert Errors
PERL_LWP_SSL_VERIFY_HOSTNAME=0 ./lwp-script
@throughnothing
throughnothing / README.md
Created June 2, 2012 14:55
DBIx::Class::DeploymentHandler Pkey + Ordering Test

Primary Key/Ordering test for DBIx::Class::DeploymentHandler

  • Create the version 1 tables in a postgres schema, then create DBIC classes with dbicdump.sh
  • run ./gen_migration.pl 1
  • Drop tables, and create version 2 tables from db.sql
  • run ./gen_migration.pl 2
  • Check sql/PostgreSQL/upgrade/1-2/001-auto.sql
  • Should know to add the new PRIMARY KEY on test table before adding the FOREIGN KEY to test2 table