Skip to content

Instantly share code, notes, and snippets.

Francisco Ryan Tolmasky I tolmasky

Block or report user

Report or block tolmasky

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:8854525
using UnityEngine;
using System.Collections;
public class TestBehavior : MonoBehaviour
{
public GameObject whatever;
// Use this for initialization
void Start ()
{
View gist:9734274
using System.Runtime.InteropServices;
namespace PlaygroundTheory
{
public static class App
{
#if UNITY_IPHONE && !UNITY_EDITOR
View static strategy 1
// 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>
@tolmasky
tolmasky / goal.h
Created Jul 25, 2014
C static strategy
View goal.h
#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
//===========================================================================
//
// 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
// [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");
@tolmasky
tolmasky / polymer
Created Sep 15, 2014
polymer question
View polymer
<!--
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
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
var everything = React.createElement(
{
render: return <html>
<body>
<mycomponent model = { model } />
<script>
{
"model = " + JSON.stringify(modle) + ";" +
"React.renderComponent(<everything />), document);"
}
View gist:8a91af5ac1e0a949b423
function fromJS(anObject)
{
var objectsToReferences = new Map();
return fromJS(anObject);
function fromJS(anObject)
{
if (objectsToReferences.has(anObject))
return objectsToReferences.get(anObject);
You can’t perform that action at this time.