Skip to content

Instantly share code, notes, and snippets.

View strobe's full-sized avatar

strobe strobe

View GitHub Profile
@retronym
retronym / type-bounds.scala
Created December 16, 2009 11:17
Tour of Scala Type Bounds
class A
class A2 extends A
class B
trait M[X]
//
// Upper Type Bound
//
def upperTypeBound[AA <: A](x: AA): A = x
@tinoadams
tinoadams / SetReceiveTimeoutTest.scala
Created May 27, 2012 03:17
Shows the behaviour of setReceiveTimeout
import java.util.Date
import akka.actor.Actor
import akka.actor.ActorSystem
import akka.actor.Props
import akka.actor.ReceiveTimeout
import akka.util.duration._
class MyActor extends Actor {
context.setReceiveTimeout(5 seconds)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 19:59
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@phgrau
phgrau / gist:4048239
Created November 9, 2012 21:07 — forked from anonymous/gist:4047604
a quick and dirty tips-n-tricks for ansible
Variables
==========
predefined variables :
- inventory_hostname (fqdn) (normally the same as ansible.fqdn)
- inventory_hostname_short
To know the return codes returned by ansible modules, just use plain ansible -vvv to see them :
ansible -i ~/ansible/arrfab.net/hosts/hosts.cfg -vvv -m copy -a 'src=files/sysinfo dest=/etc/sysinfo' tungstene.arrfab.net
tungstene.arrfab.net | success >> {
"changed": true,
@Timshel
Timshel / Application.scala
Last active December 19, 2015 21:19
Multiple select example using play2 master
package controllers
import play.api._
import play.api.data._
import play.api.data.Forms._
import play.api.mvc._
object Application extends Controller {
val form = Form(
@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)
@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
@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)
@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, но также может содержать еще и дополнительные методы.
@vsouza
vsouza / .bashrc
Last active June 14, 2024 08:45
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