Skip to content

Instantly share code, notes, and snippets.

View AngeloYazar's full-sized avatar

Angelo Yazar AngeloYazar

View GitHub Profile
@AngeloYazar
AngeloYazar / gist:6101673
Created July 29, 2013 01:40
QRCode to Texture2D
using UnityEngine;
using System.Collections;
using ZXing.Common;
public class QRCode : MonoBehaviour {
private ZXing.QrCode.QRCodeWriter QRWriter;
void Start () {
string url = "http://www.yazarmediagroup.com/ouya/index.html?" + Network.player.ipAddress.ToString();
@AngeloYazar
AngeloYazar / gist:6091095
Last active December 20, 2015 07:09
Spheres On Sphere
//based on: http://www.softimageblog.com/archives/115
void SpheresOnSphere( int n ) {
float increment = Mathf.PI * ( 3 - Mathf.Sqrt(5) );
float offset = 2 / (float)n;
for(int i = 0; i < n; i++) {
float y = i * offset - 1 + (offset / 2);
float r = Mathf.Sqrt(1 - y*y);
float currentAngle = i * increment;
@AngeloYazar
AngeloYazar / depthSort.lua
Created October 13, 2012 04:28
Sort a Corona SDK display group by y value.
local function depthSort( displayGroup )
local objects = {}
for i=1,displayGroup.numChildren do objects[#objects+1] = {displayGroup[i].y, displayGroup[i]} end
table.sort( objects, function(a,b) return a[1]<b[1] end )
for i=1,#objects do displayGroup:insert( objects[i][2] ) end
end
@AngeloYazar
AngeloYazar / distance.lua
Created January 12, 2012 19:55
distance in lua
function distance( x1, y1, x2, y2 )
return math.sqrt( (x2-x1)^2 + (y2-y1)^2 )
end