Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

carlos L cocodrino

🏠
Working from home
  • Venezuela
View GitHub Profile
View gist:2933009
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
View gist:2933038
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 Jun 16, 2012
code blog --clausuras part1
View gist:2941992
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 Jun 16, 2012
code blog - clausuras 2
View gist:2941999
//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 Jun 16, 2012
code blog - clausuras 3...
View gist:2942007
var aumentar_valor2 = (function(x){
var numero = x;
return function(){
return numero+=1;
};
})(0);
console.log(aumentar_valor2()) //1
@cocodrino
cocodrino / gist:2942012
Created Jun 16, 2012
blog codes -clausuras part 4
View gist:2942012
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 Jun 25, 2012
javascript callbacks to livescript clean code
View gist:2986585
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 Jul 19, 2012
where is the mistake!! :D
View gist:3140683
original file :
Welcome = Ember.Application.create({
ready: function(){
// alert('you did it!');
}
});
Welcome.Book = Ember.Object.extend({
title: '',
@cocodrino
cocodrino / gulpfile
Last active Aug 29, 2015
node-webkit gulp generator
View gulpfile
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"))
View Signal.js
/*
Script: Signal.js
Makes chaining functions easy!
License & Copyright:
Copyright 2009, Mark Obcena <keetology.com>
MIT-Style License
*/
(function(global){