View gtk4_custom_draw_example_with_stylus.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example adds handling stylus input to the Custom Drawing example | |
// from the GTK4 Getting Started. | |
// See: https://docs.gtk.org/gtk4/getting_started.html#custom-drawing | |
#include <gtk/gtk.h> | |
/* Surface to store current scribbles */ |
View jaro.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstring> | |
#include <cstdlib> | |
#include <R.h> | |
#include <Rdefines.h> | |
double jaro(const char* a, const char* b, double range = 0.5, double match_weight = 1.0, | |
double trans_weight = 1.0) { | |
unsigned int la = strlen(a); | |
unsigned int lb = strlen(b); | |
// create a buffers; these store for each character in a and b which have |
View Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
config.vm.box = "ubuntu-14.04" | |
config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" |
View one_to_one.R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(lpSolve) | |
pairs_select <- function(x, y, w, n = 1, m = 1) { | |
d <- data.frame(x=as.numeric(as.factor(x)), y=as.numeric(as.factor(y)), w=w) | |
nx <- length(unique(d$x)) | |
ny <- length(unique(d$y)) | |
C <- cbind(c(d$x, d$y + nx), seq_len(nrow(d))) | |
C <- cbind(C, 1) | |
res <- lp("max", d$w, dense.const = C, const.dir = rep("<=", nx+ny), | |
const.rhs = c(rep(n, nx), rep(m, ny)), all.bin=TRUE, use.rw=TRUE) |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
</head> | |
<body> | |
<div id="vis"> | |
</div> |
View index.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<script src="http://d3js.org/d3.v3.min.js"></script> | |
<style> | |
.orbit { | |
stroke : #000000; |