Skip to content

Instantly share code, notes, and snippets.

maschine bimmerlabs

Block or report user

Report or block bimmerlabs

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View conditional = vs == warning
open($fh, "<", $path1.$file )
# if path1 fails, try path2 and set missing boolean to 1
or $missing = 1 and open($fh, "<", $path2.$file )
or warn "can't open $file in $path1, $path2;
bimmerlabs /
Last active Nov 28, 2018
Renames Tekla Structures pointcloud files to be human readable
use Mojo::Base -base;
use Mojo::Util qw(getopt);
use Mojo::File;
use Mojo::DOM;
getopt 'p|path=s' => \my $path;
sub main {
# look in xml elements for laserscans that have hashes for names, then rename.
bimmerlabs /
Last active Jul 13, 2018
Subprocess error: Connection already closed when using a line like "if (defined $self->param('foo') { ... }" and the param is not defined
#!/usr/bin/env perl
use Mojolicious::Lite;
# it turns out a race condition was being caused, that accidentally 'won' every time before -
# but the updated Mojolicious made the broken code apparent. This no longer works:
get '/' => sub {
my $self = shift;
bimmerlabs / deployment.bat
Created Feb 28, 2018
Mojolicious server batch file for Windows - runs on startup so you don't need a command prompt open all the time. Put a shortcut to myapp.vbs in the 'startup' folder, the actual myapp.vbs / deployment.bat files go in your app folder.
View deployment.bat
@echo off
perl C:\Users\yournamehere\myapp\ daemon -m production
bimmerlabs /
Created Feb 14, 2018
stream Mojo::Asset::Memory object
# streams $zipfile created in memory (not saved anywhere)
# should work similar with Excel::Writer::XLSX
# (I generate and return the zip file in a Mojo::IOLoop Subprocess)
'attachment; filename=' . $filename . '.zip;');
bimmerlabs /
Last active Jan 11, 2018
A Mojolicious::Lite forZip file streaming with Mojo::Asset::Memory
#!/usr/bin/env perl
use Mojolicious::Lite;
use Archive::Zip::SimpleZip qw($SimpleZipError);
get '/#file' => sub {
my $c = shift;
# read a file from disk
my $file1 =
bimmerlabs /
Created Oct 27, 2017
If I comment out the line with 'test2' it works - but otherwise, it times out. What am I missing? taken from
use Mojolicious::Lite;
use Mojo::IOLoop;
get '/' => sub {
my $c = shift;
sub { say 'test1'; Mojo::IOLoop->timer(1 => shift->begin); },
sub { say 'test2'; my $test = 'test'; },
sub { say 'test3'; $c->render(text => 'Hi'); },
bimmerlabs /
Created Jun 6, 2017
Mojo:PG migration - I'm having some trouble and it's because I don't quite understand what it's doing.
package MyApp::Model::DBAdmin;
use Mojo::Base -base;
has 'database';
sub new { bless {}, shift }
sub create_table {
my ($self, $tablename) = @_;
$tablename = "test";
You can’t perform that action at this time.