Skip to content

Instantly share code, notes, and snippets.

@mbenegas
mbenegas / gist:1642297
Created January 19, 2012 20:13
Cache user data
function fb_get_school_name(jsonObj){
var school_name = '';
if (typeof jsonObj.education != 'undefined' && jsonObj.education.length > 0){
jQuery.each(jsonObj.education, function(){
if (this.type == 'College'){
school_name = this.school.name;
return false;
}
});
}
@mbenegas
mbenegas / gist:1470566
Created December 13, 2011 04:21
Iterate without use of cursor MySQL
DELIMITER $$
CREATE PROCEDURE `nocursor`()
BEGIN
Declare validId int;
Declare validName varchar(45);
-- drop the temporary table if exists
Drop table if exists `routines_sample`.tmp_validation;
-- create the temporary table, here you could use Engine=Memory
Create table `routines_sample`.tmp_validation (`id` int not null, `name` varchar(45) not null, `valid` bit(1) not null) Engine=MyISAM;