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
require "orbit" | |
require "orbit.routes" | |
local R = orbit.routes.R | |
local hello = orbit.new() | |
hello:dispatch_get(function (web) | |
return string.format('<h1>Welcome to %s!</h1>', web.real_path) |
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
(* Stand-alone Hello World ServiceStack Web Service with F# on Mono/OSX hosted by HttpListener | |
Instructions: | |
1) download https://github.com/ServiceStack/ServiceStack/downloads | |
2) fsharpc -r:ServiceStack.Common.dll -r:ServiceStack.Interfaces.dll -r:ServiceStack.Text.dll -r:ServiceStack.dll Hello.fs | |
3) sudo mono Hello.exe | |
Read More: For the benefits of a ServiceStack Hello World Service see: http://www.servicestack.net/ServiceStack.Hello/ | |
*) |
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
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 |
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
module ActiveSupport::Callbacks::ClassMethods | |
def without_callback(*args, &block) | |
skip_callback(*args) | |
result = yield | |
set_callback(*args) | |
return result | |
end | |
end |
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
# Only insert data | |
mysqldump --compact --no-create-info | |
# Only structure | |
mysqldump --compact --no-data |
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
let newtonSqrt x = | |
let accuracy = 0.00001 // desired accuracy | |
let rec iterate a = | |
let diff = x - a*a | |
if abs diff <= accuracy | |
then a | |
else iterate ((a + x/a) / 2.0) | |
iterate (x/2.0) |
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
val newtonSqrt : float -> float |
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
let badcode x y = | |
if y | |
then newtonSqrt x | |
else newtonSqrt "abc" |
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
let newtonSqrt (x : float) : float = | |
let accuracy : float = 0.00001 // desired accuracy | |
let rec iterate (x : float) (a : float) : float = | |
let diff : float = x - a*a | |
if abs diff <= accuracy | |
then a | |
else iterate x ((a + x/a) / 2.0) | |
iterate x (x/2.0) |
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
Get("foo/bar.html", | |
(request, response) => { | |
using (var connection = new SqlConnection( | |
System.Configuration.ConfigurationManager.AppSettings["strConnection"])) | |
{ | |
connection.Open(); | |
var result = connection.Query<ExecutiveReportResult>( | |
Util.getSql("rm_consulta_relatorio_executivo"), |