Skip to content

Instantly share code, notes, and snippets.

View ascott's full-sized avatar
✌️
👌 🌊 ☕️

Alanna Scott ascott

✌️
👌 🌊 ☕️
View GitHub Profile
@ascott
ascott / wp_is_user_admin.php
Created June 17, 2011 02:37
wordpress - add a class to an element if user is admin
<?php
get_currentuserinfo(); 
//add_users is a capability only admins have - http://codex.wordpress.org/Roles_and_Capabilities#Administrator
if (!current_user_can( 'add_users' )) {
//set admin class
$adminclass = 'is_admin';
}
else {
$adminclass = '';
@ascott
ascott / exportjson.js
Created February 29, 2012 04:41 — forked from pamelafox/exportjson.js
Google Spreadsheet JSON Export
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
function exportAllSheets() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheets = ss.getSheets();
var sheetsData = {};
for (var i = 0; i < sheets.length; i++) {
var sheet = sheets[i];
var rowsData = getRowsData_(sheet);
@ascott
ascott / percentage-female.rb
Last active February 8, 2017 23:14
percentage of female artists at the Tate Modern.
# tate-modern-artists.csv can be retrieved here:
# https://raw.githubusercontent.com/tategallery/collection/master/artist_data.csv
require('CSV')
male = 0
female = 0
CSV.foreach("tate-modern-artists.csv") do |row|
if row[2] == "Male"
male = male + 1
@ascott
ascott / reps-scraped-072316.json
Last active July 24, 2016 06:32
scrape-us-rep-data.js
{
"reps":[
{
"district":"1",
"name":"Byrne, Bradley",
"url":"https://byrne.house.gov/",
"party":"R",
"phone":"202-225-4931",
"committees":"Armed Services\nEducation and the Workforce\nRules"
},
@ascott
ascott / README.md
Last active September 27, 2016 04:35 — forked from syntagmatic/README.md
Hypersolids as PNG's
@ascott
ascott / .block
Created September 28, 2016 00:12 — forked from mbostock/.block
Population Pyramid
license: gpl-3.0
@ascott
ascott / README.md
Created September 28, 2016 01:36 — forked from sxywu/README.md
The Force with React + D3, Approach #3

React + D3 exploration with the force layout:

  • React for structure
  • D3 for data calculation
  • D3 for rendering

Pro:

  • The viz scales!
  • Use all the d3 functions!

Con:

@ascott
ascott / source.txt
Created February 2, 2017 03:40
US Senator Twitter Accounts, 115th Congress
source: http://www.socialseer.com/resources/us-senator-twitter-accounts/
@ascott
ascott / twitter_list_members_scraper.js
Created February 2, 2017 06:08
scrape twitter.com/{account}/lists/{list_name}/members
//https://twitter.com/tweetcongress/lists/congress/members
//https://twitter.com/cspan/lists/members-of-congress/members
var $rows = $('.js-profile-popup-actionable');
var csv = 'name,twitterHandle,twitterUrl\n';
$rows.each(function(i) {
var $el = $($rows[i]);
var name = $el.attr('data-name');
var twitterHandle = $el.attr('data-screen-name');
var twitterUrl = 'http://twitter.com/' + twitterHandle;
@ascott
ascott / art-apis-open-data.txt
Created February 8, 2017 23:05
Museum/Gallery APIs / Open Data
http://museum-api.pbworks.com/w/page/21933420/Museum%C2%A0APIs
http://americanart.si.edu/collections/search/lod/about/
https://datahub.io/dataset?tags=museum
http://blog.variousbits.net/2009/04/16/the-brooklyn-museum-api-qa-with-shelley-bernstein-and-paul-beaudoin/
https://medium.com/@andrea_ledesma/how-we-learned-to-stop-worrying-and-love-open-data-a-case-study-in-the-harvard-art-museums-api-893c3f40ecb7#.hthquwry8
http://labs.cooperhewitt.org/2014/the-api-at-the-center-of-the-museum/
https://github.com/WaltersArtMuseum/walters-api
http://mw2015.museumsandtheweb.com/paper/art-data-building-the-sfmoma-collection-api/
http://data.culturehack.org.uk/
https://www.brooklynmuseum.org/opencollection/api/