Skip to content

Instantly share code, notes, and snippets.

View miguelramos's full-sized avatar
🔥
Making picasso moves 🏄‍♂️

Miguel Ramos miguelramos

🔥
Making picasso moves 🏄‍♂️
View GitHub Profile
@miguelramos
miguelramos / node-and-npm-in-30-seconds.sh
Created April 17, 2012 13:55 — forked from isaacs/node-and-npm-in-30-seconds.sh
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl http://npmjs.org/install.sh | sh

#Four Ways To Do Pub/Sub With jQuery and jQuery UI (in the future)

Between jQuery 1.7 and some of work going into future versions of jQuery UI, there are a ton of hot new ways for you to get your publish/subscribe on. Here are just four of them, three of which are new.

(PS: If you're unfamiliar with pub/sub, read the guide to it that Julian Aubourg and I wrote here http://msdn.microsoft.com/en-us/scriptjunkie/hh201955.aspx)

##Option 1: Using jQuery 1.7's $.Callbacks() feature:

$.Callbacks are a multi-purpose callbacks list object which can be used as a base layer to build new functionality including simple publish/subscribe systems. We haven't yet released the API documentation for this feature just yet, but for more information on it (including lots of examples), see my post on $.Callbacks() here:

@miguelramos
miguelramos / PriorityCalculator.php
Last active August 29, 2015 14:03 — forked from fcaravana/PriorityCalculator.php
Random probability by weight.
<?php
class PriorityCalculator
{
private $data = array();
private $universe = 0;
public function add( $data, $probability )
{
$this->data[ $x = count( $this->data ) ] = new stdClass;
/**
* @jsx React.DOM
*/
var React = require('react'),
MyReactComponent = React.createClass({
// The object returned by this method sets the initial value of this.state
getInitialState: function(){
return {};