Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫

Yo Lulkin joaomilho

🐫
  • Spotify
  • Stockholm, Sweden
View GitHub Profile
View senna.rb
# >---------------------------------------------------------------------------<
#
# _____ _ _ __ ___ _
# | __ \ (_) | \ \ / (_) | |
# | |__) |__ _ _| |___\ \ /\ / / _ ______ _ _ __ __| |
# | _ // _` | | / __|\ \/ \/ / | |_ / _` | '__/ _` |
# | | \ \ (_| | | \__ \ \ /\ / | |/ / (_| | | | (_| |
# |_| \_\__,_|_|_|___/ \/ \/ |_/___\__,_|_| \__,_|
#
# This template was generated by RailsWizard, the amazing and awesome Rails
@joaomilho
joaomilho / qs.hs
Created May 4, 2014
Classical quicksort in haskell for didactic purposes
View qs.hs
qs [] = []
qs (x:xs) = qs (filter (<= x) xs) ++ [x] ++ qs (filter (> x) xs)
View operation.hs
module Main where
import Text.ParserCombinators.Parsec
runop :: Char -> Integer -> Integer -> Integer
runop '+' firstOperand secondOperand = firstOperand + secondOperand
runop '-' firstOperand secondOperand = firstOperand - secondOperand
runop '*' firstOperand secondOperand = firstOperand * secondOperand
runop '^' firstOperand secondOperand = firstOperand ^ secondOperand
operation :: Parser Integer
View ChameleonBass.hs
module ChameleonBass where
import Haskore.Music
import Haskore.Melody
import Haskore.Basic.Pitch
import Haskore.Basic.Duration
import Haskore.Music.GeneralMIDI
import Haskore.Interface.MIDI.Render
pitch_line = map (\(x,y,z) -> x (y :: Octave) z () )
View relational.hs
-- relational.hs
import Database.HDBC
import Database.HDBC.PostgreSQL
import Data.List
printTuples conn rel = quickQuery' conn ("SELECT DISTINCT * FROM " ++ rel) []
(⋈) = intercalate " NATURAL JOIN "
(π) fields rel1 = "(SELECT " ++ (intercalate "," fields) ++ " FROM " ++ rel1 ++ ") a"
View logic.hs
(¬) True = False
(¬) False = True
True x = x
False x = False
True x = True
False x = x
True x = x
View pet.erl
module(pet, [Id, Name, Species]).
compile(export_all).
View petster_pet_controller.erl
module(petster_pet_controller, [Request]).
compile(export_all).
index('GET', []) –>
Pets = boss_db:find(pet, []),
{ok, [{pets, Pets}]}.
View src--controller--petster_hello_controller.erl
-module(petster_hello_controller, [Request]).
-compile(export_all).
world('GET', []) ->
{output, "This is not a hello world"}.