Skip to content

Instantly share code, notes, and snippets.

Avatar
🎻
practicing

Raitis Veinbahs siers

🎻
practicing
View GitHub Profile
@guizmaii
guizmaii / GroupableOps.scala
Created April 16, 2019 13:22 — forked from fernandomora/GroupableOps.scala
Scala groupMap from 2.13 for scala 2.12
View GroupableOps.scala
import scala.collection.{immutable, mutable, GenTraversableOnce}
import scala.collection.generic.CanBuildFrom
object GroupableOps {
implicit class ToGroupable[A, Coll[X] <: GenTraversableOnce[X]](coll: Coll[A]) {
// https://github.com/scala/scala/blob/v2.13.0-M5/src/library/scala/collection/Iterable.scala#L578
def groupMap[K, B, To](key: A => K)(f: A => B)
(implicit bf: CanBuildFrom[Coll[A], B, To]): immutable.Map[K, To] = {
View init.vim
let g:ctrlp_map = ''
function! CtrlP()
if (getcwd() == $HOME)
echo "Won't run in ~"
return
endif
if (getcwd() == '/')
echo "Won't run in /"
return
@emmanuelrosa
emmanuelrosa / myriad-pro-font.nix
Last active September 10, 2020 16:48
Nix package for Myriad Pro font
View myriad-pro-font.nix
{ stdenv, fetchurl }:
let
fetchfont = name: num: sha:
fetchurl {
url = "https://fontsup.com/download/${builtins.toString num}.html";
sha256 = sha;
name = "${name}";
};
in stdenv.mkDerivation rec {
View fizzbuzz_direct_threaded.c
#include <stdio.h>
#include <stdint.h>
#define MAX 100
int
main(int argc, char **argv)
{
intptr_t op[MAX + 2];
int ip;
@oriadam
oriadam / colorValues.js
Last active May 6, 2022 11:12
javascript convert any color to array of rgba values
View colorValues.js
// return array of [r,g,b,a] from any valid color. if failed returns undefined
function colorValues(color)
{
if (!color)
return;
if (color.toLowerCase() === 'transparent')
return [0, 0, 0, 0];
if (color[0] === '#')
{
if (color.length < 7)
@joyrexus
joyrexus / README.md
Last active June 3, 2023 07:56
collapsible markdown
View README.md

collapsible markdown?

CLICK ME

yes, even hidden code blocks!

print("hello world!")
@creichert
creichert / fetch-url.hs
Last active January 9, 2020 19:39
Customize haskell http-client supported TLS ciphers
View fetch-url.hs
#!/usr/bin/env stack
-- stack -v runghc --package connection --package http-client --package http-client-tls --package tls --package data-default
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ViewPatterns #-}
{-# OPTIONS_GHC -fno-warn-deprecations #-}
import qualified Network.Connection as NC
import qualified Network.HTTP.Client as Http
import qualified Network.HTTP.Client.TLS as Http
import qualified Network.TLS as TLS
@codepr
codepr / Actor.scala
Last active May 5, 2021 21:10
Basic hello world cluster server
View Actor.scala
package clusterserver
import akka.actor._
class Logger extends Actor with ActorLogging {
log.info("Logger started!")
def receive = {
case msg => log.info("Got msg: {}", msg)
}
@drasill
drasill / vim-fzf-git-ls-files.vim
Created November 19, 2015 09:03
vim : git ls-file + fzf
View vim-fzf-git-ls-files.vim
function! s:escape(path)
return substitute(a:path, ' ', '\\ ', 'g')
endfunction
function! GitLsHandler(line)
execute 'e '. s:escape(a:line)
endfunction
command! -nargs=* Fgl call fzf#run({
\ 'source': 'git ls-files -o -c --exclude-standard "<args>"',