Skip to content

Instantly share code, notes, and snippets.

Joe ST fbstj

Block or report user

Report or block fbstj

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
fbstj / smf-sql.php
Created Mar 16, 2010
SMF SQL wrapper (php)
View smf-sql.php
header('Content-Type: application/json');
interface SQL { function sql(); }
interface RecordSet{ function add(Field $f); function field($name,$as=''); function fields();}
class DB
const USERNAME = 'root', PASSWORD = 'password';
const HOST = 'localhost', DB_NAME='smf';
const TABLE = "smf_%s";
fbstj / memlib.c
Created Jul 8, 2011
memory operations free of the standard libraries
View memlib.c
typedef unsigned char BYTE;
typedef unsigned short WORD;
typedef unsigned long LONG;
BYTE BYTE_get(BYTE **buf_ptr) { return *(*buf_ptr)++; }
void BYTE_put(BYTE **buf_ptr, BYTE value) { *(*buf_ptr)++ = value; }
void WORD_put(BYTE **buf_ptr, WORD value)
fbstj / C_CAN.c
Created Aug 4, 2011
Module for communicating with C_CAN device on C8051F500 and other
View C_CAN.c
Module for communicating with C_CAN device on C8051F500 and F580.
#include "myPlatform.h"
#define __C_CAN_H 1
# include "C_CAN.h"
#undef __C_CAN_H
// CAN0STAT masks
fbstj / HTMLOFF.js
Created Sep 6, 2011
HTML object notation, maps JSON to HTML tables and lists
// converts HTML tables and lists into JSON/js objects and arrays
function HTMLOFF(el)
{//reverses the effects of HTMLON
function tbl(root)
var o = {}, rows = $('tbody', root).first().children(),
row = rows.first()
for(var j = 0; j < rows.length; j++)
fbstj / Buffer.js
Created Jan 7, 2012
some extension methods and utility functions for ArrayBuffer
View Buffer.js
var Buffer = {
_for: function(n, cb){ for(var i = 0; i < n; i++) cb(i) },
_to: function(x, size, cb) {
var v = new DataView(x), out = [], l = x.byteLength/size
this._for(l, function (i) { out[i] = v[cb](i*size) })
return out
toBytes: function(b) { return this._to(b, 1, 'getUint8') },
toWords: function(b) { return this._to(b, 2, 'getUint16') },
fbstj / greystring.js
Created Jan 11, 2012
detects strings who's characters are in a Grey-code sequence
View greystring.js
// detects strings whos bytes are greycoded
function greystring(str){
var a, b
function bitcount(v){
var c;
for (c = 0; v; c++)
v &= v - 1;
return c;
for(var i = 1; i < str.length; i++)
fbstj / Components.cs
Created Mar 23, 2012
some extension methods for Control
View Components.cs
public static int Value(this Control _, NumberStyles s, IFormatProvider p)
int d;
if (int.TryParse(_.Text, s, p, out d))
return d;
return 0;
public static double Value(this Control _)
double d;
fbstj / gist:2216990
Created Mar 27, 2012
Some abstract algebra interfaces/structs for Csharp
View gist:2216990
This gist has moved to FallingBullets/lib.cs on branch algebra
fbstj / ini.c
Last active Dec 11, 2015
ini file parsing
View ini.c
#include <string.h>
#include <stdio.h>
enum ini_parts {
ini_section, ini_key, ini_value,
ini_section_start = '[', ini_section_end=']',
ini_key_value = '=',
ini_comment = ';'
View ext.cs
using System;
using System.IO.Ports;
using System.Threading;
using System.Globalization;
namespace Terminal
static class Program
static void Main(string[] s)
You can’t perform that action at this time.