Skip to content

Instantly share code, notes, and snippets.

var walk;
(function() {
function showId(tag) {
return tag.id ? '#' + tag.id : '';
}
function showClasses(tag) {
var classes = "";
for (var i = 0; i < tag.classList.length; i++) {
// ==UserScript==
// @name Fix gmail images
// @namespace fixGmailImages
// @match https://mail.google.com/*
// ==/UserScript==
//
(function() {
function fix() {
var images = document.getElementsByTagName('img');
for (var i = 0; i < images.length; i++) {
" Vim color file
" Maintaner: Radu Dineiu <radu.dineiu@gmail.com>
" URL: http://ld.yi.org/vim/rdark/
" Last Change: 2007 Jun 23
" Version: 0.6
"
" Features:
" - let rdark_current_line = 1 if you want to highlight the current line
"
" Changelog:

Hyperactive: HTTP/2 and Python

12:10pm Friday

Cory Benfield. (Core contributor to the requests library)

HTTP/1.1

  • HTTP/1.1 was standardized in 1996.
  • TCP works best if you keep a connection alive and keep sending data down it.

Notes on Typing Haskell in Haskell

Conventions

Variable names:

  • kind: k (Kind)
  • type constructor: tc (Tycon)
  • type variable: v (Tyvar)
  • fixed type variable: f
data CrazyList a = CL a (CrazyList [a]) | End
-- Try compiling this without either type annotation:
f :: CrazyList a -> Int
f End = 0
f (CL x rest) = g x rest
g :: a -> CrazyList [a] -> Int
g x rest = 1 + (f rest)
-- requires "mtl"
import Control.Monad.State
import Control.Monad.Except
import Data.Map (Map)
import qualified Data.Map as Map
data Err = Missing String | OtherErr
deriving (Eq, Show)
import Control.Monad (liftM)
import Control.Monad.Except
type MyMonad = ExceptT String IO
successVal :: MyMonad Int
successVal = return 123
errVal :: MyMonad Int
errVal = throwError "this is an error"

Erlang Cheat Sheet

(this is a work in progress)

Running Erlang

Getting the interpreter in ubuntu: sudo apt-get install erlang. To get native compliation capability, also install erlang-base-hipe.

Starting the interpreter: erl. To exit: Ctrl-g then q enter.

import Control.Concurrent
main = do
setNumCapabilities 4
result <- parallelDoWork 38 4
--result <- doWork 38 4
putStrLn $ show result
parallelDoWork n m = do
resultMVars <- mapM (\_ -> forkWork n) [1..m]