Skip to content

Instantly share code, notes, and snippets.

:octocat:
Focusing

chenrui chenrui333

:octocat:
Focusing
Block or report user

Report or block chenrui333

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@DanHerbert
DanHerbert / fix-homebrew-npm.md
Last active Oct 19, 2019
Instructions on how to fix npm if you've installed Node through Homebrew on Mac OS X or Linuxbrew
View fix-homebrew-npm.md

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.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.

Before you start, make a note of any globally installed npm packages. These instructions will have you remove all of those packages. After you're finished you'll need to re-install them.

@dodyg
dodyg / gist:5823184
Last active Oct 5, 2019
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.

@visenger
visenger / install_scala_sbt.sh
Last active Feb 14, 2019
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
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
You can’t perform that action at this time.