I hereby claim:
- I am rberenguel on github.
- I am rberenguel (https://keybase.io/rberenguel) on keybase.
- I have a public key ASDoKc_uTbL4lQBaJ4bNh9G-5OkiK2gSxIFF6h0xvuMy8wo
To claim this, I am signing this object:
| %!PS-Adobe-2.0 | |
| %%% Start of L-system definition | |
| /STARTK { FK +K +K FK +K +K FK} def | |
| /FK { | |
| dup 0 eq | |
| { DK } % if the recursion order ends, draw forward | |
| { | |
| 1 sub % recurse |
| %!PS-Adobe-3.0 | |
| %%BeginFeature: *PageSize A4 | |
| << /PageSize [595 842] >> setpagedevice | |
| %%EndFeature | |
| %/PageSize A4 | |
| /CoordX 595 def | |
| /CoordY 842 def | |
| /RadiMax 95 def |
| %!PS-Adobe-2.0 | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| % % | |
| % Mandelbrot set via PostScript code. Not optimized % | |
| % in any way. Centered in A4 paper. Escape time, B&W % | |
| % % | |
| %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
| /fun { |
| case class Country(name: String) { | |
| private val ThreeLetterValidCountries = List("FOO", "BAR") | |
| def valid: Option[Country] = | |
| if (ThreeLetterValidCountries.contains(name.toUpperCase)) Some(this) else None | |
| } | |
| object Country { | |
| def apply(name: String): Country = new Country(name.toUpperCase) | |
| } |
| # -*- coding: utf-8 -*- | |
| # | |
| # Author: Vegard Nossum <[email protected]> | |
| import math | |
| import os | |
| import sys | |
| import cairo |
| case class Foo(id: String, value: Int) | |
| case class Bar(theId: String, value: Int) | |
| val ds = List(Foo("Alice", 42), Foo("Bob", 43)).toDS | |
| import org.apache.spark.sql.{DataFrame, Dataset} | |
| val renamedDF: DataFrame = ds.select($"id".as("theId"), $"value") | |
| val renamedDS: Dataset[Bar] = renamedDF.toDF("theId", "value").as[Bar] |
I hereby claim:
To claim this, I am signing this object:
| import org.apache.spark.sql.types._ // You'll need this to evaluate its output | |
| object StructFmt { | |
| def asScala(field: StructField): String = field.dataType match { | |
| case struct: StructType => s"""StructField("${field.name}",""" + asScala(struct) + s", ${field.nullable})" | |
| case _ => s"""StructField("${field.name}", ${field.dataType}, ${field.nullable})""" | |
| } | |
| def asScala(struct: StructType): String = "StructType(Seq(" + (for(field <- struct) yield asScala(field)).mkString(",") + "))" | |
| } |
| _fzf_complete_git() { | |
| ARGS="$@" | |
| local branches | |
| branches=$(git branch -vv --all | sed "s/remotes\/origin\///g" | sed "s/\*/ /g") | |
| if [[ $ARGS == 'git co'* ]]; then | |
| _fzf_complete "--reverse --multi" "$@" < <( | |
| echo $branches | |
| ) | |
| else | |
| eval "zle ${fzf_default_completion:-expand-or-complete}" |
| from __future__ import print_function | |
| import ast | |
| """ | |
| Save the following in test.py, then execute fun_with_ast.py. | |
| You can paste the output in a Scala interpreter | |
| class something(object): | |
| def __init__(self, value1, value2): |