Skip to content

Instantly share code, notes, and snippets.

View benbyford's full-sized avatar
💭
looking for AI and ethics work

ben byford benbyford

💭
looking for AI and ethics work
View GitHub Profile
@benbyford
benbyford / Airtable copy rows to a new table
Created August 6, 2020 13:03
Airtable copy rows to a new table when match
let table = base.getTable("References");
// get field names
const fieldName = "Name";
const field = table.getField(fieldName);
// copy to new table field options
const mustField = field.options.choices[0].id; // first tiem
const refField = field.options.choices[1].id; // second item
@benbyford
benbyford / web-servers.md
Created April 29, 2020 16:29 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@benbyford
benbyford / iCalendar php
Created April 16, 2020 12:49
one event example of iCalendar implementation in PHP
<?php
function escapeString($string) {
return preg_replace('/([\,;])/','\\\$1', $string);
}
function dateToCal($timestamp) {
return date('Ymd', $timestamp) .'T'. date('His', $timestamp) . "Z";
}
$eol = "\r\n";
@benbyford
benbyford / calendar.php
Last active June 1, 2017 12:50
php calendar
/* originally: https://davidwalsh.name/php-calendar */
/* draws a calendar */
function draw_calendar($month,$year){
/* draw table */
$calendar = '<table cellpadding="0" cellspacing="0" class="calendar">';
/* table headings */
$headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$calendar.= '<tr class="calendar-row"><td class="calendar-day-head">'.implode('</td><td class="calendar-day-head">',$headings).'</td></tr>';
@benbyford
benbyford / scrollToTop
Created May 8, 2013 16:15
scroll to top - jquery
$('#top').click(function() {
var i = window.scrollY;
function scrollToTop() {
if(i > 0){
i = i - 10;
window.scrollTo(0, i);
setTimeout(scrollToTop, 10);
}
}
scrollToTop();
javascript:(function(){alert('Click ok. You may now save your Container as an image by clicking cmd+shift+3, I will be collating all the screenshots into a site archive after the exhibit');var regEx=/./g;var tagArray=new Array();var mediaArray=new Array();function makeBlanktext(tag){tagArray=document.getElementsByTagName(tag);for(var textNum=0,num=tagArray.length;textNum<num;textNum++){if(true){var str=tagArray[textNum].innerHTML.replace(regEx,'&nbsp;');document.getElementsByTagName(tag)[textNum].innerHTML=(str)}}};var tags=new Array('p','a','h1','h2','h3','h4','h5','cite','blockquote','span','em','li','font','div','b','i','code','strong','s','td','textarea','dl','dd');for(var element=0,tagsNum=tags.length;element<tagsNum;element++){makeBlanktext(tags[element])};function makeBlankMedia(mediaTag){mediaArray=document.getElementsByTagName(mediaTag);for(var img=0,num=mediaArray.length;img<num;img++){var mediaWidth=mediaArray[img].width;var mediaHeight=mediaArray[img].height;document.getElementsByTagName(mediaTag)