Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀
Excelsior!

Sameer Kolhar kolharsam

🚀
Excelsior!
View GitHub Profile
@chiroptical
chiroptical / babyShark.hs
Last active Sep 14, 2021
Baby shark as a Haskell program
View babyShark.hs
{-# LANGUAGE BlockArguments #-}
module Main where
main :: IO ()
main = do
babyShark
do do do do do do babyShark
do do do do do do babyShark
do do do do do do babyShark
@serras
serras / advent-haskell-2020.md
Created Dec 15, 2020
Advent of Haskell 2020
View advent-haskell-2020.md

Talking about Toys

Every year Santa 🎅 brings joy (and presents 🎁) to all the kids in the world. Well, not when I was a child! Following the usual Spanish traditions, the Three Reyes Magos brought me presents in their camels 🐫 following the Star 💫 Nowadays, it's Sinterklaas who puts pepernoten in my shoes 👞. Because in fact there's not one, but a group of present-bringing people, distributed across the globe 🌐, each with their own part of the world to cover (or you really thought just one man and eight reindeers could do it all by their own?)

In order to communicate, they need a way to exchange information about presents. Since they are all very wise, they've agreed to use Haskell, so this information is represented using algebraic data types. Here are some types related to building blocks:

data Block = Block BlockBrand String Color
data BlockBrand = LegoKNex
@GavinRay97
GavinRay97 / docker-compose.yaml
Created Aug 27, 2020
Hasura GraphQL Tx over Websockets client
View docker-compose.yaml
version: '3.6'
services:
postgres:
image: postgres:12
restart: always
volumes:
- db_data:/var/lib/postgresql/data
environment:
POSTGRES_PASSWORD: postgrespassword
graphql-engine:
@iansu
iansu / README.md
Last active Mar 1, 2021
Create React App 4.0 Alpha Testing
View README.md

Create New App

JavaScript Template

npx create-react-app@next --scripts-version=@next --template=cra-template@next my-js-app

TypeScript Template

npx create-react-app@next --scripts-version=@next --template=typescript@next my-ts-app

View org-capture-demo.el
;;; org-capture-demo.el --- Org capture demo configuration.
;;; Commentary:
;;; Author: Suvrat Apte
;;; Created on: 03 May 2020
;;; Copyright (c) 2019 Suvrat Apte <suvratapte@gmail.com>
;; This file is not part of GNU Emacs.
;;; License:
View maxPointsOnLine.hs
*Main> maxPointsOnLine [(1,1), (3,2), (5,3), (4,1), (2,3), (1,4)]
4
@lispyclouds
lispyclouds / monads.clj
Last active May 17, 2020
Monads, simple made easier
View monads.clj
; A simple demo of monadic composition of side effects
; Program to take 3 nubers as input and print their sum.
(defn read-and-add!
[prev]
(print "Enter a number: ")
(+ prev (do (flush)
(Integer/parseInt (read-line)))))
(defn bind
@borkdude
borkdude / js_parser.clj
Last active Jun 30, 2020
Parse JavaScript in Clojure using the Google Closure Compiler
View js_parser.clj
#!/bin/sh
#_(
"exec" "clojure" "-Sdeps" "{:deps {org.clojure/clojurescript {:mvn/version \"1.10.520\"}}}" "$0" "$@"
)
;; running js_parser.clj "function foo(x) { var y = x + 1; }" will print:
;; [{:type :function, :name "foo", :body [{:variable-statement [{:lvalue "y", :initializer {:type :binary-op, :left "x", :operator "+", :right "1"}}]}], :params ["x"]}]
@dino-
dino- / string-conversions.hs
Last active Nov 5, 2021
A handy illustration of converting between String, Text and ByteString in Haskell
View string-conversions.hs
#! /usr/bin/env stack
-- stack --resolver lts-12.14 script
{-# LANGUAGE OverloadedStrings #-}
{-
This is a handy illustration of converting between five of the commonly-used
string types in Haskell (String, ByteString, lazy ByteString, Text and lazy
Text).
@vedang
vedang / psk.clj
Last active May 11, 2020
A Clojure simulation of the Passport Seva Kendra
View psk.clj
(ns challenges.psk
"A Simulation of the Passport Seva Kendra"
(:require [clj-time.core :as ct]
[clojure.tools.logging :as ctl])
(:import [java.util.concurrent LinkedBlockingQueue PriorityBlockingQueue]))
(def working-hours? (atom false)) ; use this to control agents.
; Turning this off will
; shutdown agents.