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
[ | |
/**! | |
encodesql_full | |
Alternative to encode_sql that also deals with escaping % and _ so that the resulting string can be safely used when creating sql queries with LIKE sections. | |
See Bil Corrys talk from LDC Chicago 2008: All Your Base Are Belong To Us | |
Only needed when dealing with SQL queries using LIKE statements (or any of the other pattern- matching queries that recognize “%” and “_”). | |
Example usage | |
var(sql = 'SELECT * |
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
[ | |
/**! | |
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) |
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
[ | |
/**! | |
Additions to Lasso 9 dir type that will filter out any invisible files or directories | |
The built in method dir -> eachFilePathRecursive returns all files and directories found | |
in the given path. Using dir -> eachVisibleFilePathRecursive will only return visible files | |
and directories. Very useful if you for example want to get a listing without possible | |
SVN directories in the path. |
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
[ | |
/**! | |
Lasso 9 | |
Adding an optional param to string -> trim so that it works on any character. | |
Example | |
local(mypath = response_filepath) | |
#mypath -> trim('/') | |
#mypath | |
local(mystring = 'xxxräksmörgåsxx') |
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
[ | |
/**! | |
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 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
[ | |
/* | |
2014-10-08 JC Added to Gist | |
*/ | |
/**! | |
ical_encodebreak | |
Method to ensure that the given string complies to the icalendar requirements that no row inside an icalendar object is longer than 75 octets (bytes) |
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.*', '90.229.223.*')) | |
2014-10-08 JC Added to Gist | |
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
[ | |
/**! | |
valid_date | |
Replacement of valid_date that adds an optional param -strict. When set to true it will fail on dates that doesn't exist in the real world. Like 2010-02-31. | |
When used with strict assumes that date inputs are either as ISO or US date format. | |
2014-10-13 JC Added to Gist |
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
[ | |
/**! | |
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 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
#!/usr/bin/lasso9 | |
database_initialize | |
local( | |
date = date, | |
tmp_filef = '//path/to/tmp_files/', | |
stored_filef = '//path/to/stored_files/', | |
path = #stored_filef + #date -> format(`yyyyMMddHHmmss`), | |
movetodir = dir(#path), |
OlderNewer