Skip to content

Instantly share code, notes, and snippets.

Avatar
🐫

Yo Lulkin joaomilho

🐫
  • Spotify
  • Stockholm, Sweden
View GitHub Profile
View _baseline.scss
$base-font-size: 16px;
$base-line-height: 1.5;
// this value may vary for each font
// unitless value relative to 1em
$cap-height: 0.68;
@mixin baseline($font-size, $scale: 2) {
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 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 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 personnummer.rb
# Generator for valid Swedish personnummer: http://en.wikipedia.org/wiki/Personal_identity_number_(Sweden)
# By Henrik Nyh <http://henrik.nyh.se> 2009-01-29 under the MIT license.
require 'date'
module Personnummer
def self.generate(date=nil, serial=nil)
date ||= Date.new(1900+rand(100), 1+rand(12), 1+rand(28))
serial = serial ? serial.to_s : format("%03d", 1+rand(999)) # 001-999
View numerology.hs
import Char
r = flip mod
b [l] = l
b l = b $ map (\x -> read [x]) $ show $ sum l
s = b . map ((+1) . r 9 . r 97 . ord . toLower) . filter isAlpha
main = do
x <- getLine
putStr $ show $ s x
View liquid_view.rb
# LiquidView is a action view extension class. You can register it with rails
# and use liquid as an template system for .liquid files
#
# Example
#
# ActionView::Base::register_template_handler :liquid, LiquidView
class LiquidView
PROTECTED_ASSIGNS = %w( template_root response _session template_class action_name request_origin session template
_response url _request _cookies variables_added _flash params _headers request cookies
ignore_missing_templates flash _params logger before_filter_chain_aborted headers )