Skip to content

Instantly share code, notes, and snippets.

View strobe's full-sized avatar

strobe strobe

View GitHub Profile
@EncodePanda
EncodePanda / Scala and Emacs with Ensime. Guide for frustrated IDEA users.md
Last active June 13, 2018 08:04
Scala and Emacs with Ensime. Guide for frustrated IDEA users.
@knshiro
knshiro / build.sbt
Created August 5, 2015 08:35
Publish a deb with sbt and sbt-native-packager to bintray
import _root_.bintray.Bintray
enablePlugins(JavaAppPackaging, JDebPackaging)
name := "my-project"
maintainer := "My name <[email protected]>"
packageSummary := "Super package"
@cb372
cb372 / jargon.md
Last active May 14, 2024 03:45
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.

@marioosh
marioosh / ChatRoom.scala
Last active March 1, 2020 08:11
websocket based on akka-http
class ChatRoom(roomId: Int, actorSystem: ActorSystem) {
private[this] val chatRoomActor = actorSystem.actorOf(Props(classOf[ChatRoomActor], roomId))
def websocketFlow(user: String): Flow[Message, Message, _] = ???
def sendMessage(message: ChatMessage): Unit = chatRoomActor ! message
}
@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active March 22, 2025 08:11
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@vsouza
vsouza / .bashrc
Last active April 20, 2025 21:15
Golang setup in Mac OSX with HomeBrew. Set `GOPATH` and `GOROOT` variables in zshell, fish or bash.
# Set variables in .bashrc file
# don't forget to change your path correctly!
export GOPATH=$HOME/golang
export GOROOT=/usr/local/opt/go/libexec
export PATH=$PATH:$GOPATH/bin
export PATH=$PATH:$GOROOT/bin
@orionll
orionll / Typeclasses.scala
Last active June 9, 2020 12:46
Typeclass example
// Тайпкласс Animal (для полноты картины добавил метод hello, иначе был бы совсем тривиальный пример)
// Animal полностью абстрагирован от низлежашего типа A
trait Animal[A] {
def word: String
def talk() { println(word) }
def hello(a: A): String
}
// Обертка над тайпклассом Animal, чтобы можно было писать cat.hello, а не animal.hello(cat)
// AnimalOps полностью дублирует методы, определённые в Animal, но также может содержать еще и дополнительные методы.
@koistya
koistya / ReactJS-Server-Side-Rendering.md
Last active September 15, 2023 07:32
Server-side Rendering (SSR) for ReactJS / Flux Applications. Setting document.title

Files

The basic structure of a React+Flux application (see other examples)

 - /src/actions/AppActions.js     - Action creators (Flux)
 - /src/components/Application.js - The top-level React component
 - /src/constants/ActionTypes.js  - Action types (Flux)
 - /src/core/Dispatcher.js        - Dispatcher (Flux)
 - /src/stores/AppStore.js        - The main store (Flux)
@ftrain
ftrain / .emacs
Last active July 16, 2021 17:26
a nice .emacs for when you are on a terminal. Respects scroll wheel events. Very useful when run inside of tmux and combined with this tmuxconf: https://gist.github.com/ftrain/8443744
;; .emacs
;;; uncomment this line to disable loading of "default.el" at startup
;; (setq inhibit-default-init t)
;; enable visual feedback on selections
(setq transient-mark-mode t)
;; default to better frame titles
(setq frame-title-format
@stew
stew / scala-arrows.el
Created August 4, 2013 00:35
Fancy unicode arrows for emacs scala-mode. Done this way because I don't think it can work as an abbrev.
(defun right-arrow ()
(interactive)
(cond ((looking-back "=")
(backward-delete-char 1) (insert "⇒"))
((looking-back "-")
(backward-delete-char 1) (insert "→"))
(t (insert ">"))))
(defun left-arrow ()
(interactive)