Skip to content

Instantly share code, notes, and snippets.

@jarodium
jarodium / _mysql_ops
Last active March 23, 2017 13:44
Mysql Ops
1
@jarodium
jarodium / gist:b7bbc4eafe98a635a157
Created May 20, 2015 16:28
Controlar uma iframe de youtube via id
function callPlayer(frame_id, func, args) {
if (window.jQuery && frame_id instanceof jQuery) frame_id = frame_id.get(0).id;
var iframe = document.getElementById(frame_id);
if (iframe && iframe.tagName.toUpperCase() != 'IFRAME') {
iframe = iframe.getElementsByTagName('iframe')[0];
}
// When the player is not ready yet, add the event to a queue
// Each frame_id is associated with an own queue.
// Each queue has three possible states:
@jarodium
jarodium / gist:75922d700327cc390298
Created June 5, 2015 10:17
verificar se o texto de um input é um Google Place válido
function is_location_valid(address, address_success_div)
{
var geocoder = new google.maps.Geocoder();
geocoder.geocode( {"address": address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK)
{
address_success_div.innerHTML = "SUCCESS";
}
else
@jarodium
jarodium / zoho.php
Last active December 13, 2016 23:43
Zoho CRM API Class
<?
class ZOHO {
private $U = "";
private $P = "";
protected $BURL = 'https://crm.zoho.com/crm/private/xml/';
protected $token = "";
protected $pdata = array();
public function __construct() {
$this->pdata = array("authtoken" => $this->token,"scope" => "crmapi");
@jarodium
jarodium / index.js
Created November 25, 2015 11:21
Jquery inputs numéricos
$("#txtboxToFilter").keydown(function (e) {
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Allow: Ctrl+A, Command+A
(e.keyCode == 65 && ( e.ctrlKey === true || e.metaKey === true ) ) ||
// Allow: home, end, left, right, down, up
(e.keyCode >= 35 && e.keyCode <= 40)) {
// let it happen, don't do anything
return;
}
@jarodium
jarodium / one.js
Created September 15, 2016 08:19
Clear all Cookies with JS
document.cookie.split(";").forEach(function(c) { document.cookie = c.replace(/^ +/, "").replace(/=.*/, "=;expires=" + new Date().toUTCString() + ";path=/"); });
@jarodium
jarodium / gist:1fe78f25a1fd6cbb83b57aaa264a65b5
Created April 20, 2017 22:23 — forked from sandrinodimattia/gist:3162314
Dynamics CRM 2011 eID Javascript
<html>
<head>
<title>eID: Read</title>
<script type="text/javascript" src="https://localhost:100/be_belgium_eid.js"></script>
<script language="javascript" type="text/javascript">
// Initialize the reader.
var cardReader = new be.belgium.eid.CardReader();
// Bind error events.
function noCardPresentHandler() { window.alert("No card present!"); }
@jarodium
jarodium / swipe.js
Created October 23, 2017 13:10
Updated version of swipe.js from Blake Simpson's Blog. This version supports miltitouch
$.fn.swipe = function( callback ) {
var touchDown = false,
originalPosition = null,
$el = $( this );
function swipeInfo( event ) {
if ('undefined' !== typeof event.originalEvent.pageX) {
var x = event.originalEvent.pageX,
y = event.originalEvent.pageY,
dx, dy;
@jarodium
jarodium / traveling-salesman.php
Created November 1, 2018 10:00 — forked from tlhunter/traveling-salesman.php
PHP Traveling Salesman Genetic Algorithm
<?php
ini_set("error_reporting", E_ALL & ~E_NOTICE);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Genetic Algorithm : TSP : PHP Implementation by Thomas Hunter</title>
<style>
body {
@jarodium
jarodium / mail.php
Last active November 11, 2018 14:45
Open Simplex implementation in php
<?php
use ajf\TypedArrays\Uint8Array;
use ajf\TypedArrays\Float32Array;
class openSimplexNoise {
/*
* Class Open Simplex
* Direct PHP implementation based on Jonas Wagner ( https://github.com/jwagner/simplex-noise.js/blob/master/simplex-noise.js )
* implementation for javascript which is based on example code by Stefan Gustavson ([email protected]).
* eith Optimisations by Peter Eastman ([email protected]).