Skip to content

Instantly share code, notes, and snippets.

@tmsss
tmsss / Update caniuse
Created February 28, 2020 11:13
Update caniuse #gulp #javascript #nodejs
npm update --depth 10 caniuse-lite browserslist
@tmsss
tmsss / .block
Last active October 14, 2021 05:35
Cognitive Bias Codex, 2016
height: 950
border: no
@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 / 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();
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 / page.tpl.php
Created February 6, 2016 16:48
Print a views block
<?php echo views_embed_view('view-machine-name', $display_id = 'view-id'); ?>
@tmsss
tmsss / delete node revisions.mysql
Created January 26, 2016 16:04
Delete node revisions from database
DELETE FROM `node_revisions` WHERE node_revisions.vid NOT IN (SELECT node.vid FROM `node` );
@tmsss
tmsss / drop_caps.css
Created November 27, 2015 10:26
Drop caps
p:first-letter{
display:block;
margin:5px 0 0 5px;
float:left;
color:#FF3366;
font-size:60px;
font-family:Georgia;
}
@tmsss
tmsss / box-sizing-prefixes.css
Last active November 25, 2015 22:32
Circular div with fontawesome icon inside
html {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
<?php
$menu = menu_navigation_links('menu-your-custom-menu-name');
print theme('links__menu_your_custom_menu_name', array('links' => $menu));
?>