Skip to content

Instantly share code, notes, and snippets.

View Centaur's full-sized avatar

oldpig Centaur

  • singerdream.com
  • Shanghai
View GitHub Profile
@Centaur
Centaur / setjdk.fish
Created June 24, 2019 14:59 — forked from tobias/setjdk.fish
Manage multiple java versions on the mac from the fish shell
function setjdk
if test -n "$JAVA_HOME"
removeFromPath "$JAVA_HOME/bin"
end
set -gx JAVA_HOME (/usr/libexec/java_home -v $argv[1])
set -gx PATH $JAVA_HOME/bin $PATH
end
function removeFromPath
set -l idx 0
@Centaur
Centaur / redis.markdown
Created December 7, 2015 16:02 — forked from bdotdub/redis.markdown
Running redis using upstart on Ubuntu

Running redis using upstart on Ubuntu

I've been trying to understand how to setup systems from the ground up on Ubuntu. I just installed redis onto the box and here's how I did it and some things to look out for.

To install:

@Centaur
Centaur / Gemfile
Last active August 29, 2015 14:28 — forked from petems/Gemfile
An example http download with Progress Bar output in the command line with Ruby and the native `net/http` library...
source "https://rubygems.org"
gem "progressbar"
@Centaur
Centaur / example.scala
Last active August 29, 2015 14:26 — forked from mpilquist/example.scala
Using scala-reflect to desugar
scala> import scala.reflect.runtime.universe._
import scala.reflect.runtime.universe._
scala> showCode(reify {
| for{
| x <- 1 to 5
| _ = print("hi")
| } print(x)
| }.tree)
res1: String =
@Centaur
Centaur / answer.md
Last active August 29, 2015 14:20 — forked from non/answer.md

What is the appeal of dynamically-typed languages?

Kris Nuttycombe asks:

I genuinely wish I understood the appeal of unityped languages better. Can someone who really knows both well-typed and unityped explain?

I think the terms well-typed and unityped are a bit of question-begging here (you might as well say good-typed versus bad-typed), so instead I will say statically-typed and dynamically-typed.

I'm going to approach this article using Scala to stand-in for static typing and Python for dynamic typing. I feel like I am credibly proficient both languages: I don't currently write a lot of Python, but I still have affection for the language, and have probably written hundreds of thousands of lines of Python code over the years.

/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
realm=Sonatype Nexus Repository Manager
host=nexus.company.com
user=admin
password=admin123

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


// You won't be able to compile this with:
// scala -language:dynamics NoDynamics.scala
// These two ambiguous implicits disable the `dynamics` feature.
implicit def ambDynamics1: language.dynamics.type = ???
implicit def ambDynamics2: language.dynamics.type = ???
object Woo extends Dynamic {
def selectDynamic(name: String) = s"$name a mess of a language"