Skip to content

Instantly share code, notes, and snippets.

View desandro's full-sized avatar

David DeSandro desandro

View GitHub Profile
@beesandbombs
beesandbombs / fourCones.pde
Created November 29, 2018 00:52
four cones
// "four cones" by dave :)
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
}
float ease(float p, float g) {
@notwaldorf
notwaldorf / 👀.md
Last active February 18, 2024 21:13
Advice for new developers

Someone sent me an email asking me what advice I had for new developers. I get this question a bunch, so I wanted to put all my thoughts in one place, that I can update as I get more ideas!

I answered this a bunch on my AMA repo, so here's some initial general answers, before I get to some of the specific questions:

@nrollr
nrollr / ApacheHTTPSConfig.md
Last active November 13, 2024 10:41
Enable SSL in Apache for 'localhost' (OSX, El Capitan)

Enable SSL in Apache (OSX)

The following will guide you through the process of enabling SSL on a Apache webserver

  • The instructions have been verified with OSX El Capitan (10.11.2) running Apache 2.4.16
  • The instructions assume you already have a basic Apache configuration enabled on OSX, if this is not the case feel free to consult Gist: "Enable Apache HTTP server (OSX)"

Apache SSL Configuration

Create a directory within /etc/apache2/ using Terminal.app: sudo mkdir /etc/apache2/ssl
Next, generate two host keys:

/**
* How to:
* $('div.container').imagesLoaded(function(){console.log('all images loaded in .container');});
* In case you need to support IE8, you need to use HTML5shiv **and** need to modify jQuery the following way:
* https://github.com/jquery/jquery/commit/a9533893b9e5e9a248139f5794c5d6099382cf14
*/
(function($){
'use strict';
$.fn.imagesLoaded = (function(){
var imageLoaded = function (img, cb, delay){
@jake
jake / video.html
Last active August 29, 2015 14:10
EO video looper
<html>
<head>
<title>video</title>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<style type="text/css">
body {
margin: 0;
padding: 0;
/**
* Transition helper that allows elements to transition from
* scalar sizes (e.g. "2em") to "auto" (or vice versa). This is useful because
* browsers either simply do not animate such transitions or do them poorly.
*
* Requires your CSS to already have the transition defined. This just allows
* it to function without much jankiness.
*
* Usage:
*
@barneycarroll
barneycarroll / imagePromise.js
Created November 18, 2013 14:56
Quirk-proof promise for image loading using jQuery's Deferred and events interfaces. imagePromise( url ).then( function( img ){ /*...*/ } )
// Create a Promise for loading an image!
// Basically taking out the useful, tricky, and heavily refined bit from
// http://desandro.github.io/imagesloaded/
function imagePromise( src ){
var deferred = $.Deferred();
var img = new Image();
function resolve(){
// Resolution callbacks receive the image, which you can then inject into the DOM
// to avoid triggering an extra HTTP request in IE
@choppingblock
choppingblock / Calculate Angle Along Quadratic Bezier
Created September 14, 2013 02:38
Have a quadratic bezier curve, need to figure out an angle along the way. This should work quite well, easy to convert to JavaScript.
public static function quadraticBezierAngle(value:Number, anchor1:Point, anchor2:Point, control:Point):Number {
var uc:Number = 1 - value;
var dx:Number = (uc * control.x + value * anchor2.x) - (uc * anchor1.x + value * control.x);
var dy:Number = (uc * control.y + value * anchor2.y) - (uc * anchor1.y + value * control.y);
return Math.atan2(dy, dx);
}
@jfsiii
jfsiii / index.html
Last active January 4, 2021 18:11
Full-Screen Layout using Flexbox
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;