Skip to content

Instantly share code, notes, and snippets.

@j0x0j
j0x0j / gist:5392290
Created April 15, 2013 23:57
Parse JSON string inside mongodb $where function
db.collection.find({
$where: function() {
var obj = eval("(function(){ return " + this.object + " })()");
if(obj.param) {
if(obj.param === "something") {
return this
} else {
return false
}
} else {
@j0x0j
j0x0j / jsinterval
Created September 10, 2012 19:13
JS interval ticker
var gameTimer = setInterval('timer()', 1000);
function timer() {
// se llama cada segundo
// podrias tener un var del num de segundos
// y cada ves que llama timer() lo incrementa ++
}
// Cuando acabas, matas el interval
clearInterval(gameTimer);
@j0x0j
j0x0j / Calculadora VIG
Created June 18, 2012 17:47
pop up calculadora
<div id="page" class="<?= $pageclass ?>">
<header class="container_16">
<div class="grid_6 suffix_2">
<div class="logo"></div>
</div>
<div class="grid_8">
<ul>
<li class="call">
<p class="phone margin_auto">787-200-8585</p>
<p class="margin_auto">&iexcl;Ll&aacute;manos a cualquier hora!</p>
@j0x0j
j0x0j / gist:2886197
Created June 7, 2012 02:32
Hover tooltip
<!-- los valores son ejemplo nadamás -->
<style>
.expand {
position: absolute;
overflow: visible;
}
.expand.a {
top: 10px;
left: 10px;
}
<style>
.tiempo .weather_info{
position: absolute;
width: 122px;
right: 10px;
top: 15px;
}
.tiempo .weather_info_btn{
background: url(../images/weather_info_btn.png) no-repeat;
width: 13px;
@j0x0j
j0x0j / wapa m videos
Created May 29, 2012 21:21
Videos for mobile
if((strstr($_SERVER['HTTP_USER_AGENT'],'iPhone')) || (strstr($_SERVER['HTTP_USER_AGENT'],'iPod')) || (strstr($_SERVER['HTTP_USER_AGENT'],'iPad'))) {
echo "<img src='/templates/images/icon-cam.gif' width='9' height='10' class='content_icon'> <a href=\"http://d.wapamovil.wapatv2.netdna-cdn.com/play/_definst_/mp4:vod/wapamovil.wapatv2/".$row_video[0]['mp4_file']."/playlist.m3u8\">Oprime para ver video</a> <img src='/templates/images/icon-cam.gif' width='9' height='10' class='content_icon'><br />";
}else{
echo "<img src='/templates/images/icon-cam.gif' width='9' height='10' class='content_icon'> <a href=\"rtsp://d.wapamovil.wapatv2.netdna-cdn.com/play/_definst_/mp4:vod/wapamovil.wapatv2/".$row_video[0]['mp4_file']."\">Oprime para ver video</a> <img src='/templates/images/icon-cam.gif' width='9' height='10' class='content_icon'><br />";
}
@j0x0j
j0x0j / Wapa Idol Mobil Homepage JS
Created May 22, 2012 15:31
Index Wapa Idol Mobil JS
$(document).ready(function(){
   
    $('.plusarrow').onclick(function(){
         expand();
    });
   
    $('.minusarrow').onclick(function(){
         collapse();
    });
   
@j0x0j
j0x0j / Wapa Idol Mobil Homepage
Created May 22, 2012 15:28
Index Wapa Idol Mobil
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Wapa Mobil</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0">
<meta name="viewport" content="maximum-scale=1.0">
<meta name="viewport" content="user-scalable=no">
<meta name="viewport" content="width=device-width">