Skip to content

Instantly share code, notes, and snippets.

View michaelnagy's full-sized avatar

Michael Nagy michaelnagy

  • https://traact.com
  • Ribeirao Preto - Brazil
View GitHub Profile
var flowtype = require('simplefocus/FlowType.JS:flowtype.js');
console.log(flowtype);
var $p=function(){var d=arguments,e=d[0],o=false;if(typeof e==="string")o=d[1]||false;else if(e&&!e[0]&&!e.length)e=[e];return $p.core(e,o)},pure=$p;
$p.core=function(d,e,o){function u(a){typeof console!=="undefined"&&console.log(a);throw"pure error: "+a;}function O(){var a=$p.plugins,b=function(){};b.prototype=a;b.prototype.compile=a.compile||P;b.prototype.render=a.render||Q;b.prototype.autoRender=a.autoRender||R;b.prototype.find=a.find||S;b.prototype._compiler=B;b.prototype._error=u;return new b}function G(a){return a.outerHTML||function(b){var g=document.createElement("div");g.appendChild(b.cloneNode(true));return g.innerHTML}(a)}function C(a,
b){return function(g){return a(String(b.call(g.item||g.context,g)))}}function S(a,b){if(typeof a==="string"){b=a;a=false}return(a||document).querySelectorAll(b)}function H(a,b){return function(g){var c=[a[0]],i=a.length,h,k,l,f,n;try{for(n=1;n<i;n++){h=b[n].call(this,g);k=a[n];if(h===""){l=c[c.length-1];if((f=l.search(/[^\s]+=\"?$/))>-1){c[c.length-1]=l.substring(0,f
<script>
var self = this;
self.products = [];
self.categories = [];
self.catfetch = [];
var products = new Stamplay.Cobject('produtos').Collection;
var categoria = new Stamplay.Cobject('category').Model;
// Invoke the fetch method on categories
// category.fetch().then(function() {
// console.log(category);
@michaelnagy
michaelnagy / myart.js
Last active November 19, 2015 19:15
This function does everything you see in this page: https://boiling-badlands-7399.herokuapp.com/filme/tt2975590/batman-vs-superman
//counter for checking tooltip messages
var firstset = false;
//
var self = this;
// Calls the data from API
jsonReq('/api/profile/reviews')
.then(function(data) {
self.reviews = data;
console.log("ao-favorites: ", self.reviews);
function rateLoop(reviews) {
reviews.forEach(function(review, index) {
//aqui inicializa a instancia do plugin
$(".rate-item-"+review._id).rateYo({
rating: review.rating,
spacing: "10px",
starWidth: '30px',
ratedFill: '#1A81D0',
onChange: function (rating, rateYoInstance) {
$('.counter').html(rating);
@michaelnagy
michaelnagy / especial_char_remove
Created November 12, 2014 11:28
Remove special characters from an Excel table
'Acentos e caracteres especiais que serão buscados na string
'Você pode definir outros caracteres nessa variável, mas
' precisará também colocar a letra correspondente em codiB
codiA = "àáâãäèéêëìíîïòóôõöùúûüÀÁÂÃÄÈÉÊËÌÍÎÒÓÔÕÖÙÚÛÜçÇñÑ"
'Letras correspondentes para substituição
codiB = "aaaaaeeeeiiiiooooouuuuAAAAAEEEEIIIOOOOOUUUUcCnN"
'Armazena em temp a string recebida
temp = caract
@michaelnagy
michaelnagy / gist:d9cba3555ba73b87fb4f
Created August 11, 2014 17:27
Used to set and get cookies in Joomla
$inputCookie = JFactory::getApplication()->input->cookie;
$fono = $inputCookie->get($name = 'id_fonoaudiologo_campanha', $defaultValue = null);
$camp = $inputCookie->get($name = 'id_indicador_campanha', $defaultValue = null);
$veiode = $inputCookie->get($name = 'veio_de', $defaultValue = null);
if(isset($_SERVER['HTTP_REFERER'])){
if( strpos($_SERVER['HTTP_REFERER'], 'direitodeouvir') === False) {
$inputCookie->set('veio_de', $_SERVER['HTTP_REFERER'] , time()+(3600*24*7), '/' );
}
} else {
if ( ! $veiode ) {
@michaelnagy
michaelnagy / prettyPhoto-open-onpage-load
Created June 1, 2014 16:21
Populate an array with all <a href=""> that has attribute rel=prettyPhoto, then opens the prettyPhoto gallery when page loads using prettyPhoto API function.
jQuery(document).ready(function($) {
var hrefs = [];
$('[rel^=prettyPhoto]').each(function() {
hrefs.push(this.href);
});
$.prettyPhoto.open(hrefs);
});
@michaelnagy
michaelnagy / protetor.php
Last active December 15, 2019 03:39
Protetor de link com 2 propagandas diferentes, baseado em cookies.
<?php
$horas = '43200';
$tempo_anuncio = '20';
$tempo_n = '35';
$link_protetor = $_POST['link_final'];
if(isset($_POST['link_final']) and !empty($link_protetor)){
$display = "none";
$referer = $_SERVER['HTTP_REFERER'];
if($_COOKIE['protetor'] == '1'){
setcookie("protetor", "2");
@michaelnagy
michaelnagy / send-mail.js
Created May 7, 2013 18:30
Jquery code used in my personal site to send mail...
$(function() {
var contactForm = $('#contact-form');
contactForm.submit(function()
{
if(contactForm.valid())
{
contactForm.find('.submit-area').addClass('loading');
var formValues = $(this).serialize();