Skip to content

Instantly share code, notes, and snippets.

View otar's full-sized avatar

Otar Chekurishvili otar

View GitHub Profile
var Q = require("q");
exports.read = function (path, timeout) {
var response = Q.defer();
var request = new XMLHttpRequest(); // ActiveX blah blah
request.open("GET", path, true);
request.onreadystatechange = function () {
if (request.readyState === 4) {
if (request.status === 200) {
@mrdoob
mrdoob / RequestAnimationFrame.js
Created February 22, 2011 14:50
Provides requestAnimationFrame in a cross browser way.
/**
* Provides requestAnimationFrame in a cross browser way.
* @author paulirish / http://paulirish.com/
*/
if ( !window.requestAnimationFrame ) {
window.requestAnimationFrame = ( function() {
return window.webkitRequestAnimationFrame ||
@mwbrooks
mwbrooks / thumbs.alunny.js
Created March 2, 2011 07:21
code golf! 446 bytes minified (yui-compressor defaults)
(function(window, document) {
/**
* Do not use thumbs.js on touch-enabled devices
*/
if (document.ontouchstart) return;
/**
* Map touch events to mouse events
*/
@avioing
avioing / adjust coordinates
Created March 16, 2011 19:26
adjusting coordinates of markers with identical coordinates
// add this inside your loop - looping over your marker locations
var coordinates_hash = new Array();
var coordinates_str, actual_lat, actual_lon, adjusted_lat, adjusted_lon;
actual_lat = adjusted_lat = this.locations[i].latitude;
actual_lon = adjusted_lon = this.locations[i].longitude;
coordinates_str = actual_lat + actual_lon;
while (coordinates_hash[coordinates_str] != null) {
// adjust coord by 50m or so
@Thinkscape
Thinkscape / PSR-0-final-proposal.md
Created September 22, 2011 10:30
PSR-0 Final Proposal (PHP Standards Working Group)

PSR-0 Final Proposal (PHP Standards Working Group)

The following describes the mandatory requirements that must be adhered to for autoloader interoperability.

Mandatory:

  • A fully-qualified namespace and class must have the following structure \ <Vendor Name> \ (<Namespace>)* \ <Class Name>
  • Each namespace must have a top-level namespace ("Vendor Name").
  • Each namespace can have as many sub-namespaces as it wishes.
  • Each namespace separator is converted to a DIRECTORY_SEPARATOR when loading from the file system.
  • Each "_" character in the CLASS NAME is converted to a DIRECTORY_SEPARATOR. The "_" character has no special meaning in the namespace.
@powdahound
powdahound / install_air.sh
Created January 21, 2013 15:55
Installing Adobe AIR on Ubuntu.
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
apt-get install lib32asound2 lib32gcc1 lib32ncurses5 lib32stdc++6 lib32z1 libc6 libc6-i386 ia32-libs-gtk lib32nss-mdns
curl http://usablesoftware.files.wordpress.com/2011/02/getlibs-all-deb.pdf > getlibs-all.deb
@maccman
maccman / jquery.ajax.queue.coffee
Last active January 13, 2018 12:03
Queueing jQuery Ajax requests. Usage $.ajax({queue: true})
$ = jQuery
queues = {}
running = false
queue = (name) ->
name = 'default' if name is true
queues[name] or= []
next = (name) ->
@curtismcmullan
curtismcmullan / setup_selenium.sh
Last active May 2, 2023 22:56
Setup Selenium Server on Ubuntu 14.04
#!/bin/bash
# Following the guide found at this page
# http://programmingarehard.com/2014/03/17/behat-and-selenium-in-vagrant.html
echo "\r\nUpdating system ...\r\n"
sudo apt-get update
# Create folder to place selenium in
@staltz
staltz / streamio.js
Created October 3, 2016 13:22
Playful Haskell Stream I/O with ES6 Generators
function *main() {
const confirmRequest = {
type: 'confirm',
value: 'Are you sure?',
};
const confirmResponse = yield confirmRequest;
if (confirmResponse === true) {
const consoleRequest = {
type: 'console',