Skip to content

Instantly share code, notes, and snippets.

@chriskoch
chriskoch / drawString.js
Created April 14, 2010 16:59
draw a multiline string in a html5 canvas element including rotation font fontsize and color
/*
* draw a multiline string rotated in a canvas
*
* @param ctx (M) context of the canvas
* @param text (M) string may contain \n
* @param posX (M) horizontal start position
* @param posY (M) vertical start position
* @param textColor color
* @param rotation in degrees (by 360)
* @param font must be installed on client use websafe
@robflaherty
robflaherty / csv-to-json.php
Created September 1, 2011 02:26
Convert CSV to JSON
<?php
/*
* Converts CSV to JSON
* Example uses Google Spreadsheet CSV feed
* csvToArray function I think I found on php.net
*/
header('Content-type: application/json');
// Set your CSV feed
@keijiro
keijiro / UnlitTransparentColored.shader
Created January 26, 2012 04:47
Unlit Transparent Colored Shader
Shader "Unlit/Transparent Colored" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
ZWrite Off
@jaydson
jaydson / gist:1780598
Created February 9, 2012 15:11
How to detect a click event on a cross domain iframe
var myConfObj = {
iframeMouseOver : false
}
window.addEventListener('blur',function(){
if(myConfObj.iframeMouseOver){
console.log('Wow! Iframe Click!');
}
});
document.getElementById('YOUR_CONTAINER_ID').addEventListener('mouseover',function(){
@darktable
darktable / SavWav.cs
Created April 6, 2012 05:01
Unity3D: script to save an AudioClip as a .wav file.
// Copyright (c) 2012 Calvin Rien
// http://the.darktable.com
//
// 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:
@zenorocha
zenorocha / README.md
Last active May 28, 2024 08:23
A template for Github READMEs (Markdown) + Sublime Snippet

Project Name

TODO: Write a project description

Installation

TODO: Describe the installation process

Usage

using UnityEngine;
using System.Collections;
using System;
public class Math3d : MonoBehaviour {
private static Transform tempChild = null;
private static Transform tempParent = null;
public static void Init(){
@GuillaumeJasmin
GuillaumeJasmin / extract.js
Last active September 26, 2022 04:10
Extract substring between two strings
String.prototype.extract = function(prefix, suffix) {
s = this;
var i = s.indexOf(prefix);
if (i >= 0) {
s = s.substring(i + prefix.length);
}
else {
return '';
}
if (suffix) {
@jamiltron
jamiltron / NetworkClient.cs
Created November 23, 2015 00:30
Unity LLAPI networking client/server
using System.Collections;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;
using UnityEngine;
using UnityEngine.Networking;
public class NetworkClient : MonoBehaviour {
public string host = "127.0.0.1";
public int port = 8000;
@DashW
DashW / ScreenRecorder.cs
Last active May 6, 2024 10:27
ScreenRecorder - High Performance Unity Video Capture Script
using UnityEngine;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Threading;
class BitmapEncoder
{
public static void WriteBitmap(Stream stream, int width, int height, byte[] imageData)