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
[ | |
/* ========================================================== | |
PWD gen trait | |
derivative of xs_genPwd | |
Usage once imported into Lasso 9 type: | |
.genPwd => 8 char random pwd | |
.genPwd(16) => 16 char random pwd | |
.genPwdAlpha => 8 char random not incl punctuation chars | |
========================================================== */ | |
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
[ | |
/* ========================================================== | |
shellhandler trait | |
Usage once imported into Lasso 9 type: | |
.shellhandler('ls') -> directory list | |
trait { | |
import std_shellhandler | |
} | |
========================================================== */ | |
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
/* ============================================================ | |
See http://rosettacode.org/wiki/Statistics/Normal_distribution#Lasso | |
============================================================ */ | |
define normalDist(mean::decimal=0.5,sdev::decimal=0.2) => { | |
// Uses Box-Muller transform | |
return ((-2 * decimal_random->log)->sqrt * (2 * pi * decimal_random)->cos) * #sdev + #mean | |
} |
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
[ | |
/* ======================================================================================== | |
wkhtmltopdf | |
https://code.google.com/p/wkhtmltopdf/ | |
wkhtmltopdf('http://www.example.com/mypage.lasso?id=83','/pdfcache/id83.pdf',-removelast) | |
Requires std_shellhandler trait | |
======================================================================================== */ | |
define wkhtmltopdf => type { | |
trait { |
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 human_filesize(size::integer) => { | |
/* ================================================================= | |
human_filesize returns a human readable file size from a supplied integer (bytes) | |
================================================================= */ | |
local( | |
displaysize = string, | |
calc = decimal, | |
kb = 1024, | |
mb = 1024 * #kb, |
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 gravatar => type { | |
/* ============================================================== | |
Retrieves the Gravatar for the given email address. | |
local(x = gravatar('[email protected]',-default='mm')) | |
local(x = gravatar('[email protected]',-test=true)) | |
============================================================== */ | |
data | |
private base = 'http://www.gravatar.com/avatar/', | |
private securebase = 'https://secure.gravatar.com/avatar/', |
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
[ | |
// ================================== | |
/* | |
@author Jonathan Guthrie ([email protected]) | |
#version 1.00 | |
This Lasso 9 data type uses the JSON Webservice of http://www.geoplugin.com/ to geolocate IP addresses | |
See http://www.geoplugin.com/webservices/ for more specific details of this free service | |
Usage: |
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
/* ============================================ | |
Lasso 9 port of Bil Corry's lp_string_zap for Lasso 8. | |
Jonathan Guthrie, Feb 2013 | |
============================================ */ | |
define lp_string_zap(text_to_zap, replacement_text = void, ...) => { | |
not local_defined('replacement_text') ? local(replacement_text = '') | |
return string_replaceregexp(#text_to_zap, -find = '[^\\x20-\\x7E\\x09\\x0A\\x0D]', -replace = #replacement_text) | |
} |
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 numeric_string(in::string) => { | |
local(out = string) | |
with char in #in->split('') where string_isNumeric(#char) and #char != '-' && #char != '+' do => { #out->append(#char) } | |
return #out | |
} | |
define numeric_string2(in::string) => { | |
return string_replaceregexp(#in, -find='\\D', -replace='') | |
} | |
numeric_string('123_456-7890') | |
numeric_string2('(123) 456-7890') |
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
import PerfectLib | |
import Foundation | |
import Cocoa | |
#if os(Linux) | |
import SwiftGlibc | |
#else | |
import Darwin | |
#endif |
OlderNewer