Skip to content

Instantly share code, notes, and snippets.

David DeSandro desandro

View GitHub Profile
View fourCones.pde
// "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 Apr 9, 2019
Advice for new developers
View 👀.md

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 Apr 16, 2019
Enable SSL in Apache for 'localhost' (OSX, El Capitan)
View ApacheHTTPSConfig.md

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:

View imgloaded.js
/**
* 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 Aug 29, 2015
EO video looper
View video.html
<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;
View doTransition.js
/**
* 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 Nov 18, 2013
Quirk-proof promise for image loading using jQuery's Deferred and events interfaces. imagePromise( url ).then( function( img ){ /*...*/ } )
View imagePromise.js
// 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 Sep 14, 2013
Have a quadratic bezier curve, need to figure out an angle along the way. This should work quite well, easy to convert to JavaScript.
View Calculate Angle Along Quadratic Bezier
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 Mar 30, 2019
Full-Screen Layout using Flexbox
View index.html
<!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;
You can’t perform that action at this time.