Skip to content

Instantly share code, notes, and snippets.

View crappygraphix's full-sized avatar
📦
💩

Chris Johnston crappygraphix

📦
💩
View GitHub Profile
@crappygraphix
crappygraphix / main_test
Last active August 29, 2015 14:04
Main() function in Unity3d C# Script
using UnityEngine;
using System.Collections;
public class SillyTest : MonoBehaviour {
void Main(){
Debug.Log("Main: Interesting");
}
void OnEnable(){
@crappygraphix
crappygraphix / PrefabTransformCopy.cs
Last active September 24, 2016 13:23
Copy prefab instance's transform to the root prefab asset and vice versa.
using UnityEngine;
using UnityEngine.UI;
using UnityEditor;
public class PrefabTransformCopy : ScriptableObject {
/*
* Select an instance of a prefab in scene view.
* Click the gear in the transform panel of the inspector.
* Selecting "Write to Prefab" will write the transformation
* values from this scene object into the parent prefab.
@crappygraphix
crappygraphix / ListenToInput.cs
Created October 12, 2016 02:52
Naive way to track swipes and taps. Just attach to a UI Element.
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
public enum MovementAction{
None,
Tap,
SwipeLeft,
SwipeRight,
SwipeUp,

Keybase proof

I hereby claim:

  • I am crappygraphix on github.
  • I am crappygraphix (https://keybase.io/crappygraphix) on keybase.
  • I have a public key ASCYX0RzCWuxQPExttNpJ-4b5fdhgKRlaDhncYIHNfJbNQo

To claim this, I am signing this object:

@crappygraphix
crappygraphix / example.hs
Last active April 24, 2019 17:58
Instance of Show causing infinite loops
-- Potential infinite loop
instance Show VersionStatus where
show PrivatePreview = "Private Preview"
show PublicPreview = "Public Preview"
show x = show x
-- Not an infinite loop
instance Show VersionStatus where
@crappygraphix
crappygraphix / Frontend.hs
Created April 24, 2019 17:56
Example of Obelisk with WebSockets
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecursiveDo #-}
{-# LANGUAGE TypeFamilies #-}
module Frontend where
import Control.Monad (join)
import Obelisk.Frontend
import Obelisk.Route
@crappygraphix
crappygraphix / cookie_policy.txt
Last active May 30, 2019 17:38
Generic Cookie Policy: No analytics or ads.
@crappygraphix
crappygraphix / cookie_policy.txt
Created May 30, 2019 18:10
Generic Cookie Policy: With analytics or ads.
@crappygraphix
crappygraphix / Main.hs
Created June 14, 2019 20:27
Load 3rd party javascript dependencies in order with Reflex-Dom.
module Main where
import qualified Data.Map as Map
import Data.Text
import Reflex.Dom
main :: IO ()
main = mainWidgetWithHead header body
header :: MonadWidget t m => m ()
@crappygraphix
crappygraphix / Main.hs
Created June 26, 2019 18:37
Example of sequential javascript loading so dependent raw actions don't shit the bed.
{-# LANGUAGE CPP #-}
{-# LANGUAGE RankNTypes #-}
module Main where
import Control.Monad ( void )
import Control.Monad.IO.Class ( liftIO )
import Data.Map as Map
import Data.Text
import Language.Javascript.JSaddle