Skip to content

Instantly share code, notes, and snippets.

var canvas = null;
function buttonSocial(div){
if($("#image-"+div).attr("src") == "images/"+div+".png"){
$("#image-"+div).attr("src", "images/"+div+"-ativo.png");
@mayroncachina
mayroncachina / gist:8960384
Last active August 29, 2015 13:56
Simple Json Sample
from datetime import datetime
import json
data = {
'title': 'Hello World',
'created_on': datetime(1986, 5, 16, 0, 0)
}
def date_handler(obj):
<!DOCTYPE html>
<html>
<head>
<link href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css" rel="stylesheet" type="text/css" />
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
@mayroncachina
mayroncachina / gist:11a510ca3ac45078c093
Created June 26, 2014 19:25
Pushwoosh Phonegap (Android/IOS)
var pushNotification;
document.addEventListener("deviceready", onDeviceReady, false);
// device APIs are available
function onDeviceReady() {
initPushwoosh();
}
@mayroncachina
mayroncachina / gist:9c8d79df50315ca68a32
Created September 29, 2014 23:24
Haversine formula - Exemplo de calculo de distância
import math
def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
radius = 6371 # km
dlat = math.radians(lat2-lat1)
dlon = math.radians(lon2-lon1)
<?php
function saveImage($base64img){
if($base64img == ""){
return "0";
}else{
define('UPLOAD_DIR', 'upload/');
$base64img = str_replace('data:image/jpeg;base64,', '', $base64img);
$data = base64_decode($base64img);
@mayroncachina
mayroncachina / Phonegap Download API
Last active August 29, 2015 14:26
Phonegap Download API
var fileTransfer = new FileTransfer();
var uri = encodeURI("http://some.server.com/download.php");
fileTransfer.download(
uri,
fileURL,
function(entry) {
console.log("download complete: " + entry.toURL());
},
function(error) {
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready", init, false);
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready", init, false);
<!DOCTYPE html>
<html>
<head>
<title></title>
<script type="text/javascript" charset="utf-8" src="cordova.js"></script>
<script type="text/javascript">
document.addEventListener("deviceready", init, false);