Skip to content

Instantly share code, notes, and snippets.

View knightelvis's full-sized avatar

Archer knightelvis

View GitHub Profile
package main
import (
"fmt"
"log"
"net/http"
)
func init() {
log.SetFlags(log.Lshortfile)

10 Scala One Liners to Impress Your Friends

Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.

Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.

1. Multiple Each Item in a List by 2

The map function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o

@ryanwi
ryanwi / software-terms.dic
Last active March 11, 2025 17:24
Dictionary of software technology terms
.NET
.NET Core
Agile
AI/alias[AI|Artificial Intelligence]
Airflow
Android
Ansible
Angular 2/alias[Angular2|Angular 2]
AngularJS/js[Angular]
API
@susutou
susutou / install.sh
Last active December 15, 2015 03:39
Automated configuration script for configuring HBase on Ubuntu-based EC2 machine.
#!/bin/bash
cd /home/ubuntu
mkdir hbase
cd hbase
mkdir hbase
curl -o hbase-install.tar.gz http://mirror.symnds.com/software/Apache/hbase/stable/hbase-0.94.5.tar.gz
tar xzf hbase-install.tar.gz
rm hbase-install.tar.gz
cd hbase-0.94.5/conf
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs