This file contains 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 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 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 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 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 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
[ | |
/**! | |
wrp | |
Quick way to grap a web_request param | |
2017-05-02 JC Added examples | |
2014-10-08 JC Added to Gist | |
2014-10-08 JC Added separate methods for queryparams and postparams | |
2014-08-24 JC Rewrite of the wrp method once again. This time with code suggested by Brad Lindsay in a lassotalk thread. Introduces the param -all |
This file contains 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 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
[ | |
/**! | |
jc_session | |
Lasso 9 type to handle cookie based sessions | |
NOTE, as of this release the code is using json_encode/json_decode as a replacement for json_serialize/json_deserialize. If you are running this in an environment prior to Lasso 9.3 you will have to replace all instances of json_encode with json_serialize and json_decode with json_deserialize! | |
NOTE, if this is an updated version you'll need to add an additional field to the session table. Run the following sql for Mysql: | |
ALTER TABLE `jc_session` |
This file contains 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 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
[ | |
/**! | |
jc_fileuploads | |
local(myfile = jc_fileuploads(1)) // the integer is optional and will if provided restrict the method to the n:th count of uploaded files | |
#myfile -> size // how many files that where uploaded or handled by the type | |
#myfile -> contenttype // or #myfile -> contenttype(n) when targeting the n:th file // for example image/jpeg | |
#myfile -> fieldname // #myfile -> fieldname(n) | |
#myfile -> filesize // #myfile -> filesize(n) | |
#myfile -> filename // #myfile -> filename(n) |
NewerOlder