Skip to content

Instantly share code, notes, and snippets.

@johansolve
johansolve / file_uploads.lasso
Last active June 23, 2016 08:44
This method overrides file_uploads to return an array of maps for compatibility with Lasso 8
[
/*
The built-in file_uploads of Lasso9 returns a staticarray och staticarray pairs,
instead of the array of maps in Lasso8.
This method overrides file_uploads to return an array of maps. It also adds a few missing members from Lasso8.
*/
define file_uploads => {
local(result=array)
with upload in web_request->fileUploads do {
<?lassoscript
// Durations are not displayed properly in Lasso 8.6, the last digit in seconds is missing.
// This custom tag is used to display durations correctly
define_tag('showduration', -required='input');
!#input -> isa('duration') ? return;
local('output'=string,
'hours'=#input -> second,
'minutes'=#input -> second,
'seconds'=#input -> second);
#hours = #hours / 60 / 60;
[
/*
Look for net->wait failure and restart Lasso site if it stops working
to prevent issues with POP and SMTP.
Put this file in web root and watch_net_failure_startup.lasso in LassoStartup
Johan Sölve 2015-08-05
http://lasso.2283332.n4.nabble.com/SMTP-and-POP-problems-on-8-6-3-Mac-caused-by-net-gt-wait-td4644107.html
@johansolve
johansolve / patch_email_send.lasso
Last active August 29, 2015 14:14
Patch email_send subject encoding for Lasso 8
[
// [Email_Send2]
//
// This tag is a drop-in replacement for [Email_Send]. It uses [Email_Compose] on the back-end in order
// to create the message to be sent.
//
/* PATCH
* Replaces subject line that is encoded word by word with a subject line that is encoded as a whole.
@johansolve
johansolve / parse_csv.lasso
Created November 6, 2013 07:28
CSV parser for Lasso
[ // Lasso 8
define_tag('parse_csv', -required='input'
, -optional='linebreak', -type='string', -copy
, -optional='fielddelimiter', -type='string', -copy
, -optional='fieldseparator', -type='string', -copy
, -optional='escapecharacter', -type='string', -copy
, -optional='optionaldelimiters', -copy
, -optional='firstrowfieldnames', -copy
, -optional='rowformat', -type='string', -copy