Skip to content

Instantly share code, notes, and snippets.

@andersonsp
andersonsp / pump.bas
Last active August 29, 2015 14:05 — forked from anonymous/pump.bas
Device 16F877A
XTAL 20 'Cristal de 20Mhz
ALL_DIGITAL true 'Todos los puertos Digitales
'TRISA=%00000000
TRISB=%00000111 'Configuracion del Puerto A
Dim a As Byte
pump:
a = PORTB & %00000111
@andersonsp
andersonsp / bit_array.c
Last active August 29, 2015 14:03
Simple utils, algorithms and data structures implemented in C
#include <limit.h> /* for CHAR_BIT */
#include <stdint.h> /* for uint32_t */
typedef uint32_t word_t;
enum { BITS_PER_WORD = sizeof(word_t) * CHAR_BIT };
#define WORD_OFFSET(b) ((b) / BITS_PER_WORD)
#define BIT_OFFSET(b) ((b) % BITS_PER_WORD)
void set_bit(word_t *words, int n) {
words[WORD_OFFSET(n)] |= (1 << BIT_OFFSET(n));

Advertised:

  • best graphics
  • decent AI
  • free to play
  • infinite possibilities.

Actual Gameplay:

  • single spawn
  • no save point
  • not moddable
var humanizedValue = value.replace(/_/g, ' ').replace(/(\w+)/g, function(match) {
return match.charAt(0).toUpperCase() + match.slice(1);
});
// lys.c forth version by AndersonSP
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdarg.h>
//----------------------------------------------------------------
// Object defs based on http://piumarta.com/software/id-objmodel/
@andersonsp
andersonsp / Makefile
Last active August 29, 2015 13:57
Valenok's QVM
# Copyright (c) 2006, 2007 by Sergey Lyubka
# All rights reserved
#
# $Id$
SRCS= q.c
PROG= q
CFLAGS= -W -Wall -g -pedantic -ansi -D_BSD_SOURCE $(COPT)
all: $(PROG)
@andersonsp
andersonsp / pratt-parser.py
Last active August 29, 2015 13:57
Parser examples in python
# see http://effbot.org/zone/simple-top-down-parsing.htm
import sys
import re
try:
# test binding for python's built-in tokenizer; see
# http://svn.effbot.org/public/stuff/sandbox/pytoken
import pytoken
except ImportError:
@andersonsp
andersonsp / markdown.parse.js
Created February 25, 2014 18:27
A Markdown parser in under 100 JS LoC, taken from http://pzxc.com/simple-javascript-markdown-parsing-function
if (typeof markdown === 'undefined') var markdown = {
parse: function (s) {
var r = s, ii, pre1 = [], pre2 = [];
// detect newline format
var newline = r.indexOf('\r\n') != -1 ? '\r\n' : r.indexOf('\n') != -1 ? '\n' : ''
// store {{{ unformatted blocks }}} and <pre> pre-formatted blocks </pre>
r = r.replace(/{{{([\s\S]*?)}}}/g, function (x) { pre1.push(x.substring(3, x.length - 3)); return '{{{}}}'; });
r = r.replace(new RegExp('<pre>([\\s\\S]*?)</pre>', 'gi'), function (x) { pre2.push(x.substring(5, x.length - 6)); return '<pre></pre>'; });
#
#add this to ApplicationController
#
def set_no_cache
response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate"
response.headers["Pragma"] = "no-cache"
response.headers["Expires"] = "0"
end
#
@andersonsp
andersonsp / triangle-collision.js
Created October 15, 2012 15:44 — forked from toji/triangle-collision.js
Javascript Swept-Sphere/Triangle Collision Detection
/*
* Copyright (c) 2012 Brandon Jones
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions: