Skip to content

Instantly share code, notes, and snippets.

@SciutoAlex
SciutoAlex / .block
Last active March 4, 2017 18:13
fresh block
license: mit
// This is a concept for integrating D3.js into p5.js. The idea is to modify
// D3 to accept p5.js commands to provide custom renderings on canvas. D3.js
// does not specialize in canvas manipulation, which is where p5.js excels.
// element definition will be executed once per D3 element. Probably using something like .call().
function elementDefinition(el, i, ctx) {
rect(el.w, el.h);
// p5js code goes here
}
@SciutoAlex
SciutoAlex / README.md
Created June 23, 2016 16:56
location-importance
@SciutoAlex
SciutoAlex / README.md
Created June 23, 2016 16:56
location-importance
@SciutoAlex
SciutoAlex / googleScript.js
Last active March 29, 2024 20:39
Archive Gmail Regularly
// Code modified from: http://www.johneday.com/422/time-based-gmail-filters-with-google-apps-script
// This is code for a Google Apps Script. You can add the code and give it permissions at script.google.com
// Archive every thread in your Inbox that is older than two days, and not starred.
function archiveInbox() {
var threads = GmailApp.search('label:inbox older_than:2d -in:starred');
for (var i = 0; i < threads.length; i++) {
threads[i].moveToArchive();
}
@SciutoAlex
SciutoAlex / README.md
Last active August 29, 2015 14:05
Dynamically adding geographic elements to a map

Sometimes you want to allow users or your program to dynamically add geographic features to a map graphic. In order to achieve this with D3, you can create geoJSON objects and then use D3 to project and draw the elements.

GeoJSON objects are specifically formatted JSON objects (see the full specification). When making even small maps, geoJSON objects become huge with featureCollections and geometryCollections, but in their simplest form, they look like:

var geoFeature = {
    "type":"Feature",
    "properties" : null,
    "geometry": {
        "type":"LineString",

"coordinates": [

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="css/styles.css?v=1.0">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
@SciutoAlex
SciutoAlex / soccer-agent-output.csv
Created June 1, 2014 23:23
Data-driven journalism web scraping
We can't make this file beautiful and searchable because it's too large.
country,lastName,firstName,address1,address2,address3,,email,phone1,phone2,phone3
alb,Ago,Alerti,Sportfront GBMH ,P Bora K2 A 5 21 Dhjetori,TIRANA ,,alerti.ago@bluewin.ch,Tel:+41-79/309 82 06,Fax:+41-71/558 3477 ,
alb,Ameti,Selami, ,Rr. R Collaku P Bora Sh a A 7,TIRANA ,,selami-ameti@hotmail.com,Tel:+355/696689320,,
alb,Arkaxhiu,Arben, ,"Rr. Mine Peza, 256/1",TIRANA ,,aarkaxhiu@hotmail.com,Tel:+355-665/738 661,Mobile:+355-692/050 042,
alb,Berisha,Fehmi,SSM-Sport ,Regeringsgatan 85,KARLSHAMN 374 36,,info@ssmsport.com,Tel:+46-762/248 228,Mobile:+377/44334096,
alb,Berisha,Shqiprim,Five Stars Sport & Entertainment GmbH ,Postfach 26,SCHENKON 6214,,info@5stars-sports.ch,Tel:+41/419204402,Fax:+41/419204401 ,
alb,Bode,Alfred, ,"Rr. Q. Guranjaku, L.1, P.4, Shk. 3, Ap. 4",TIRANA ,,algabo60@yahoo.com,Tel:+389-70/918 106,Mobile:+355-69/406 99 71,
alb,Cana,Agim, ,L. 5 Rr. Irfan Tomini,TIRANA 58,,agim.cana@orange.fr,Mobile:+33/62 37 55 185,,
alb,Canollari,Ervin, ,"Lima Kaba Nd. 38 Ap.5, K.Postare 10/19",TIRANA ,,ervincanol
@SciutoAlex
SciutoAlex / index.php
Created October 8, 2013 17:38
Add this page to any folder, and it'll pull the latest modified image and add it as a CSS background image. Great for quickly previewing web designs. Also great for sharing designs that clients can see right in the browser. Automatically centers the image, but you could tweak the CSS for align-left or align-right webpages.
<?php
$path = ".";
$latest_ctime = 0;
$latest_filename = '';
$d = dir($path);
while (false !== ($entry = $d->read())) {
$filepath = "{$path}/{$entry}";
@SciutoAlex
SciutoAlex / data.json
Last active December 22, 2015 17:09
Data Visualization experiment showing profits and employment over time. US Data.
[{
"industry": "Domestic",
"earnings": [570.1, 591.6, 561.5, 481, 554.5, 591.8, 605.2, 668.1, 688.8, 694.5, 740, 782.4, 907.3, 974, 1030.8, 1048.4, 1308.7, 1340.2, 1360, 1471.1, 1535, 1516.1, 1571.8, 1488.6, 1400.3, 1436.2, 1312.2, 1212.4, 994.1, 978.3, 963.7, 699.5, 958.4, 1021.4, 1136.2, 1247.4, 1369.3, 1332.7, 1420.2, 1382.2, 1258.8, 1328.4, 1351, 1472.5],
"employment": [104283, 104309, 102719, 102147, 103318, 105572, 107780, 108947, 108027, 101374, 100594, 102387]
},
{
"industry": "Manufacturing",
"earnings": [17.1, 15.7, 17.2, 14.9, 16.6, 19.3, 22.8, 25.3, 24.3, 24.7, 24.9, 24.7, 23, 20.8, 20.2, 22.8, 24.5, 23.5, 22.8, 17.1, 19.2, 19.7, 19.4, 21.5, 24.5, 25.9, 26.4, 27.4, 25.8, 25, 23.3, 24.9, 26.2, 25, 24, 21.3, 17.2, 17.4, 19.8, 23.5, 26.4, 30.1, 25.4, 24.3, 27.8, 23.8, 23.1, 20.6, 19.3, 23, 24.7, 26.7, 26.2, 25.4, 26, 27.8, 27.4, 29.8, 30.6, 31, 32.5, 32.2, 32.9, 32.6, 38.6, 39, 39.7, 42, 44.4, 43, 41.4, 41.7, 39.7, 38.6, 38.1, 40.5, 40, 42.4, 41.7, 43.3, 41.7, 38.2, 36.4, 32.9, 26.7, 30.6,