An introduction to curl using GitHub's API
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
// ... | |
Request request = new Request.Builder() | |
.url(url) | |
.tag(TAG) | |
.build(); | |
// Cancel previous call(s) if they are running or queued | |
OkHttpUtils.cancelCallWithTag(client, TAG); | |
// New call |
/** GADTs in Scala and their limitations */ | |
/** Background: what is an algebraic data type (ADT) ? | |
* ADT: (possibly) recursive datatype with sums and products | |
* In scala - a trait with case classes (case class is product, subtyping is sum) | |
*/ | |
/** Motivation: untyped embedded DSL doesn't prevent nonsensical expressions */ | |
sealed trait Expr { | |
def apply(other: Expr) = Ap(this, other) |
// The expression problem is a new name for an old problem. The goal is to | |
// define a datatype by cases, where one can add new cases to the datatype and | |
// new functions over the datatype, without recompiling existing code, and while | |
// retaining static type safety (e.g., no casts). | |
// (Philip Wadler) | |
import scala.language.implicitConversions | |
object ExpressionProblem extends App { |
An introduction to curl
using GitHub's API.
Makes a basic GET request to the specifed URI
curl https://api.github.com/users/caspyin
A function compare_json_data(source_data_a,source_data_b)
, accepting structures populated with data loaded from json.load()
and comparing for equality.
$ python compare.py
Compare JSON result is: True
JSON files a.json
and b.json
are loaded via load_json()
function and structures passed into compare_json_data()
for comparison.
When you're working on multiple coding projects, you might want a couple different version of Python and/or modules installed. That way you can keep each project in its own sandbox instead of trying to juggle multiple projects (each with different dependencies) on your system's version of Python. This intermediate guide covers one way to handle multiple Python versions and Python environments on your own (i.e., without a package manager like conda
). See the Using the workflow section to view the end result.