Skip to content

Instantly share code, notes, and snippets.

View .gitlab-ci.yml
################################################################################
# GitLab docs on types of pipelines:
# https://docs.gitlab.com/ee/ci/pipelines/pipeline_architectures.html
#
# This one is set to be a basic pipeline of the following steps:
#
# build binaries -> test binaries -> build and push image -> deploy image
#
# we do fan out during deploy and push to all environments at once since our
# deployes are driven by infra changes
@dmjio
dmjio / Elevator.cs
Created Aug 23, 2012
Making an elevator in C#
View Elevator.cs
using System;
using System.Threading;
namespace OOP
{
public class Program
{
private const string QUIT = "q";
public static void Main (string[] args)
View haskell-survey.md

Haskell Survey

Proficiency scale

  1. Not aware of the feature/concept/package in question, what it is or when to use it. Reading the description of this feature/concept/package is the first time I've heard of it.
  2. Have heard of said feature/concept/package, vaguely familiar with usage, not familiar with implementation.
  3. Moderate usage, familiar with best practices, have used in personal projects or on the job.
  4. Used feature/concept/package heavily, know when to use, advanced understanding.
  5. Commanding understanding of the feature/concept/package, comprehensive knowledge of trade-offs to make with said feature/concept/package. She knows when not to use it, expert level understanding and familiarity with implementation, can create pedagoical implementation where/if applicable.
View Replace.hs
module Main where
import qualified Data.ByteString.Lazy as BL
import qualified Data.ByteString.Lazy.Char8 as BL8
import System.Environment
import Debug.Trace
main :: IO ()
main = do
fileName:currentPath:newPath:[] <- getArgs
View Lexer.x
{
module Lexer98 ( scanTokens ) where
import Data.Text (Text)
import qualified Data.Text as Text
}
%wrapper "basic"
View SplitOn.hs
import qualified Data.ByteString as B
import Data.ByteString (ByteString)
splitOn' :: ByteString -> ByteString -> [ByteString]
splitOn' del bs | B.null bs = []
splitOn' del bs =
case B.breakSubstring del bs of
(ls, rest) ->
if B.null rest
@dmjio
dmjio / Stats.hs
Last active Nov 7, 2020
Mean, Standard Deviation, Variance in Haskell
View Stats.hs
module Main where
import Control.Applicative
{- Result = (Mean = 0.34, St. Dev = 0.115, Variance = 0.005) -}
main :: IO ()
main = interact stats
where
length' = fromIntegral . length
stats d = show (avg, stdDev, variance)
View Main.hs
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE KindSignatures #-}
module Main where
View DList.hs
newtype DL a = DL { unDL :: [a] -> [a] }
instance Show a => Show (DL a) where
show = show . toList
instance Semigroup (DL a) where
View gist:3831557
/*lower:convert c to lowercase; ASCII only*/
int lower(int c)
{
if (c >= 'A' && c <= 'Z')
return c +'a'-'A';
else
return c;
}