Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@nathanpc
nathanpc / TextureTransformation.shader
Created June 6, 2022 12:28
Transform Textures in Unity
// TextureTransformation.shader
// A simple shader that allows us to transition between two textures from a script.
//
// Author: Nathan Campos <nathan@innoveworkshop.com>
Shader "Custom/TextureTransformation" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Original Texture", 2D) = "white" {}
_TransTex("Transformed Texture", 2D) = "gray" {}
@nathanpc
nathanpc / MintyUSBoost.c
Created February 19, 2016 13:16
A minimalistic switchmode converter
/*
* File: MintyUSBoost.c
* Author: Nathan Campos <nathanpc@dreamintech.net>
*
* Created on February 14, 2016, 2:45 PM
*/
// 12F683
// +---------+
// -|Vdd Vss|-
@nathanpc
nathanpc / ascii_bin.asm
Created June 18, 2011 15:57
Convert ASCII To Binary
#make_COM#
; COM file is loaded at CS:0100h
org 10h
; ********************************
; * Program: ASCIICONV.ASM *
; ********************************
include 'emu8086.inc'
@nathanpc
nathanpc / phonegap_download_example.html
Created April 22, 2012 13:11
Sample code to download file from internet - Phonegap Wiki
<!DOCTYPE html>
<html>
<head>
<title></title>
<!-- Android
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no;" />
<meta charset="utf-8">-->
<!-- iPad/iPhone specific css below, add after your main css >
@nathanpc
nathanpc / Ruby-StyleGuide.md
Last active September 21, 2018 21:03
Ruby Style Guide (Innove Workshop Company)

Ruby Style Guide

This style guide is based on the one used by GitHub, but with some changes that make the code a tiny bit more readable.

  • Use soft-tabs with a two space indent.

  • Keep each line of code to a readable length. Unless you have a reason to, keep lines to fewer than 100 characters.

  • Never leave trailing whitespace.

@nathanpc
nathanpc / irc_client.cpp
Last active December 11, 2015 00:09
Fix for the QUIT bug in leafIRC
void *IRC_Client::handle_recv(void) {
// recv some data.
int numbytes;
char buffer[MAXDATASIZE];
while (true) {
numbytes = recv(socket_descriptor, buffer, MAXDATASIZE - 1, 0);
buffer[numbytes] = '\0';
if (numbytes == 0) {
@nathanpc
nathanpc / BBTimer.java
Created June 23, 2012 00:42
Timers on BlackBerry Java
Timer timer = new Timer();
timer.scheduleAtFixedRate(new TimerTask() {
public void run() {
UiApplication.getUiApplication().invokeLater(new Runnable() {
public void run() {
// Do something when the timer ticks
}
});
}
@nathanpc
nathanpc / index.html
Created June 9, 2012 19:55
Processed image-list item
<div data-bb-type="item" onclick="alert('this was clicked')" class="bb-hires-image-list-item" onmouseover="this.setAttribute('class','bb-hires-image-list-item-hover')" onmouseout="this.setAttribute('class','bb-hires-image-list-item')" x-blackberry-focusable="true"><img src="images/test.png">
<div class="details">
<span class="title">Title goes here</span>
<span class="accent-text"></span>
<div class="description">A description is welcome.</div>
</div>
</div>
@nathanpc
nathanpc / main.js
Created June 9, 2012 19:58
Correct onscreenready Example
bb.init({
onscreenready: function (element, id) {
if (id == "main") {
var item = element.createElement('div');
item.setAttribute('data-bb-type','item');
item.setAttribute('data-bb-title','my title');
item.innerHTML = 'my description';
item.setAttribute('data-bb-img','foo.png');
element.getElementById('mylist').appendItem(item);