Skip to content

Instantly share code, notes, and snippets.

View kensnyder's full-sized avatar

Ken Snyder kensnyder

View GitHub Profile
// Prototype object that works a lot like jQuery:
var NodeList = Class.create(Enumerable);
Object.extend(NodeList.prototype, {
initialize: function(selector) {
this.elements = $$(selector);
},
_each: function(iterator) {
this.elements.each(iterator);
return this;
}
// Prototype object that works a lot like jQuery:
var NodeList = Class.create(Enumerable);
Object.extend(NodeList.prototype, {
initialize: function(selector) {
this.elements = $$(selector);
},
_each: function(iterator) {
this.elements.each(iterator);
return this;
}
@kensnyder
kensnyder / output.php
Created April 23, 2014 15:38
Sending a file
<?php
function sendFile($path, $name, $mime) {
$fp = @fopen($path, 'rb');
if (!$fp) {
// error opening file; it may not exist or be readable
header("HTTP/1.0 404 Not Found");
exit(0);
}
$size = filesize($path);