Skip to content

Instantly share code, notes, and snippets.

@jgranick
jgranick / gist:1763850
Created February 8, 2012 01:05
NMML File Specification
<?xml version="1.0" encoding="utf-8"?>
<project>
<!-- <meta />
Use meta nodes to set metadata for your application. The description is ignored
on most targets, but is useful for packaging like Chrome Apps or Opera Widgets.
For compatibility with Android and webOS, the package name must include at least
@Asmageddon
Asmageddon / Copy.hx
Created November 4, 2012 20:15
Deep copy of anything for Haxe
package com.asmoprime.utils;
/**
* ...
* @author Asmageddon
*/
class Copy {
/**
* Deep copy of anything using reflection (so don't hope for much performance)
**/
@slodge
slodge / Flurry MonoDroid JNI Client
Created November 14, 2012 17:03 — forked from mlegris/Flurry MonoDroid JNI Client
Flurry MonoDroid JNI Client
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
@Snegovikufa
Snegovikufa / home1.sml
Created January 28, 2013 05:39
coursera_prog_lang_home1
(*
Func 1:
Write a function is_older that takes two dates and evaluates to true or false. It evaluates to true if
the First argument is a date that comes before the second argument. (If the two dates are the same,
the result is false.)
*)
fun is_equal (date1 : int * int * int, date2 : int * int * int) =
(#1 date1 = #1 date2) andalso (#2 date1 = #2 date2) andalso (#3 date1 = #3 date2)
fun is_older (date1 : int * int * int, date2 : int * int * int) =
@deltaluca
deltaluca / gist:5413225
Created April 18, 2013 14:37
16.16 Fixed point numbers in Haxe 3
abstract Fixed16(Int) {
inline function new(x:Int) this = x;
inline function raw() return this;
inline static function RAW(x:Int) return new Fixed16(x);
public static var MAX_VALUE:Fixed16 = RAW(0x7fffffff);
public static var MIN_VALUE:Fixed16 = RAW(1);
@:from public static inline function fromf(x:Float) {
#if debug
# -*- coding: utf-8 -*-
""" Small script that shows hot to do one hot encoding
of categorical columns in a pandas DataFrame.
See:
http://scikit-learn.org/dev/modules/generated/sklearn.preprocessing.OneHotEncoder.html#sklearn.preprocessing.OneHotEncoder
http://scikit-learn.org/dev/modules/generated/sklearn.feature_extraction.DictVectorizer.html
"""
import pandas
import random
@profelis
profelis / Measure.hx
Created May 30, 2013 13:12
Measure macros (Haxe 3)
package ;
#if macro
import haxe.macro.Context;
import haxe.macro.Expr;
#end
/**
* ...
* @author deep <system.grand@gmail.com>
*/
class Measure
@Snegovikufa
Snegovikufa / App.xaml.cs
Last active August 29, 2015 14:04
Set application-wide own culture
using System;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Windows;
using System.Windows.Markup;
namespace WpfApplication1
{
/*
@jasononeil
jasononeil / Metric.hx
Last active November 10, 2016 11:16
Demonstration of using Haxe abstracts to take care of explicit conversions between different units of measurement, with no performance overhead.
class Metric {
static function main() {
var coinRadius:Millimeters = 12;
var myHeight:Centimeters = 180;
var raceLength:Meters = 200;
var commuteDistance:Kilometers = 23;
diff( coinRadius, myHeight ); // 1.788 meters
diff( raceLength, commuteDistance ); // 22800 meters
sum( commuteDistance, coinRadius ); // 23000.012 meters
@nadako
nadako / Main.hx
Created June 24, 2015 19:36
Haxe + SDL = native love \o/
class Main {
static function main() {
Sdl.init(Sdl.INIT_EVERYTHING);
var win = Sdl.createWindow("Hello", 100, 100, 800, 600, Sdl.WINDOW_OPENGL);
var ren = Sdl.createRenderer(win, -1, Sdl.RENDERER_ACCELERATED);
var bmp = Sdl.loadBMP("test.bmp");
var tex = Sdl.createTextureFromSurface(ren, bmp);
Sdl.freeSurface(bmp);
for (i in 0...3) {