Gremin traversal examples taken from the excellent DS330: DataStax Enterprise Graph course.
Add a Vertex
Vertex u = graph.addVertex("user");
u.property("userId","u2016");
u.property("age",36);
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
Gremin traversal examples taken from the excellent DS330: DataStax Enterprise Graph course.
Add a Vertex
Vertex u = graph.addVertex("user");
u.property("userId","u2016");
u.property("age",36);
#!/bin/sh | |
# 's_\^\*~_\n_g' is the line delimiter in input file replace with yours | |
sed 's_\^\*~_\n_g'| wc -l |
This cheat sheet originated from the forum, credits to Laurent Poulain. We copied it and changed or added a few things.
def example = 2 // evaluated when called
val example = 2 // evaluated immediately
Here are 10 one-liners which show the power of scala programming, impress your friends and woo women; ok, maybe not. However, these one liners are a good set of examples using functional programming and scala syntax you may not be familiar with. I feel there is no better way to learn than to see real examples.
Updated: June 17, 2011 - I'm amazed at the popularity of this post, glad everyone enjoyed it and to see it duplicated across so many languages. I've included some of the suggestions to shorten up some of my scala examples. Some I intentionally left longer as a way for explaining / understanding what the functions were doing, not necessarily to produce the shortest possible code; so I'll include both.
The map
function takes each element in the list and applies it to the corresponding function. In this example, we take each element and multiply it by 2. This will return a list of equivalent size, compare to o
In this post I have a few goals: | |
1. Become (re-)familiar with available geoms | |
2. Become (re-)familiar with aesthetic mappings in geoms (stroke who knew?) | |
3. Answer these questions: | |
<ul> | |
<li>How often do various geoms appear and how often do they have required aesthetics?</li> | |
<li>How often do various aesthetics appear and how often are they required?</li> | |
<li>What geoms are most similar based on mappings?</li> | |
</ul> |
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
Git for Windows is bundled with "Git Bash" terminal which is incredibly handy for unix-like commands on a windows machine. It is missing a few standard linux utilities, but it is easy to add ones that have a windows binary available.
The basic idea is that C:\Program Files\Git\mingw64\
is your /
directory according to Git Bash (note: depending on how you installed it, the directory might be different. from the start menu, right click on the Git Bash icon and open file location. It might be something like C:\Users\name\AppData\Local\Programs\Git
, the mingw64
in this directory is your root).
If you go to that directory, you will find the typical linux root folder structure (bin
, etc
, lib
and so on).
If you are missing a utility, such as wget, track down a binary for windows and copy the files to the corrisponding directories.
Sometimes the windows binary have funny prefixes, so you should rename the exe file to the
# The difference between the `sep` and `collapse` arguments | |
# in paste can be thought of like this: | |
# | |
# paste can accept multiple *vectors* as input, and will | |
# concatenate the ith entries of each vector pairwise | |
# (or tuplewise), if it can. | |
# | |
# When you pass paste multiple vectors, sep defines what | |
# separates the entries in those tuple-wise concatenations. | |
# |
#' Calculate a dep_var for the iris dataset based on the iris dataset.
#'
#' @param by character. \code{length} to go by \code{Petal.Length} or \code{width} to go by \code{Petal.Width}.
iris_with_dep_var <- validations::ensure(pre = list(by %in% c("length", "width")),
function(by = "length") {
if (identical(by, "length")) {
plyr::ddply(iris, plyr::.(Species), summarize, dep_var = ifelse(any(Petal.Length >= 4), 1, 0))
} else {
plyr::ddply(iris, plyr::.(Species), summarize, dep_var = ifelse(any(Petal.Width >= 4), 1, 0))