This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/**!---------------------------------------------------------------------------- | |
hash_sha512.lasso | |
Author: Jolle Carlestam | |
License: Public Domain | |
Description: | |
For when you want a hashed string using SHA512 for hashing. | |
Requires the Lasso 9 version of shell |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/*---------------------------------------------------------------------------- | |
kin_slugify.lasso | |
Author: Jolle Carlestam | |
License: Public Domain | |
Description: | |
For when you want a string, like a headline for a news article, to be used as part of a URL. Safe to send out in the wild. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define safe_filename( | |
filename::string, | |
-replacechar::string = '-', | |
-clearemoji::boolean = false, | |
-noleadingperiod::boolean = false, | |
-allowed_length::integer = 255 | |
) => { | |
local(_filename = string(#filename)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/**! | |
jwt | |
Lasso 9 type to sign, encode and verify JSON Web Tokens (JWT). | |
Requires a version of Lasso that supports json_encode and json_decode. | |
Developed and tested on Lasso 9.3. | |
Inspired by methods published by Alex Betz on Lasso Talk in April 2017 | |
2017-04-25 JC First version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/**!---------------------------------------------------------------------------- | |
shell.lasso | |
Adaptation of Jason Huck's Shell tag for Lasso 8.5 | |
Author: Jonathan Guthrie, Jolle Carlestam | |
Last Modified: 2018-03-20 | |
License: Public Domain |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**! | |
array -> encodesql | |
Adds a method to the lasso 9 array and staticarray types that will run encodesql on each item in the array. | |
This changes the array in place. | |
It also alters each item to type string. | |
EXAMPLE USAGE | |
local(ids = array('1', '5', '22')) | |
local(sql = "SELECT * FROM mytable AS mt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**! | |
client_ip_isin | |
Will return true if client_ip matches any of the strings in the provided staticarray | |
Examples | |
client_ip_isin((: '127.*', '94.219.224.*')) | |
2014-09-10 JC First version | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**! | |
export_csv | |
Will export all rows from the given table as a csv file. First row will be the column names. | |
Depends on Ke Carltons DS found here | |
https://github.com/zeroloop/ds | |
Some advantages | |
It does not rely on creating a temporary file on the server. | |
Will send accumulated result to the browser ongoing while looping thru the resultset and thus minimize the memory need on the server. | |
There’s probably no limit on how many records it can export. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
/**! | |
kin_exchangerates | |
Thread object to serve a fairly accurate exchange rate for a given currency | |
To install, go to https://www.openexchangerates.org and sign up for an account. | |
Insert the app_id below and store the thread file where it will be loaded at startup. | |
Attempts to update the rates are limited to no more than once an hour. | |
Call to update rates will be triggered by the first call for a rate. Not when the thread is initialized. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?LassoScript | |
/**! | |
jc_include | |
Includes a file for processing but allows the call to hand over params to the included file. | |
Now also supports including files stored in compiled LassoApps | |
Examples | |
jc_include(file('includetest.inc'), -name = 'brad', -country = 'UK') | |
includetest.inc: |
NewerOlder