View gist:8854525
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
public class TestBehavior : MonoBehaviour | |
{ | |
public GameObject whatever; | |
// Use this for initialization | |
void Start () | |
{ |
View gist:9734274
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Runtime.InteropServices; | |
namespace PlaygroundTheory | |
{ | |
public static class App | |
{ | |
#if UNITY_IPHONE && !UNITY_EDITOR |
View static strategy 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Strategy 1: No typecast magic | |
// | |
// To compile and run: | |
// | |
// $ g++ -W -Wall -Wextra -pedantic -std=c++0x -o static static.cpp && ./static | |
#include <string> | |
#include <iostream> |
View goal.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdlib.h> | |
#include <stdio.h> | |
#include <regex.h> | |
#include <string.h> | |
// We still need g()()()()("al") to pass initial compilation, | |
// so have it evaluate to either just "g" or "f". We then define | |
// these as constants so they serve as type placeholders. This way | |
// double x = g()()()("al") will appropriately complain. |
View Java.1.6.peg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//=========================================================================== | |
// | |
// Parsing Expression Grammar for Java 1.6 for Mouse 1.1 - 1.6. | |
// Based on Chapters 3 and 18 of Java Language Specification, Third Edition, | |
// at http://java.sun.com/docs/books/jls/third_edition/html/j3TOC.html. | |
// | |
//--------------------------------------------------------------------------- | |
// | |
// Copyright (C) 2006, 2009, 2010, 2011, 2013 |
View gist:39ea427805e3213f34c1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [A0, A1, ..., AN-1] | |
// Code(X) = 2^N - 1 + Sum(0, N - 1, Xi * 2^i) | |
// [B0, B1, ..., BM-1] | |
// Concat(A, B) = 2 ^ [floor(lg (N + 1)) + floor(lg (M + 1))] - 1 + | |
// Code(A) - (2 ^ N - 1) + Code(B) - (2 ^ M - 1) | |
// graph: http://www.wolframalpha.com/input/?i=plot+2+%5E+%28floor%28lg2+%28x+%2B+1%29%29+%2B+floor%28lg2+%28y+%2B+1%29%29%29+-+1+%2B+%28x+-+%282+%5E+floor%28lg2+%28x+%2B+1%29%29+-+1%29%29+*+%282+%5E+floor%28lg2+%28y+%2B+1%29%29%29+%2B+%28y+-+%282+%5E+floor%28lg2+%28y+%2B+1%29%29+-+1%29%29%2C+x%3D0..3%2C+y%3D0..3 | |
var _ = require("underscore"); |
View polymer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
What I want is for the following: | |
<father name = "John"> | |
<child name = "Bob">likes lolipops</child> | |
<child name = "Jessica">likes computers</child> | |
</father> | |
to generate: | |
--- |
View componentdidmounst-reduction.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Reduction = React.createClass( | |
{ | |
render: function() { | |
var self = this; | |
return <div><Child isParentMounted = { function() { return self.isMounted(); } } /></div>; | |
}, | |
componentDidMount: function() { console.log("actually mounted."); } | |
}); | |
var Child = React.createClass( |
View gist:34bf9eb7bb47efad019f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var everything = React.createElement( | |
{ | |
render: return <html> | |
<body> | |
<mycomponent model = { model } /> | |
<script> | |
{ | |
"model = " + JSON.stringify(modle) + ";" + | |
"React.renderComponent(<everything />), document);" | |
} |
View gist:8a91af5ac1e0a949b423
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fromJS(anObject) | |
{ | |
var objectsToReferences = new Map(); | |
return fromJS(anObject); | |
function fromJS(anObject) | |
{ | |
if (objectsToReferences.has(anObject)) | |
return objectsToReferences.get(anObject); |
OlderNewer