Skip to content

Instantly share code, notes, and snippets.

View mudhairless's full-sized avatar

Ebben Feagan mudhairless

View GitHub Profile

Keybase proof

I hereby claim:

  • I am mudhairless on github.
  • I am ohthatmud (https://keybase.io/ohthatmud) on keybase.
  • I have a public key ASCn38ocRWwhqiIiMrMatdN9t7c84PKISyFjOT0oSkZnEAo

To claim this, I am signing this object:

'Roll a die or more, DND style syntax.
declare function roll( byref s as string ) as uinteger
#define ALGO_CRYPTO 5
#define ALGO_QBASIC 4
#define ALGO_MERSEN 3
#define ALGO_FAST 2
#define ALGO_CRAND 1
'Main
'modded by sir_mud 11/2013 to run with FB 0.90.1 (differences in ThreadCreate and added extremely minimal ini config)
' tweaked by tinram 6/6/07 to run with FB 0.17b (RETURNs in CASE statements were killing it)
' 0.16 original by jofers
'Option Explicit
#include "windows.bi"
type configuration
@mudhairless
mudhairless / flyer3.bas
Created November 23, 2013 04:49
Flyer part 3 contains the glue code to bring everything together
StartScreenSaver
'loadimages:
'print "Loading";
restore flyer1dat
flyer(0) = loadFromDat()
'print ".";
restore flyer2dat
flyer(1) = loadFromDat()
@mudhairless
mudhairless / flyer2.bas
Created November 23, 2013 04:47
Flyer Part 2, contains the sprite creation functions
function newToaster() as sprite ptr
var ret = new sprite
ret->img = callocate(sizeof(fb.image ptr) * 4)
ret->max_img = 4
for n as integer = 0 to 3
ret->img[n] = flyer(n)
next
var y = rndrange(0,SaverInfo.ScrHeight/2)
var yy = rndrange(0,10)
if yy > 5 then y = -(y)
@mudhairless
mudhairless / flyer1
Created November 23, 2013 04:44
Part 1 of flyer.bas containing the utility functions and types.
'Flying Toasters with Toast
'Inspired by the classic After Dark screensaver.
'Consider this code under the terms of the STFUOIWCU license <http://mud.owlbox.net/license/STFUOIWCU>
'
'Compile with:
'fbc -s gui -w all -x flyer.scr flyer.bas flyer.rc
#include "ssk.bas"
#include once "fbgfx.bi"
function RndRange (byval min_ as integer, byval max_ as integer, byval getnew as integer = 1) as integer
@mudhairless
mudhairless / ssk (mod for flyer).bas
Last active December 29, 2015 03:49
FreeBASIC Screensaver Kit by jofers
'modded by sir_mud 11/2013 to run with FB 0.90.1 (differences in ThreadCreate and added extremely minimal ini config)
' tweaked by tinram 6/6/07 to run with FB 0.17b (RETURNs in CASE statements were killing it)
' 0.16 original by jofers
'Option Explicit
#include "windows.bi"
type configuration
@mudhairless
mudhairless / gist:5464638
Created April 26, 2013 01:57
FreeBASIC Average of an Array
function average ( arr() as integer ) as integer
var ret = 0
for n as integer = 0 to ubound(arr)
ret += arr(n)
ret /= 2
next
return ret
end function
<document lang="en_US">
<title>Document title</title>
<author bio="http://site.com/author" email="author@site.com">Joe Author</author>
<summary>This is a sample document.</summary>
</document>
#include once "ext/xml/dom.bi"
var xmldoc = new ext.xml.tree
xmldoc->load("mydocument.xml")
var xmlroot = xmldoc->root
print "Children of document: " & xmlroot->child("document")->children
print "Author: " & xmlroot->child("document")->child("author")->getText
var doc = xmlroot->child("document")
print "Author Bio: " & doc->child("author")->attribute("bio")