Skip to content

Instantly share code, notes, and snippets.

View cocodrino's full-sized avatar
🏠
Working from home

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
let rec factorial(n : int) (mem : bigint) =
match n with
| 0 | 1 -> mem
| _ -> factorial (n - 1) (mem * bigint(n))
let BigFactorial(numero,mesaje)=
Async.FromContinuations(fun (cont,error,cancelation) ->
printfn "ha comenzado el proceso: %s" mesaje
factorial numero 1I |>ignore
let rec factorial(n : int) (mem : bigint) =
match n with
| 0 | 1 -> printfn "%A" mem
| _ -> factorial (n - 1) (mem * bigint(n))
let BigFactorial(numero,mesaje)=
Async.FromContinuations(fun (cont,error,cancelation) ->
printfn "begin number: %s" mesaje
factorial numero 1I |>ignore
@cocodrino
cocodrino / gist:2941992
Created June 16, 2012 17:17
code blog --clausuras part1
var aumentar_valor = function(x){
var numero = x;
return function(){
return numero+=1;
};
};
var add_user = aumentar_valor(0);
console.log(add_user());
console.log(add_user());
@cocodrino
cocodrino / gist:2941999
Created June 16, 2012 17:19
code blog - clausuras 2
//al llamar
var add_user = aumentar_valor(0);
//tenemos
var add_user = function(0){ //sustituyendo x por 0
var numero = x;
return function(){
return numero+=1;
};
@cocodrino
cocodrino / gist:2942007
Created June 16, 2012 17:21
code blog - clausuras 3...
var aumentar_valor2 = (function(x){
var numero = x;
return function(){
return numero+=1;
};
})(0);
console.log(aumentar_valor2()) //1
@cocodrino
cocodrino / gist:2942012
Created June 16, 2012 17:24
blog codes -clausuras part 4
var myObject = (function ( ) {
var value = 0;
return {
increment: function (inc) {
value += typeof inc === 'number' ? inc : 1;
},
getValue: function ( ) {
return value;
}
};
@cocodrino
cocodrino / gist:2986585
Created June 25, 2012 04:47
javascript callbacks to livescript clean code
var phantom = require('phantom');
phantom.create(function(ph) {
return ph.createPage(function(page) {
return page.open("http://www.google.com", function(status) {
console.log("opened google? ", status);
return page.evaluate((function() {
return document.title;
}), function(result) {
console.log('Page title is ' + result);
return ph.exit();
@cocodrino
cocodrino / gist:3140683
Created July 19, 2012 04:06
where is the mistake!! :D
original file :
Welcome = Ember.Application.create({
ready: function(){
// alert('you did it!');
}
});
Welcome.Book = Ember.Object.extend({
title: '',
@cocodrino
cocodrino / gulpfile
Last active August 29, 2015 13:59
node-webkit gulp generator
var gulp = require('gulp');
var zip = require('gulp-zip');
var rename = require("gulp-rename");
var shell = require('gulp-shell')
gulp.task('nodewk', function() {
gulp.src('app/**')
.pipe(zip('app.zip'))
.pipe(rename("app.wk"))
/*
Script: Signal.js
Makes chaining functions easy!
License & Copyright:
Copyright 2009, Mark Obcena <keetology.com>
MIT-Style License
*/
(function(global){