Skip to content

Instantly share code, notes, and snippets.

View machine.js
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
View gist:79b5e8535f7e189ae3cc9569161d1ea9
const slides = [
{
image:
' https://s3.amazonaws.com/peloton-ride-images/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3/img_1530025103442.jpg',
title: 'Basics',
},
{
image:
'https://s3.amazonaws.com/peloton-ride-images/a94a8fe5ccb19ba61c4c0873d391e987982fbbd3/img_1531254937082.jpg',
title: 'Essentials Package',
@amycheng
amycheng / script.js
Created Jan 16, 2019
Get instagram images by tag
View script.js
const fs = require('fs'),
puppeteer = require('puppeteer'),
tag = 'sushi';
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
let sharedData, images;
await page.goto(`https://www.instagram.com/explore/tags/${tag}`);
@amycheng
amycheng / shellcommands.sh
Last active Jan 1, 2016
Useful Shell commands because I always have to google them!
View shellcommands.sh
# copy folders from remote to local
# use '/' for absolute directories
scp -r /path/to/source /path/to/destination
scp -r source login@address:/destination
# delete folder and files within that folder
rm -rf -- <dir-to-remove>
@amycheng
amycheng / form-validation.js
Created Oct 18, 2013
A jQuery plugin for form validation. Use for e-mail, message text fields, as well as check boxes and radio buttons.
View form-validation.js
/*General Purpose Form Validation*/
(function($) {
$.fn.validateForm = function() {
var $form = $(this),
$submit = $form.find('button[type="submit"]'),
$messages = $('.form-messages[data-target="'+$form.attr('id')+'"]'),
successMessage = $form.attr('data-message'),
$requiredFields = $form.find('[data-required="true"]'),
@amycheng
amycheng / analysis of BOX.md
Last active Dec 23, 2015
a guess at how the BOX performance works
View analysis of BOX.md

A quick and dirty technology dissection of BOX

The installation/performance in question: http://www.botndolly.com/box .

Bot and Dolly (the firm behind this performance/installation) will will apparently release a post-mortem at some point but here's a quick dissection of the tech.

A big part of this performance is video/projection mapping (mapping animations and graphics to physical objects that aren't necessarily a screen).

MadMapper (http://www.madmapper.com/) seems to be the app of choice to getting started with projection mapping really quickly is (it's expensive tho).

@amycheng
amycheng / inView
Created Aug 22, 2013
a javascript function to check if a html element is in view
View inView
function inView(el){
//check if a DOM element is in view
var scrollDistance=document.body.scrollTop;
if (scrollDistance>=el.offsetTop&&scrollDistance<el.offsetHeight+el.offsetTop) {
return true;
}else{
return false;
}
}
@amycheng
amycheng / cookie.js
Created May 10, 2013
methods for creating/reading/erasing cookies via JS
View cookie.js
@amycheng
amycheng / transitionEnd.js
Created Apr 30, 2013
a simple jQuery plugin for creating callbacks for CSS3 transitions
View transitionEnd.js
$.fn.transitionEnd = function(callback) {
//plugin for detecting the end of a transition and then doing a callback
$(this).one('webkitTransitionEnd otransitionend msTransitionEnd transitionend',
function(e) {
if (typeof callback == 'function') {
callback.call(this);
}
});
};
@amycheng
amycheng / placeholderfallback
Created Jan 29, 2013
polyfill for placeholder
View placeholderfallback
$(function() {
function isPlaceholderSupported() {
var input = document.createElement("input");
return ('placeholder' in input);
}
var placeholdersupport = isPlaceholderSupported();
if (placeholdersupport == false) {
// If there is no placeholder support,