Skip to content

Instantly share code, notes, and snippets.

View bmallin's full-sized avatar

Benjamin Mallin bmallin

View GitHub Profile
#include "SpriteBatch.h"
#include <cmath>
#define M_PI 3.14159265358979323846
SpriteBatch::SpriteBatch(void) : count(0), active(false), queueCount(0), activeTexture(0)
{
}
SpriteBatch::~SpriteBatch(void)
{
@bmallin
bmallin / bf.py
Created November 17, 2014 06:53
Tiny Brainfuck implementation
m, mp, pc, l, ls = [0] * 30000, 0, 0, {}, []
with open(__import__('sys').argv[1], 'r', encoding='utf-8') as fp:
p = ''.join(filter(lambda x: x in '<>[]+-,.', fp.read()))
for i, c in enumerate(p):
if c == '[': ls.append(i)
elif c == ']':
s = ls.pop()
l[s] = i
l[i] = s
while pc < len(p):
#! /bin/bash
sudo apt-get -qq update
#Install Apache2
echo "Installing apache2..."
sudo apt-get install -y -qq apache2
#Install Mysql and configure
echo "Installing MySql..."

Code Style

All code submitted or committed to the project needs to follow the guidelines outlined in Python PEP 8, which may be found at:

http://www.python.org/dev/peps/pep-0008/

##A quick list of code style points

  • 4-space indendation, NO TABS!
#!/bin/sh
VERSION=0.10.22
PLATFORM=linux
ARCH=$1
PREFIX="$HOME/node-v$VERSION-$PLATFORM-$ARCH"
mkdir -p "$PREFIX" && \
curl http://nodejs.org/dist/v$VERSION/node-v$VERSION-$PLATFORM-$ARCH.tar.gz \
| tar xzvf - --strip-components=1 -C "$PREFIX"
def letter_index(letter):
letter_ord = ord(letter)
if letter_ord >= 65 and letter_ord <= 90:
return letter_ord - 64
elif letter_ord >= 90 and letter_ord <= 122:
return letter_ord - 96
return 0
for x in range(1,101):print(('','Fizz')[not x%3]+('','Buzz')[not x%5] or x)
using UnityEngine;
using System.Collections;
public class DestroyOnInvisible : MonoBehaviour {
void Update() {
if (!renderer.isVisible) {
Destroy(gameObject);
}
}
@bmallin
bmallin / pretty_print_r.php
Created August 24, 2013 15:32
pretty_print_r function for php.
<?php
function pretty_print_r($var) {
echo "<pre>";
print_r($var);
echo "</pre>";
}
?>