Skip to content

Instantly share code, notes, and snippets.

View fomkin's full-sized avatar
🎯
Focusing

Aleksey Fomkin fomkin

🎯
Focusing
View GitHub Profile
package com.tenderowls.xml176;
import flash.utils.Namespace;
import haxe.io.Input;
import haxe.PosInfos;
enum XML176Document {
Node(name:QName, children:List<XML176Document>, pos:PosInfos);
Attr(name:QName, value:String, pos:PosInfos);
Comment(value:Input, pos:PosInfos);
package com.tenderowls.geom;
import com.tenderowls.errors.RangeError;
class BezierCurve {
var points:Array<Point<Float>>;
var step:Float;
package sys;
@:coreApi
class FileSystem {
public static function exists( path : String ) : Bool {
return new flash.filesystem.File(path).exists;
}
public static function rename( path : String, newpath : String ) : Void {
@fomkin
fomkin / gist:d721e5f4ca4f5b54dac3
Last active August 29, 2015 14:04
Simple function match3 in Scala
package com.tenderowls.opensource.match3
import scala.annotation.tailrec
/**
* @author Aleksey Fomkin <[email protected]>
*/
object Board {
sealed trait Direction
function processData(data) {
for(var i = 0; i < data.length; i++) {
var row = $('<tr></tr>')
.append($('<td>' + data[i].id + '</td>'))
.append($('<td>' + data[i].firstName + '</td>'))
.append($('<td>' + data[i].secondName + '</td>'));
if ($('showCountryCheckbox').checked) {
row.append($('<td>' + data[i].country + '</td>'));
}
$('table').append(row);
object HelloWorld extends Application with MKML {
val message = Var("Hello world")
def start() = {
div(
input(`value` =:= message),
span(message)
)
}
}
object Sum extends Application with MKML {
val a = Var("0")
val b = Var("0")
def start() = {
div(
input(`value` =:= a),
span(" + "),
input(`value` =:= b),
object ProgrammersBehaviorTestSuite extends TestSuite { // "Success"
val tests = TestSuite {
"When weather is fine it should" - { // "Success"
"go for a walk" - { assert(false) } // "Failure"
"go to ride a bike" - { assert(false) } // "Failure"
"drink tea on a terrace" - { assert(true) } // "Success"
}
}
}
val input = Vector("стационар", "соратница", "ватерполистка", "равновесие", "спаниель",
"кильватер", "полковник", "нерасторжимость", "Вениамин", "австралопитек", "своенравие",
"внимание", "апельсин", "вертикаль", "старорежимность", "клоповник",
"пенсионерка", "покраснение")
def anagrams(xs: Seq[String]): Seq[Seq[String]] = {
def wSum(s: String) = {
val ls = s.toLowerCase
val l = ls.length
(0 until l).map(ls.charAt).sum | l << 16
val utestSettings = Seq(
scalaJSStage in Test := FastOptStage,
persistLauncher in Test := false,
testFrameworks += new TestFramework("utest.runner.Framework"),
libraryDependencies += "com.lihaoyi" %%% "utest" % "0.3.1" % "test"
)
lazy val frontend = project.settings(utestSettings:_*)