Skip to content

Instantly share code, notes, and snippets.

View Baccata's full-sized avatar

Olivier Mélois Baccata

View GitHub Profile
@Baccata
Baccata / cloneAllBitbucket.sh
Last active July 1, 2016 12:40
Cloning all the repos under a user or team from bitbucket
#!/bin/bash
#Script to get all repositories under a user or team from bitbucket
#Usage: cloneAllBitbucket [username] [user_or_team]
curl -u ${1} https://api.bitbucket.org/1.0/users/${2} \
| jsawk 'return this.repositories.map(function(item){return item.name;})' \
| jsawk -n 'out(this)' \
| sed -e 's/^"//' -e 's/"$//' > repos
for repo_name in `cat repos`
import shapeless._
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// THE IMPLICIT CLASS THAT ALLOWS TO CALL #copy ON ANY SEALED TRAIT INSTANCE
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
object copySyntax {
implicit class CopySyntax[TypeToCopy](thingToCopy: TypeToCopy) {
module Main where
main = putStrLn (show (fforall (\x -> (x >= -1000)) (setInt)))
type Set a = a -> Bool
setInt :: Set Int
setInt = \x -> True
--filtering the range with the set function and checking if all elements from the set satisfy the predicate
fforall :: Restrict a => (a -> Bool) -> Set a -> Bool
@Baccata
Baccata / Bool.scala
Created February 25, 2015 22:44
Implementation of typelevel booleans and integers using type projections
package baccata
/**
* Inspired from Grant Beaty's Scunits
*/
trait Bool {
type branch[B,T <: B, E <: B] <: B // typelevel if-then-else
type not <: Bool
type or[R <: Bool] <: Bool
type and[R <: Bool] <: Bool