Skip to content

Instantly share code, notes, and snippets.

@uribo
Created June 6, 2014 12:47
Show Gist options
  • Save uribo/2b02830e809c91879578 to your computer and use it in GitHub Desktop.
Save uribo/2b02830e809c91879578 to your computer and use it in GitHub Desktop.
cal-heatmapモジュールで利用するjsonファイルの取得
[["2013/06/06",0],["2013/06/07",0],["2013/06/08",0],["2013/06/09",0],["2013/06/10",0],["2013/06/11",0],["2013/06/12",0],["2013/06/13",0],["2013/06/14",0],["2013/06/15",0],["2013/06/16",0],["2013/06/17",0],["2013/06/18",0],["2013/06/19",0],["2013/06/20",0],["2013/06/21",0],["2013/06/22",0],["2013/06/23",0],["2013/06/24",0],["2013/06/25",0],["2013/06/26",0],["2013/06/27",0],["2013/06/28",0],["2013/06/29",0],["2013/06/30",0],["2013/07/01",0],["2013/07/02",2],["2013/07/03",1],["2013/07/04",0],["2013/07/05",0],["2013/07/06",0],["2013/07/07",0],["2013/07/08",0],["2013/07/09",0],["2013/07/10",0],["2013/07/11",0],["2013/07/12",0],["2013/07/13",0],["2013/07/14",0],["2013/07/15",0],["2013/07/16",0],["2013/07/17",0],["2013/07/18",0],["2013/07/19",0],["2013/07/20",0],["2013/07/21",0],["2013/07/22",0],["2013/07/23",0],["2013/07/24",0],["2013/07/25",0],["2013/07/26",0],["2013/07/27",0],["2013/07/28",0],["2013/07/29",0],["2013/07/30",0],["2013/07/31",0],["2013/08/01",0],["2013/08/02",0],["2013/08/03",0],["2013/08/04",0],["2013/08/05",0],["2013/08/06",0],["2013/08/07",0],["2013/08/08",0],["2013/08/09",0],["2013/08/10",0],["2013/08/11",0],["2013/08/12",0],["2013/08/13",0],["2013/08/14",0],["2013/08/15",0],["2013/08/16",0],["2013/08/17",0],["2013/08/18",0],["2013/08/19",0],["2013/08/20",0],["2013/08/21",0],["2013/08/22",0],["2013/08/23",0],["2013/08/24",0],["2013/08/25",0],["2013/08/26",0],["2013/08/27",0],["2013/08/28",0],["2013/08/29",0],["2013/08/30",0],["2013/08/31",0],["2013/09/01",0],["2013/09/02",0],["2013/09/03",0],["2013/09/04",0],["2013/09/05",0],["2013/09/06",0],["2013/09/07",0],["2013/09/08",0],["2013/09/09",0],["2013/09/10",0],["2013/09/11",0],["2013/09/12",0],["2013/09/13",0],["2013/09/14",0],["2013/09/15",0],["2013/09/16",0],["2013/09/17",0],["2013/09/18",0],["2013/09/19",0],["2013/09/20",0],["2013/09/21",0],["2013/09/22",0],["2013/09/23",0],["2013/09/24",0],["2013/09/25",0],["2013/09/26",0],["2013/09/27",0],["2013/09/28",0],["2013/09/29",0],["2013/09/30",0],["2013/10/01",0],["2013/10/02",0],["2013/10/03",0],["2013/10/04",0],["2013/10/05",0],["2013/10/06",0],["2013/10/07",0],["2013/10/08",0],["2013/10/09",0],["2013/10/10",0],["2013/10/11",0],["2013/10/12",0],["2013/10/13",0],["2013/10/14",0],["2013/10/15",0],["2013/10/16",0],["2013/10/17",0],["2013/10/18",0],["2013/10/19",0],["2013/10/20",0],["2013/10/21",0],["2013/10/22",0],["2013/10/23",0],["2013/10/24",0],["2013/10/25",0],["2013/10/26",0],["2013/10/27",0],["2013/10/28",0],["2013/10/29",0],["2013/10/30",0],["2013/10/31",0],["2013/11/01",0],["2013/11/02",0],["2013/11/03",0],["2013/11/04",0],["2013/11/05",0],["2013/11/06",0],["2013/11/07",0],["2013/11/08",0],["2013/11/09",0],["2013/11/10",0],["2013/11/11",0],["2013/11/12",2],["2013/11/13",0],["2013/11/14",0],["2013/11/15",0],["2013/11/16",0],["2013/11/17",0],["2013/11/18",0],["2013/11/19",0],["2013/11/20",0],["2013/11/21",0],["2013/11/22",5],["2013/11/23",0],["2013/11/24",0],["2013/11/25",2],["2013/11/26",0],["2013/11/27",0],["2013/11/28",2],["2013/11/29",0],["2013/11/30",0],["2013/12/01",0],["2013/12/02",1],["2013/12/03",0],["2013/12/04",0],["2013/12/05",1],["2013/12/06",0],["2013/12/07",0],["2013/12/08",3],["2013/12/09",2],["2013/12/10",2],["2013/12/11",0],["2013/12/12",0],["2013/12/13",1],["2013/12/14",1],["2013/12/15",1],["2013/12/16",2],["2013/12/17",1],["2013/12/18",0],["2013/12/19",0],["2013/12/20",2],["2013/12/21",6],["2013/12/22",0],["2013/12/23",0],["2013/12/24",0],["2013/12/25",0],["2013/12/26",2],["2013/12/27",0],["2013/12/28",0],["2013/12/29",0],["2013/12/30",0],["2013/12/31",0],["2014/01/01",0],["2014/01/02",0],["2014/01/03",0],["2014/01/04",0],["2014/01/05",0],["2014/01/06",0],["2014/01/07",0],["2014/01/08",0],["2014/01/09",0],["2014/01/10",0],["2014/01/11",0],["2014/01/12",0],["2014/01/13",0],["2014/01/14",0],["2014/01/15",0],["2014/01/16",0],["2014/01/17",0],["2014/01/18",0],["2014/01/19",0],["2014/01/20",0],["2014/01/21",0],["2014/01/22",0],["2014/01/23",0],["2014/01/24",0],["2014/01/25",0],["2014/01/26",0],["2014/01/27",0],["2014/01/28",0],["2014/01/29",0],["2014/01/30",0],["2014/01/31",0],["2014/02/01",0],["2014/02/02",0],["2014/02/03",0],["2014/02/04",0],["2014/02/05",2],["2014/02/06",0],["2014/02/07",0],["2014/02/08",0],["2014/02/09",0],["2014/02/10",0],["2014/02/11",0],["2014/02/12",0],["2014/02/13",0],["2014/02/14",3],["2014/02/15",0],["2014/02/16",0],["2014/02/17",3],["2014/02/18",2],["2014/02/19",0],["2014/02/20",0],["2014/02/21",0],["2014/02/22",0],["2014/02/23",0],["2014/02/24",0],["2014/02/25",0],["2014/02/26",0],["2014/02/27",0],["2014/02/28",0],["2014/03/01",0],["2014/03/02",0],["2014/03/03",0],["2014/03/04",0],["2014/03/05",0],["2014/03/06",1],["2014/03/07",1],["2014/03/08",0],["2014/03/09",0],["2014/03/10",0],["2014/03/11",0],["2014/03/12",0],["2014/03/13",0],["2014/03/14",0],["2014/03/15",0],["2014/03/16",0],["2014/03/17",0],["2014/03/18",0],["2014/03/19",0],["2014/03/20",0],["2014/03/21",0],["2014/03/22",0],["2014/03/23",0],["2014/03/24",0],["2014/03/25",0],["2014/03/26",0],["2014/03/27",0],["2014/03/28",0],["2014/03/29",0],["2014/03/30",0],["2014/03/31",0],["2014/04/01",0],["2014/04/02",0],["2014/04/03",0],["2014/04/04",0],["2014/04/05",0],["2014/04/06",0],["2014/04/07",0],["2014/04/08",0],["2014/04/09",0],["2014/04/10",0],["2014/04/11",0],["2014/04/12",0],["2014/04/13",0],["2014/04/14",0],["2014/04/15",0],["2014/04/16",0],["2014/04/17",0],["2014/04/18",0],["2014/04/19",0],["2014/04/20",0],["2014/04/21",0],["2014/04/22",0],["2014/04/23",0],["2014/04/24",0],["2014/04/25",0],["2014/04/26",0],["2014/04/27",0],["2014/04/28",0],["2014/04/29",0],["2014/04/30",7],["2014/05/01",0],["2014/05/02",2],["2014/05/03",1],["2014/05/04",7],["2014/05/05",1],["2014/05/06",8],["2014/05/07",3],["2014/05/08",8],["2014/05/09",5],["2014/05/10",4],["2014/05/11",5],["2014/05/12",4],["2014/05/13",0],["2014/05/14",0],["2014/05/15",0],["2014/05/16",3],["2014/05/17",4],["2014/05/18",1],["2014/05/19",1],["2014/05/20",3],["2014/05/21",4],["2014/05/22",1],["2014/05/23",0],["2014/05/24",0],["2014/05/25",0],["2014/05/26",0],["2014/05/27",0],["2014/05/28",2],["2014/05/29",8],["2014/05/30",6],["2014/05/31",1],["2014/06/01",6],["2014/06/02",0],["2014/06/03",14],["2014/06/04",1],["2014/06/05",3],["2014/06/06",4]]
library(jsonlite)
library(httr)
data1 <- fromJSON("https://github.com/users/uribo/contributions_calendar_data")
colnames(data1) <- c("Date", "Value")
data2 <- transform(data1, Date = as.numeric(as.POSIXct(Date)))
myjson <- toJSON(data2, pretty=TRUE)
cat(myjson)
write(myjson, "myjson.json")
{
"1370444400":0,
"1370530800":0,
"1370617200":0,
"1370703600":0,
"1370790000":0,
"1370876400":0,
"1370962800":0,
"1371049200":0,
"1371135600":0,
"1371222000":0,
"1371308400":0,
"1371394800":0,
"1371481200":0,
"1371567600":0,
"1371654000":0,
"1371740400":0,
"1371826800":0,
"1371913200":0,
"1371999600":0,
"1372086000":0,
"1372172400":0,
"1372258800":0,
"1372345200":0,
"1372431600":0,
"1372518000":0,
"1372604400":0,
"1372690800":2,
"1372777200":1,
"1372863600":0,
"1372950000":0,
"1373036400":0,
"1373122800":0,
"1373209200":0,
"1373295600":0,
"1373382000":0,
"1373468400":0,
"1373554800":0,
"1373641200":0,
"1373727600":0,
"1373814000":0,
"1373900400":0,
"1373986800":0,
"1374073200":0,
"1374159600":0,
"1374246000":0,
"1374332400":0,
"1374418800":0,
"1374505200":0,
"1374591600":0,
"1374678000":0,
"1374764400":0,
"1374850800":0,
"1374937200":0,
"1375023600":0,
"1375110000":0,
"1375196400":0,
"1375282800":0,
"1375369200":0,
"1375455600":0,
"1375542000":0,
"1375628400":0,
"1375714800":0,
"1375801200":0,
"1375887600":0,
"1375974000":0,
"1376060400":0,
"1376146800":0,
"1376233200":0,
"1376319600":0,
"1376406000":0,
"1376492400":0,
"1376578800":0,
"1376665200":0,
"1376751600":0,
"1376838000":0,
"1376924400":0,
"1377010800":0,
"1377097200":0,
"1377183600":0,
"1377270000":0,
"1377356400":0,
"1377442800":0,
"1377529200":0,
"1377615600":0,
"1377702000":0,
"1377788400":0,
"1377874800":0,
"1377961200":0,
"1378047600":0,
"1378134000":0,
"1378220400":0,
"1378306800":0,
"1378393200":0,
"1378479600":0,
"1378566000":0,
"1378652400":0,
"1378738800":0,
"1378825200":0,
"1378911600":0,
"1378998000":0,
"1379084400":0,
"1379170800":0,
"1379257200":0,
"1379343600":0,
"1379430000":0,
"1379516400":0,
"1379602800":0,
"1379689200":0,
"1379775600":0,
"1379862000":0,
"1379948400":0,
"1380034800":0,
"1380121200":0,
"1380207600":0,
"1380294000":0,
"1380380400":0,
"1380466800":0,
"1380553200":0,
"1380639600":0,
"1380726000":0,
"1380812400":0,
"1380898800":0,
"1380985200":0,
"1381071600":0,
"1381158000":0,
"1381244400":0,
"1381330800":0,
"1381417200":0,
"1381503600":0,
"1381590000":0,
"1381676400":0,
"1381762800":0,
"1381849200":0,
"1381935600":0,
"1382022000":0,
"1382108400":0,
"1382194800":0,
"1382281200":0,
"1382367600":0,
"1382454000":0,
"1382540400":0,
"1382626800":0,
"1382713200":0,
"1382799600":0,
"1382886000":0,
"1382972400":0,
"1383058800":0,
"1383145200":0,
"1383231600":0,
"1383318000":0,
"1383404400":0,
"1383490800":0,
"1383577200":0,
"1383663600":0,
"1383750000":0,
"1383836400":0,
"1383922800":0,
"1384009200":0,
"1384095600":0,
"1384182000":2,
"1384268400":0,
"1384354800":0,
"1384441200":0,
"1384527600":0,
"1384614000":0,
"1384700400":0,
"1384786800":0,
"1384873200":0,
"1384959600":0,
"1385046000":5,
"1385132400":0,
"1385218800":0,
"1385305200":2,
"1385391600":0,
"1385478000":0,
"1385564400":2,
"1385650800":0,
"1385737200":0,
"1385823600":0,
"1385910000":1,
"1385996400":0,
"1386082800":0,
"1386169200":1,
"1386255600":0,
"1386342000":0,
"1386428400":3,
"1386514800":2,
"1386601200":2,
"1386687600":0,
"1386774000":0,
"1386860400":1,
"1386946800":1,
"1387033200":1,
"1387119600":2,
"1387206000":1,
"1387292400":0,
"1387378800":0,
"1387465200":2,
"1387551600":6,
"1387638000":0,
"1387724400":0,
"1387810800":0,
"1387897200":0,
"1387983600":2,
"1388070000":0,
"1388156400":0,
"1388242800":0,
"1388329200":0,
"1388415600":0,
"1388502000":0,
"1388588400":0,
"1388674800":0,
"1388761200":0,
"1388847600":0,
"1388934000":0,
"1389020400":0,
"1389106800":0,
"1389193200":0,
"1389279600":0,
"1389366000":0,
"1389452400":0,
"1389538800":0,
"1389625200":0,
"1389711600":0,
"1389798000":0,
"1389884400":0,
"1389970800":0,
"1390057200":0,
"1390143600":0,
"1390230000":0,
"1390316400":0,
"1390402800":0,
"1390489200":0,
"1390575600":0,
"1390662000":0,
"1390748400":0,
"1390834800":0,
"1390921200":0,
"1391007600":0,
"1391094000":0,
"1391180400":0,
"1391266800":0,
"1391353200":0,
"1391439600":0,
"1391526000":2,
"1391612400":0,
"1391698800":0,
"1391785200":0,
"1391871600":0,
"1391958000":0,
"1392044400":0,
"1392130800":0,
"1392217200":0,
"1392303600":3,
"1392390000":0,
"1392476400":0,
"1392562800":3,
"1392649200":2,
"1392735600":0,
"1392822000":0,
"1392908400":0,
"1392994800":0,
"1393081200":0,
"1393167600":0,
"1393254000":0,
"1393340400":0,
"1393426800":0,
"1393513200":0,
"1393599600":0,
"1393686000":0,
"1393772400":0,
"1393858800":0,
"1393945200":0,
"1394031600":1,
"1394118000":1,
"1394204400":0,
"1394290800":0,
"1394377200":0,
"1394463600":0,
"1394550000":0,
"1394636400":0,
"1394722800":0,
"1394809200":0,
"1394895600":0,
"1394982000":0,
"1395068400":0,
"1395154800":0,
"1395241200":0,
"1395327600":0,
"1395414000":0,
"1395500400":0,
"1395586800":0,
"1395673200":0,
"1395759600":0,
"1395846000":0,
"1395932400":0,
"1396018800":0,
"1396105200":0,
"1396191600":0,
"1396278000":0,
"1396364400":0,
"1396450800":0,
"1396537200":0,
"1396623600":0,
"1396710000":0,
"1396796400":0,
"1396882800":0,
"1396969200":0,
"1397055600":0,
"1397142000":0,
"1397228400":0,
"1397314800":0,
"1397401200":0,
"1397487600":0,
"1397574000":0,
"1397660400":0,
"1397746800":0,
"1397833200":0,
"1397919600":0,
"1398006000":0,
"1398092400":0,
"1398178800":0,
"1398265200":0,
"1398351600":0,
"1398438000":0,
"1398524400":0,
"1398610800":0,
"1398697200":0,
"1398783600":7,
"1398870000":0,
"1398956400":2,
"1399042800":1,
"1399129200":2,
"1399215600":0,
"1399302000":2,
"1399388400":3,
"1399474800":4,
"1399561200":3,
"1399647600":2,
"1399734000":1,
"1399820400":0,
"1399906800":0,
"1399993200":0,
"1400079600":0,
"1400166000":2,
"1400252400":3,
"1400338800":0,
"1400425200":0,
"1400511600":0,
"1400598000":2,
"1400684400":1,
"1400770800":0,
"1400857200":0,
"1400943600":0,
"1401030000":0,
"1401116400":0,
"1401202800":0,
"1401289200":0,
"1401375600":5,
"1401462000":1,
"1401548400":6,
"1401634800":0,
"1401721200":4,
"1401807600":0,
"1401894000":3,
"1401980400":4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment