Skip to content

Instantly share code, notes, and snippets.

@majecty
majecty / gist:7686609
Last active December 29, 2015 14:49
Unity3d Find object using instanceid
using UnityEngine;
using UnityEditor;
using System.Collections;
public class IdentifierToObject : EditorWindow
{
[MenuItem("DEBUG/IdentifierToObject")]
static void ShowWindow()
{
EditorWindow.GetWindow(typeof(IdentifierToObject));

The introduction to Reactive Programming you've been missing

(by @andrestaltz)

So you're curious in learning this new thing called (Functional) Reactive Programming (FRP).

Learning it is hard, even harder by the lack of good material. When I started, I tried looking for tutorials. I found only a handful of practical guides, but they just scratched the surface and never tackled the challenge of building the whole architecture around it. Library documentations often don't help when you're trying to understand some function. I mean, honestly, look at this:

Rx.Observable.prototype.flatMapLatest(selector, [thisArg])

Projects each element of an observable sequence into a new sequence of observable sequences by incorporating the element's index and then transforms an observable sequence of observable sequences into an observable sequence producing values only from the most recent observable sequence.

@majecty
majecty / answer.md
Last active August 29, 2015 14:20 — forked from non/answer.md

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
"set rtp+=/usr/local/lib/node_modules/typescript-tools
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
using System;
class TestMain
{
public static void Main(string[] args)
{
Console.WriteLine("HI");
Console.WriteLine("1 + 2 = " + Add(left: 1, right: 2));
Console.WriteLine("1 + 2 = " + Add(1, 2));
}
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
pthread_mutex_t mutex;
void error(const char* str) {
printf("str");
module HW01 where
lastDigit :: Integer -> Integer
lastDigit n = n `mod` 10
dropLastDigit :: Integer -> Integer
dropLastDigit n = n `quot` 10
toDigits :: Integer -> [ Integer ]
toDigits n
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module HaskelineMonadReader where
import Control.Monad.Reader
import System.Console.Haskeline
instance MonadReader r m => MonadReader r (InputT m) where
ask = lift ask
@majecty
majecty / AppEditor.cs
Created October 25, 2016 05:52
automatically stop editor just after compilation done
using UnityEngine;
using UnityEditor;
namespace Solitaire
{
public static class AppEditor
{
[UnityEditor.Callbacks.DidReloadScripts]
private static void OnScriptsReloaded()
{
module verilogbug();
reg x = 1;
initial
begin
if (x === 0) begin
$display("x === 0 is true");
end
else begin
$display("x === 0 is false");