Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
void main(int argc,char **argv)
{
int s=186986851,t,p,i,j,k;
char *fb="FizzBuzz",*fo,*fl,c;
for(i=k=0,t=s>>2,p=s&3;i<100;) {
if(i==p) {
fo=fb+((t&1)<<2);
fl=fo+(((t&2)|(!(t&2)))<<2);
c=*fl;
@LaffinToo
LaffinToo / tc.asm
Last active January 14, 2021 05:28
TinyC for 8085
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;; COPYRIGHT 1977, TINY-C ASSOCIATES ;;;;;;;;;;;;;;;;;;
;;;;;; ALL RIGHTS RESERVED ;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ORG ($+100H)/100H*100H ;go to round address
LCFIX EQU 20H ;maps literals to lower case
;error codes
STATERR EQU 1
CURSERR EQU 2
SYMERR EQU 3
@LaffinToo
LaffinToo / account_delete.php
Last active August 29, 2015 14:00
account_delete function - #MySQL #Multiple row #deletion
<?php
function account_delete($userid)
{
$references=array(
"id" => array("users"), // Do Not move this line
"userid" => array(
"blackjack","blocks","bookmarks"
),
"friendid" => array(
"friends"
@LaffinToo
LaffinToo / Bitman.php
Created May 3, 2014 04:05
Bit Manipulation Class - Using strings as a bitstring allowing for huge amount of toggles #Bits
<?php
/*
* Bitman.php
*
* Copyright 2014 Luis "Laffin" Espinoza <laffintoo@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
@LaffinToo
LaffinToo / paginate.php
Created December 31, 2011 18:44
Pagination calculation routine #paginate #pagination
<?php
/* Wrote this for a pagination routine awhile back
the variables needed
$range = Amount of numbers to display
$curpage = Current number
$pages = Highest Page count
*/
$midrange=intval(floor($range/2));
$range_s=(($curpage-$midrange)<1?1:(($curpage+$midrange)>$pages?($pages-$range+1):$curpage-$midrange));
@LaffinToo
LaffinToo / breadcrumbs.php
Created December 31, 2011 08:05
Simple Breadcrumb system - dynamicly built, Use with Cache
<?php
if(!$db=sqlite_open(':memory:'))
die('DB Open failure');
sqlite_exec('CREATE TABLE category(id INTEGER PRIMARY KEY, Name TEXT, Parent Integer)',$db);
$data =array(
'Family/Events/Birthdays',
'Family/Events/Holidays/Halloween',
@LaffinToo
LaffinToo / weights.php
Created December 31, 2011 07:26
Weighted Probability - A simple weighted probability system
<?php
// Weight percentage system
// By: Laffin
// Gives weights to items, and randomly chooses items based on weight
$items = array(
array('lint',40),
array('copper coin',35),
array('silver coin',15),
array('gold coin',5),
@LaffinToo
LaffinToo / twittify.php
Created December 31, 2011 07:25
Twitify Links - converts twitter type text to links
<?php
// Parse Twitter nicks/lists to urls
// Internal routine
// This has a couple of functions
// TwittifyLinks() - returns True if template is set, otherwise false
// TwittifyLinks($arr,true) - $arr is a 2 element array, each holding a template for usernames/groups
// TwittifyLinks($twit) - $twit is the user/group to convert to a link
function TwittifyLinks($var=null,$set=false)
{
@LaffinToo
LaffinToo / bracket.php
Created December 31, 2011 07:24
Tourney Bracket System
<?php
$teams=array('Alpha','Beta','Gamma','Delta','Epsilon','Zeta','Eta');
define('MY_EOL','<br .>'.PHP_EOL);
$round=0;
$participants=$teams;
while(count($participants)>1)
{
$round++; // Increment our round
@LaffinToo
LaffinToo / bittwiddle.php
Created December 31, 2011 07:23
Bit Twiddling
<?php
function setbit($flags,$position)
{
return $flags|(1<<$position);
}
function resetbit($flags,$position)
{
return $flags&(~(1<<$position));
}
function togglebit($flags,$position)