Skip to content

Instantly share code, notes, and snippets.

View apellizzn's full-sized avatar

Alberto apellizzn

View GitHub Profile
@apellizzn
apellizzn / CycleList.hs
Last active February 14, 2017 18:03
Check if a list is infinite
module Main where
data List a = Empty | Cons a (List a)
instance Show a => Show (List a) where
show (Cons a next) = show a ++ "-" ++ show next
show Empty = "*"
simpleList :: List Integer
simpleList = Cons 1 . Cons 2 . Cons 3 . Cons 4 $ Empty
@apellizzn
apellizzn / Gemfile
Created January 30, 2015 08:54
Gemfile capistrano
source 'https://rubygems.org'
ruby '2.1.2'
gem 'rake'
gem 'rails', '4.0.9'
# environment variables
gem 'dotenv-rails'
gem 'puma'
gem 'oauth2'
gem 'devise'
@apellizzn
apellizzn / normalizeObject.js
Last active August 29, 2015 14:04
Javascript function that takes in input an object and return it without each attributes with value undefined, null, ""
function normalizeObject(object){
for(var index in object) {
console.log(!object[index]);
if(!object[index] && object[index]!== false && object[index]!==0){
delete object[index]
}
}
}