Skip to content

Instantly share code, notes, and snippets.

View alfonsogarciacaro's full-sized avatar

Alfonso Garcia-Caro alfonsogarciacaro

View GitHub Profile
@alfonsogarciacaro
alfonsogarciacaro / gist:83df0cd2cdd8e6f3a0e6
Created April 21, 2015 10:16
Ractive TodoMVC sample generated with FunScript fNext
(function(){
var ns={};
ns.Program = {};
ns.Program.main = (function() {
var patternInput = ns.Program.init();
var ractive = patternInput[0];
var data = patternInput[1];
ns.Program.todosProcess(ractive, data['items']);
ns.Program.toggleProcess(ractive, data['items']);
return ns.Program.filterProcess(ractive)
@alfonsogarciacaro
alfonsogarciacaro / wrapper.js
Created March 21, 2016 20:42
Wrap Fable modules to expose default member in CommonJS
var fableModule = require("./fable-module.js");
for (var key in fableModule.default) {
exports[key] = fableModule.default[key];
}
@alfonsogarciacaro
alfonsogarciacaro / server.js
Created March 31, 2016 19:19
Fable/samples/browser/react
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _models = require("./models");
var _models2 = _interopRequireDefault(_models);
@alfonsogarciacaro
alfonsogarciacaro / README.md
Last active April 5, 2016 11:34
Server operations for toggl/mobile

Server Requests

  • Authentication: Signup, Login, SignupWithGoogle, LoginWithGoogle
  • DownloadEntries: Download entries from server between two dates (after trying to load them from local db). Triggered by scrolling the TE list.
  • GetChangesFrom: Get changes from server since a specific datetime. Triggered by swiping down the TE list.
  • GetCurrent(Server)State: Get current data from server (no changes). Happens after logging.
  • Item create/update/delete

Server Responses

  • Authentication
  • DownloadEntries
@alfonsogarciacaro
alfonsogarciacaro / script.fsx
Created April 25, 2016 15:57
Script to compare existing versions of Android image resources
open System
open System.IO
let sep = ";"
let resultsFile = __SOURCE_DIRECTORY__ + "/results.csv"
let resourcePath = "/Users/alfonsogarciacaronunez/Documents/Github/mobile/Joey/Resources"
let limit = DateTime.Today.AddDays(-10.)
let set = System.Collections.Generic.HashSet<string>()
let dic = System.Collections.Generic.Dictionary<string,(string list)>()
@alfonsogarciacaro
alfonsogarciacaro / tests.js
Last active July 25, 2016 09:45
Performance tests between native and Immutable Map
"use strict";
var _fableCore = require("fable-core");
var Immutable = require('immutable');
var count, msg;
// F# code
// let test count =
// let mutable m = Map.empty<int, int>
// for i = 0 to count do
@alfonsogarciacaro
alfonsogarciacaro / launch.json
Created August 4, 2016 00:03
Configuration for test project compilation with Fable in VS Code
{
"version": "0.2.0",
"configurations": [
{
"name": "Launch Mono",
"type": "mono",
"request": "launch",
"program": "${workspaceRoot}/build/fable/bin/Fable.Client.Node.exe",
"args": [
"--projFile", "src/tests/Fable.Tests.fsproj",
var _fableCore = require("fable-core");
// let k1 = fun (x:'a) (y:'b) -> x
// let test() =
// let k2 = fun (x:'a) (y:'b) -> x
// let k1' = k1 (fun z -> z)
// let k1'' = k1 (fun z -> z) 2
// let k2' = k2 (fun z -> z)
// let k2'' = k2 (fun z -> z) 2
@alfonsogarciacaro
alfonsogarciacaro / Sudoku.fs
Created February 15, 2017 10:00
Sudoku solver in F# by Steffen Forkmann
module Sudoku
open System
open System.Collections.Generic
type Box = int
type Sudoku = Box array array
let rows = id
let cols (sudoku:Sudoku) =
@alfonsogarciacaro
alfonsogarciacaro / Test.fs
Created February 16, 2017 13:54
Implicit conversion for erased unions
type U2<'a,'b> =
| Case1 of 'a
| Case2 of 'b
static member op_Implicit(x:'a) = U2.Case1 x
static member op_Implicit(x:'b) = U2.Case2 x
let inline (!|) (x:^a) : ^b = ((^a or ^b) : (static member op_Implicit : ^a -> ^b) x)
let foo (arg: U2<string, int>) = ()