Skip to content

Instantly share code, notes, and snippets.

@james2doyle
james2doyle / jquery.getStylesheet.js
Created February 3, 2016 21:05
An implementation of $.getScript but for stylesheets. Call it $.getStylesheet
(function($) {
$.getStylesheet = function (href) {
var $d = $.Deferred();
var $link = $('<link/>', {
rel: 'stylesheet',
type: 'text/css',
href: href
}).appendTo('head');
$d.resolve($link);
return $d.promise();
@transitive-bullshit
transitive-bullshit / image-service.js
Last active November 12, 2021 12:22
Angular service to resize images with antialiasing for use with canvas.
angular.module('demo').service('imageService', function ($http, $q, $timeout) {
var NUM_LOBES = 3
var lanczos = lanczosGenerator(NUM_LOBES)
// resize via lanczos-sinc convolution
this.resize = function (img, width, height) {
var self = { }
self.type = "image/png"
self.quality = 1.0
@ranacseruet
ranacseruet / VideoStream.php
Last active May 26, 2024 20:40
PHP VideoStream class for HTML5 video streaming
<?php
/**
* Description of VideoStream
*
* @author Rana
* @link http://codesamplez.com/programming/php-html5-video-streaming-tutorial
*/
class VideoStream
{
private $path = "";
@adamjimenez
adamjimenez / gist:5917897
Created July 3, 2013 13:36
Generate thumbnails from video files using HTML5's video tag and canvas
<?php
//where you want your thumbnails to go
$thumbs_dir = 'uploads/thumbs/';
//this should be an array of video paths
$videos = array();
if( $_POST["name"] ){
// Grab the MIME type and the data with a regex for convenience
if (!preg_match('/data:([^;]*);base64,(.*)/', $_POST['data'], $matches)) {
@stlsmiths
stlsmiths / sdatatable_foot.js
Created June 8, 2011 22:31
YUI2 Scrolling DataTable with Footer
/**********
*
* ScrollingDataTable with Footer for YUI 2
* Author: Todd Smith (todd@stlsmiths.com)
* <br/>
* @module DataTableSF
* @requires yahoo, dom, event, element, datasource, datatable
* @title DataTableSF Widget
*
* To implement, add the following to the DataTable configs object,