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
// Define our shapes. | |
trait Shape | |
class Rectangle extends Shape | |
class Ellipse extends Shape | |
class Triangle extends Shape | |
object Shape { | |
// The method we'll call to perform an intersection. | |
def intersect[A <: Shape, B <: Shape](a: A, b: B)(implicit ev: Intersection[A,B]): Unit = { |
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
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | |
<s:Boolean x:Key="/Default/CodeEditing/Intellisense/CodeCompletion/IntelliSenseCompletingCharacters/CSharpCompletingCharacters/UpgradedFromVSSettings/@EntryValue">True</s:Boolean> | |
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/IdentifierHighlightingEnabled/@EntryValue">True</s:Boolean> | |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=SuggestVarOrType_005FSimpleTypes/@EntryIndexedValue">DO_NOT_SHOW</s:String> | |
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnassignedField_002ECompiler/@EntryIndexedValue">DO_NOT_SHOW</s:String> | |
<s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">Default: Reformat Code</s:String> | |
<s:String x:Key="/Defaul |
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
public class GameModel : MonoBehaviour { | |
public FloatReactiveProperty Score { get; private set; } | |
void Awake() { | |
Score = new FloatReactiveProperty(0f).AddTo(this); | |
} | |
} | |
public class ScoreUI : MonoBehaviour { |
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
package com.ornithoptergames.psav | |
import java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import scala.concurrent.duration._ | |
import com.beachape.filemanagement.RxMonitor | |
import com.ornithoptergames.psav.FrameInfoLoader._ | |
import com.ornithoptergames.psav.Messages._ | |
import com.ornithoptergames.psav.RxMessage.Implicits._ | |
import akka.actor.ActorSystem |
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
// Combining a list of options... | |
val options = List("a", "b", "c", "d") | |
// ... with a sequence of "picks" to make... | |
val choices = List(0, 2, 1, 0) | |
// ... should yield a re-ordered list as so. | |
val expects = List("a", "d", "c", "b") | |
// Assume we don't have to worry about out-of-bounds choices. | |
// worked example: | |
// pick 0 from {a,b,c,d} -> a |
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
#ifdef GL_ES | |
precision mediump float; | |
#endif | |
uniform sampler2D u_texture; | |
uniform sampler2D u_mask; | |
varying vec4 v_color; | |
varying vec2 v_texCoord0; |
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
uniform mat4 u_projTrans; | |
attribute vec4 a_position; | |
attribute vec4 a_color; | |
attribute vec2 a_texCoord0; | |
varying vec4 v_color; | |
varying vec2 v_texCoord0; | |
void main() |
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
package com.javadocmd.drawing; | |
import com.badlogic.gdx.ApplicationAdapter; | |
import com.badlogic.gdx.Gdx; | |
import com.badlogic.gdx.Input; | |
import com.badlogic.gdx.InputAdapter; | |
import com.badlogic.gdx.files.FileHandle; | |
import com.badlogic.gdx.graphics.Color; | |
import com.badlogic.gdx.graphics.GL20; | |
import com.badlogic.gdx.graphics.Pixmap; |
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
def parse(s: String): List[List[Long]] = | |
s.lines.map(_.split(" ").map(_.toLong).toList).toList | |
def pairwiseChoose(row: List[Long]): List[Long] = | |
(row.sliding(2).map { case a :: b :: Nil => max(a, b) }).toList |
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
case class Foo(val x: Int, val y: Int) | |
class Bar(val f: Foo, val s: String) | |
object Bar { | |
def apply(x: Int, y: Int, s: String): Bar = new Bar(Foo(x, y), s) | |
def unapply(b: Bar): Option[(Int, Int, String)] = Some((b.f.x, b.f.y, b.s)) | |
} | |
val a = Bar(1, 2, "A") |