Skip to content

Instantly share code, notes, and snippets.

View desandro's full-sized avatar

David DeSandro desandro

View GitHub Profile
@desandro
desandro / redirect.md
Last active December 18, 2015 10:39
masonry.desandro.com redirects

The problem: masonry.desandro.com is getting DoS by so many Tumblr themes and poorly coded sites that hot link directly to the script.

Possible solution: redirect requests to cdnjs.com assets

Hotlinked assets

masonry.desandro.com/jquery.masonry.min.js
masonry.desandro.com/jquery.masonry.js
masonry.desandro.com/js/jquery-1.7.1.min.js
@desandro
desandro / candy-box-cheats.js
Last active February 2, 2019 00:39
candy box cheats
// http://candies.aniwey.net/
// enter in console
candies.nbrOwned = Number.POSITIVE_INFINITY;
lollipops.nbrOwned = Number.POSITIVE_INFINITY;
quest.setMaxLandOrder( 20 );
chocolateBars.nbrOwned = 10;
sword.specialPower = 100;
for ( var potionName in potions.list ) {
@desandro
desandro / index.html
Created March 27, 2013 15:44
A CodePen by douglasdeodato. Single Element Pure CSS MacBook Pro - This is just an experiment! There are certainly better ways to show an image of a MacBook, but none as fun as this :)
<i class="macbook"></i>
@desandro
desandro / bower-logo.md
Last active December 30, 2021 23:11
Bower logo

In addition to awesome docs #228, Bower deserves a proper logo. See below for sketches. I'm curious if you think any of these are worth me putting more effort into.


Take a look at Yeoman right now.

Screen Shot 2013-02-19 at 4 43 10 PM

The other two entities have awesome logos. Bower's got to represent.

@desandro
desandro / bower.json
Last active January 12, 2022 21:08
jQuery UI Draggable
{
"name": "jquery-ui-draggable",
"version": "1.11.4",
"main": "jquery-ui-draggable.js"
}
Item.prototype._applyTransformPosition = function() {
// get possible translate position
if ( !transformProperty ) {
return;
}
var style = getStyle( this.element );
var transform = style[ transformProperty ];
if ( transform.indexOf('matrix') !== 0 ) {
return;
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>quad limit</title>
<style>
body {
@desandro
desandro / jquery-layout-review.md
Created January 28, 2013 18:13
layout thrashing in jQuery
@desandro
desandro / classie.js
Last active November 9, 2017 14:41
classie - class helper functions
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
*/
/*jshint browser: true, strict: true, undef: true */