Skip to content

Instantly share code, notes, and snippets.

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 Aug 6, 2020
Airtable copy rows to a new table when match
View Airtable copy rows to a new table
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 Apr 29, 2020 — forked from willurd/web-servers.md
Big list of http static server one-liners
View web-servers.md

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 Apr 16, 2020
one event example of iCalendar implementation in PHP
View iCalendar 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";
View calendar.php
/* 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
scroll to top - jquery
View scrollToTop
$('#top').click(function() {
var i = window.scrollY;
function scrollToTop() {
if(i > 0){
i = i - 10;
window.scrollTo(0, i);
setTimeout(scrollToTop, 10);
}
}
scrollToTop();
View containers_bookmarklet.js
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)
You can’t perform that action at this time.