Skip to content

Instantly share code, notes, and snippets.

import numpy as np
# Assume that we have a dataframe df which is an adjacency matrix
def find_edges(df):
"""Finds the edges in the square adjacency matrix, using
vectorized operations. Returns a list of pairs of tuples
that represent the edges."""
values = df.values # Adjacency matrix of 0's and 1's
n_rows, n_columns = values.shape
@tmsss
tmsss / send_email.js
Last active June 7, 2017 13:23
Send E-mail uppon submission of Google Form (insert script in the form's spreadsheet)
function sendFormByEmail(e)
{
// Remember to replace this email address with your own email address
var email = "email@domain.##";
var s = SpreadsheetApp.getActiveSheet();
var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];
var htmlBody = '';
var name = e.namedValues[headers[1]].toString();
var replyTo = e.namedValues[headers[2]].toString();
@tmsss
tmsss / d3_wrap_text.js
Created May 29, 2019 13:10
Wrapping Text in D3
// from https://stackoverflow.com/questions/24784302/wrapping-text-in-d3?lq=1
var wrap = function(text, width) {
text.each(function() {
var text = d3.select(this),
words = text
.text()
.split(/\s+/)
.reverse(),
word,
line = [],
@tmsss
tmsss / .block
Last active October 14, 2021 05:35
Cognitive Bias Codex, 2016
height: 950
border: no
@tmsss
tmsss / Update caniuse
Created February 28, 2020 11:13
Update caniuse #gulp #javascript #nodejs
npm update --depth 10 caniuse-lite browserslist