Skip to content

Instantly share code, notes, and snippets.

void Update()
{
// attach to camera
if (Input.GetMouseButtonDown(0)) {
var ray = camera.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit)) {
Vector3 v = hit.point;
// instantiate the "ping" transform at v
@KevinJones
KevinJones / CartesianProductSelectManyExample.cs
Created February 13, 2014 19:32
C# SelectMany Example - Cartesian Product
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class CartesianProductSelectManyExample
{
public static void Main(string[] args)
{
var abcArray = new string[]{"a", "b", "c"};
// a global function; no need to expose this in a header file
void internalDoSomething()
{
// put your function here.
}
// note that if you were using C++ or Objective-C++ you'd need to put this in an extern closure, like so:
extern "C"
{
@KevinJones
KevinJones / gist:11264481
Created April 24, 2014 18:25
Multiple Singletons Example
// Three parts:
// 1. an enum with N values (or N+1 if you include a "None")
// 2. N enumerated singleton instances implementing a common interface. These provide information associated with each enum value in one place.
// 3. a static class allowing callers to access each enumerated singleton instance by passing in the corresponding enum value, creating it if necessary.
// Part 1
public enum Biome
{
Desert = 1,
Snow = 1 << 1,
@KevinJones
KevinJones / fix_chrome_icon.sh
Last active August 29, 2015 14:04
elementary OS Luna: Fix blurry Chrome dock icon
# If your dock icon for Chrome is blurry in elementary OS Luna, this well help you fix it.
# This will create symbolic links for each of the icon sizes in the /usr/share/icons/elementary/apps directory.
# Log out and log back in afterwards to see the changes.
function make_link {
if [ "$1" ]
then
SIZE=$1; sudo ln -s /opt/google/chrome/product_logo_$SIZE.png /usr/share/icons/elementary/apps/$SIZE/google-chrome.png
fi
}
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
~/D/P/c/puma (master) $ cd ~/Desktop/
~/Desktop $ ls
temp.js
~/Desktop $ node temp.js
8
~/Desktop $ gjslint temp.js
----- FILE : /home/kevin/Desktop/temp.js -----
Line 1, E:0002: Missing space after ","