Skip to content

Instantly share code, notes, and snippets.

View serbanghita's full-sized avatar
🏓

Serban Ghita serbanghita

🏓
View GitHub Profile
@hagino3000
hagino3000 / client.js
Created December 8, 2011 18:42
WebSocket with binary data
var socket = null;
function bootstrap() {
// 適当な図形を描画
var c = document.getElementById('mycanvas');
var ctx = c.getContext('2d');
ctx.globalalpha = 0.3;
for(var i=0; i<1000; i++) {
ctx.beginPath();
@pixelhandler
pixelhandler / jquery-1.6.4-promises.js
Created October 9, 2011 01:09
Deferred / Promise extracted from jQuery v1.6.4 for use with older version of jQuery 1.4.2
(function($){
var // Promise methods
promiseMethods = "done fail isResolved isRejected promise then always pipe".split( " " ),
// Static reference to slice
sliceDeferred = [].slice;
if (typeof $ !== 'function') {
return false;
} else {
@drewwells
drewwells / nResolve.js
Created September 15, 2011 15:31
Merge data from many AJAX requests
function aj( url ){
return $.ajax({
url: url,
success: function( data ){
}
);
}
function resolve( args ){
@cowboy
cowboy / HEY-YOU.md
Last active September 25, 2025 09:25
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
@jimeh
jimeh / hasOwnProperty.js
Created March 15, 2010 00:02
Cross-browser hasOwnProperty solution
/*
Cross-browser hasOwnProperty solution, based on answers from:
http://stackoverflow.com/questions/135448/how-do-i-check-to-see-if-an-object-has-an-attribute-in-javascript
*/
if ( !Object.prototype.hasOwnProperty ) {
Object.prototype.hasOwnProperty = function(prop) {
var proto = obj.__proto__ || obj.constructor.prototype;
return (prop in this) && (!(prop in proto) || proto[prop] !== this[prop]);
};
}