Skip to content

Instantly share code, notes, and snippets.

View ortense's full-sized avatar
💀
Coding...

Marcus Ortense ortense

💀
Coding...
View GitHub Profile
@ortense
ortense / google-analytics-track-twitter.js
Created May 27, 2014 14:58
Google Analytics Events for Twitter plugin interactions
(function(){
/**
* Twitter interaction
* @see https://dev.twitter.com/docs/tfw/events
*/
var category = 'social',
action = 'twitter';
if(twttr && twttr.events && twttr.events.bind){
twttr.events.bind('tweet', function (event) {
@ortense
ortense / constructor.js
Created July 16, 2014 18:18
My JS Constructor/Class template
var Constructor_name = (function(){
/** CONSTRUCTOR **/
function Constructor_name (params) {
// body...
}
/** PRIVATE METHODS **/
@ortense
ortense / node-router.js
Created July 23, 2014 16:02
Node.js Router
var http = require('http'),
fs = require('fs'),
htmlPath = './html',
server = http.createServer(function(req, res){
var pagina = req.url == '/' ? '/index' : req.url;
pagina = htmlPath + pagina + '.html';
fs.exists(pagina, function(exists) {
if (!exists) pagina = htmlPath + '/404.html';
fs.readFile(pagina, function(err, html){
if (err) {
@ortense
ortense / ga-decorate-link.js
Created July 29, 2014 15:15
ga-decorate-link
@ortense
ortense / FB.Event.subscribe.js
Created August 4, 2014 21:19
Monitoramento de interação com plugin social do facebook
FB.Event.subscribe('edge.create', function (url, element) {
console.log(['like', url, element]);
});
FB.Event.subscribe('edge.remove', function (url, element) {
console.log(['unlike', url, element]);
});
@ortense
ortense / hasAnalyticsGoogle.js
Created November 28, 2014 14:56
Check If Google Analytics Script Is In The Page Template
function hasAnalyticsGoogle(){
var scripts = document.getElementsByTagName('script'),
ga = true, ua = true, dc = false,
i, len, s;
len = scripts.length;
if (ga || ua || dc) {
for (i = 0; i < len; i += 1) {
s = scripts[i].src;
@ortense
ortense / cross-domain.js
Last active August 29, 2015 14:27
Manage Cross-Domain Tracking
/**
* @fileoverview Manage Cross-Domain Tracking
* @author Marcus Ortense
* @see http://lucida-brasil.github.io/clientes/bluehive/ford-crossdomain.html
*/
/**
* url_decorate
* @global
* @param {string} url
@ortense
ortense / People.class.js
Last active September 10, 2015 21:38
basic es6 class
"use strict";
/* <3 ES6 */
class People{
constructor(name, birthday){
this.name = name;
this.birthday = birthday || new Date();
}
sayName() {
@ortense
ortense / db.json
Last active September 21, 2015 15:05
Um POC divertido com class do es6
{
"funcionarios" : [
{"id":1, "nome":"Ortense", "cargo": "JS Developer", "id_empresa": 1},
{"id":2, "nome":"Toschi", "cargo": "JS Developer", "id_empresa": 1},
{"id":3, "nome":"Gafanhoto", "cargo": "JS Developer", "id_empresa": 1}
],
"empresas" : [
{"id" : 1, "nome" : "Lúcida"},
{"id" : 2, "nome" : "ACME"}
]
@ortense
ortense / beer.js
Last active September 23, 2015 22:47
Vue.js ES6 beerApp
/*
Componente ES6 baseado na serie do Vedovelli sobre Vue.js
http://vuejs.org/
http://www.vedcasts.com.br/series/vuejs
ultima aula assistida: http://www.vedcasts.com.br/series/vuejs/aula9
*/
"use strict";
Vue.filter('dataFormat', (value, formatString = 'DD/MM/YYYY') => {