Skip to content

Instantly share code, notes, and snippets.

anonymous
anonymous / solution.scala
Created Apr 8, 2013
Solve 10 problems of eulerproject using 20 lines scala code
View solution.scala
import collection._
import Stream._
implicit class D(n: Int) {
def fs = (1 until n) filter (n%_ == 0) sum // sum of n's proper divisors
}
val r = mutable.Map[Int, Any]() // to store the result
val num = from(0) //all non-negative integer numbers
def isprime(n: Int) = BigInt(n) isProbablePrime 10
@visenger
visenger / install_scala_sbt.sh
Last active Jan 31, 2020
Scala and sbt installation on ubuntu 12.04
View install_scala_sbt.sh
#!/bin/sh
# one way (older scala version will be installed)
# sudo apt-get install scala
#2nd way
sudo apt-get remove scala-library scala
wget http://www.scala-lang.org/files/archive/scala-2.11.4.deb
sudo dpkg -i scala-2.11.4.deb
sudo apt-get update
@dodyg
dodyg / gist:5823184
Last active May 24, 2020
Kotlin Programming Language Cheat Sheet Part 1
View gist:5823184

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Jun 21, 2020
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

READ THIS Very Important Update

This entire guide is based on an old version of Homebrew/Node and no longer applies. It was only ever intended to fix a specific error message which has since been fixed. I've kept it here for historical purposes, but it should no longer be used. Homebrew maintainers have fixed things and the options mentioned don't exist and won't work.

I still believe it is better to manually install npm separately since having a generic package manager maintain another package manager is a bad idea, but the instructions below don't explain how to do that.

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

You can’t perform that action at this time.