Skip to content

Instantly share code, notes, and snippets.

View sromano's full-sized avatar

Sergio sromano

View GitHub Profile
[4] pry(main)> ActionController::Parameters.new({discount:"false"}).require(:discount)
=> "false"
[5] pry(main)> ActionController::Parameters.new({discount:false}).require(:discount)
ActionController::ParameterMissing: param is missing or the value is empty: discount
#include <unistd.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#define N 5
void pexit(char *error) {
perror(error);
@sromano
sromano / codigo.m
Last active August 29, 2015 14:21 — forked from sgromano/codigo.m
%% Prior and Posterior Predictive, Second Example
clear;
%% Data
k = zeros(4,3);
k(1,:) = [0 0 0];
k(2,:) = [1 0 1];
k(3,:) = [1 4 6];
k(4,:) = [2 3 6];
@sromano
sromano / bash.cpp
Created April 19, 2017 17:51
Ejemplo para ejecutar ls | wc -l
#include <stdio.h>
#include <unistd.h>
//Ejemplo para ejecutar ls | wc -l
int main( int argc, char *argv[], char *env[] )
{
pid_t child_pid;
int pipe_fd[2];
//obtengo el número del file descriptor de stdin y de stdout
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import tensorflow as tf
import edward as ed
from edward.models import Bernoulli, Beta, Binomial
#Model
p = Beta(1.0, 1.0)
;; Alleles
(define greenColor (list "green" "R" true))
(define yellowColor (list "yellow" "r" false))
(define wrinkledShape (list "wrinkled" "Y" true))
(define inflatedShape (list "inflated" "y" false))
(define alleles (list greenColor yellowColor wrinkledShape inflatedShape))
@sromano
sromano / apple.scm
Last active November 29, 2017 01:00
;;Constants
(define g 9.8)
;;Object Samplers
(define (sample-position) (uniform 1 1000))
(define (sample-velocity) (uniform 1 10))
(define (sample-object)
(list (sample-velocity)
(sample-velocity)
var faker = require('faker');
var fs = require('fs');
var N = 3;
var path = "json";
if (!fs.existsSync(path)){
fs.mkdirSync(path);
}
faker.locale = "es";