Skip to content

Instantly share code, notes, and snippets.

@nathanpc
nathanpc / VBlank.S
Created June 18, 2011 15:52
Waiting For The VBlank Refresh At GameBoy Advance
ldr r0,=#0x4000006 @ VBlank memory address
waitVBlank:
ldrh r1, [r0] @ Loads the memory address to the r1 register
cmp r1, #161 @ Compare if the memory address have completed the VBlank
bne waitVBlank @ Loopback until r1 != 161
@nathanpc
nathanpc / get_comp.asm
Created June 18, 2011 15:55
Getting And Comparing Input
; How to call it from the program
main:
call getinput
mov si, buffer
cmp byte[si], 0 ; Blank line
je main ; Ignore it
mov si, buffer
@nathanpc
nathanpc / midp.java
Created June 18, 2011 15:56
Fully Featured RecordStore Example(Java ME)
package contacts;
import java.io.*;
import java.util.Vector;
import javax.microedition.midlet.MIDlet;
import javax.microedition.midlet.MIDletStateChangeException;
import javax.microedition.rms.*;
import javax.microedition.lcdui.*;
public class simplecontacts extends MIDlet implements CommandListener {
private Display display;
@nathanpc
nathanpc / ajax.js
Created June 18, 2011 15:58
Compatible AJAX Object Initialization
function initAjax() {
var objXml = false;
if(window.XMLHttpRequest) {
objXml = new XMLHttpRequest(); // All modern browsers
} else if(window.ActiveXObject) {
try {
objXml = new ActiveXObject("Msxml2.XMLHTTP"); // Internet Explorer 6
} catch(e) {
try {
objXml = new ActiveXObject("Microsoft.XMLHTTP"); // Internet Explorer 5
@nathanpc
nathanpc / oracao.js
Created June 27, 2011 19:12
Piadas Nerds (Oração)
// Maneira nerd de apresentar letras das músicas derivadas de "Oração - A Banda Mais Bonita da Cidade"
var letra = "Meus aluuuuunos,<br />Não existe oração<br />Pra salvar o seu notão<br />Programação não é tão simples quanto pensa<br />Ela sabe, ou não se sabe, se convença<br />Pare com o clamor!<br />Pare com a brincadeira<br />E suporte a canseira<br />Ou a nota é dois<br />Pare com o clamor,<br />Não existe oração, pra salvar o seu notão….<br /><br />";
var i = 1;
while(i=1) {
$("#musica").append("<center>" + letra + "</center>");
}
@nathanpc
nathanpc / counter.js
Created September 3, 2011 12:12
Field Character Counter
function textCounter(field, cntField, maxLimit) {
cntField.innerHTML = maxLimit - field.value.length;
if (field.value.length > 120) {
$("#label").css("color", "#ff0034");
} else if (field.value.length > 100) {
$("#label").css("color", "#ff6025");
} else {
$("#label").css("color", "#3e3e3e");
}
@nathanpc
nathanpc / arrow_in_the_knee.js
Created December 11, 2011 01:20
Arrow In The Knee
function arrowInTheKnee(reason) {
return "I used to " + reason + ", but then I took an arrow in the knee";
}
@nathanpc
nathanpc / movement.js
Created January 8, 2012 15:08
Non-Working Movement Script
var basketx = 0;
var basket = 4;
var t;
function loaded() {
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
var s = (window.innerWidth / 2) - (128 / 2);
t = self.setInterval("moveBasket('" + s + "')", 10);
}
@nathanpc
nathanpc / LICENSE.txt
Created February 24, 2012 04:25 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Martin Kleppe <http://twitter.com/aemkei>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@nathanpc
nathanpc / test.c
Created March 21, 2012 01:13
Playing With The PIC 12F629
#define _LEGACY_HEADERS
#include <pic.h>
#include <pic12f629.h>
__CONFIG(UNPROTECT & BORDIS & MCLRDIS & PWRTEN & WDTDIS & INTIO);
void delay(char value);
void d1();