Skip to content

Instantly share code, notes, and snippets.

View Art's full-sized avatar

Art Scott Art

View GitHub Profile
@7shi
7shi / wpf.fs
Created September 10, 2011 01:47
open System
open System.Windows
open System.Windows.Controls
open System.Windows.Shapes
open System.Windows.Media
let move sh x y =
Canvas.SetLeft(sh, x)
Canvas.SetTop(sh, y)
@fahadsuhaib
fahadsuhaib / F#
Created January 25, 2012 09:50
Pit jQuery integration
/// Pit jQuery API - Experimental version, modifies Pit AST to generate proper jQuery output
document.GetElementById("check")
|> jQuery.ofEl
|> jQuery.attr3 ([|"src","/images/hat.gif";"title","jQuery";"alt","jQuery logo"|])
|> jQuery.css3 ("background","red")
|> jQuery.ignore
@rojepp
rojepp / FsVersion.fs
Created March 14, 2012 00:02
F# Translation for Miguel. I have no idea if this works, and it is pretty much a verbatim translation, only some F# flare added. I didn't dare to do too much refactoring without having a way to test properly. Original: https://github.com/xamarin/monotouch
namespace GLCameraRipple
open System
open System.Drawing
open System.Runtime.InteropServices
//open MonoTouch.CoreFoundation
open Microsoft.FSharp.NativeInterop
type RippleModel(screenSize : Size, meshFactor: int, touchRadius: int, textureSize: Size) =
do Console.WriteLine ("New RippleModel");
let poolWidth = screenSize.Width / meshFactor
@forki
forki / gist:2161484
Created March 22, 2012 18:41
A sample XAML file
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid Name="MainGrid">
<StackPanel Name="StackPanel1">
<Button Name="Button1">First Button</Button>
<Button Name="Button2">Second Button</Button>
</StackPanel>
</Grid>
</Window>
@forki
forki / gist:2161552
Created March 22, 2012 18:43
Starting the WPF app
open System
open System.Windows
open System.Windows.Controls
open FSharpx
type MainWindow = XAML<"Window.xaml">
let loadWindow() =
let window = MainWindow()
window.Button1.Click.Add(fun _ ->
@deepankarsharma
deepankarsharma / modern_opengl_01_triangle.py
Created August 28, 2012 01:50
Modern opengl using Python
from glfwpy.glfw import (AUTO_POLL_EVENTS, OPENED, OPENGL_CORE_PROFILE,
OPENGL_FORWARD_COMPAT, OPENGL_PROFILE, OPENGL_VERSION_MAJOR,
OPENGL_VERSION_MINOR, WINDOW,
Enable, GetWindowParam, Init, OpenWindow, OpenWindowHint,
SetKeyCallback, SetWindowTitle, SwapBuffers, Terminate)
import numpy as np
from OpenGL.arrays import ArrayDatatype
from OpenGL.GL import (GL_ARRAY_BUFFER, GL_COLOR_BUFFER_BIT,
GL_COMPILE_STATUS, GL_FALSE, GL_FLOAT, GL_FRAGMENT_SHADER,
GL_LINK_STATUS, GL_RENDERER, GL_SHADING_LANGUAGE_VERSION,
@ApprenticeGC
ApprenticeGC / SomeClassFSharp.fs
Created October 27, 2012 09:18
Unity 3d editor plugin code in F#
namespace Assembly_FSharp_vs
open UnityEditor
open UnityEngine
type public SomeTool() =
inherit UnityEditor.EditorWindow()
//
[<MenuItem("MySelection/Print Selection")>]
static member ShowWindow() = UnityEditor.EditorWindow.GetWindow(typeof<SomeTool>)
@mathias-brandewinder
mathias-brandewinder / gist:5558573
Last active October 31, 2023 05:05
Stub for F# Machine Learning Dojo
// This F# dojo is directly inspired by the
// Digit Recognizer competition from Kaggle.com:
// http://www.kaggle.com/c/digit-recognizer
// The datasets below are simply shorter versions of
// the training dataset from Kaggle.
// The goal of the dojo will be to
// create a classifier that uses training data
// to recognize hand-written digits, and
// evaluate the quality of our classifier
module test
(*
#r "Microsoft.Solver.Foundation.dll";;
#load "test.fs";;
test.computeProblem;;
*)
open Microsoft.SolverFoundation.Common
open Microsoft.SolverFoundation.Services
@CarstenKoenig
CarstenKoenig / Vec.hs
Last active December 19, 2015 16:19
Vec.hs
-- basic implementation of a vector type
-- modeled after the Vec type from Courseras "Coding the Matrix" class
-- | implementation of a sparse-vector representation based on the
-- Courseras "Coding the Matrix" MOOC class
-- this is in no way optimized and is just indended for learning
module Vec where
-- *** I worked with these imports ... you might want others (or not)