Skip to content

Instantly share code, notes, and snippets.

View eduardo-matos's full-sized avatar

Eduardo Matos eduardo-matos

View GitHub Profile
@eduardo-matos
eduardo-matos / compartilhar.txt
Created February 20, 2013 19:12
Social Share
Share on:
Facebook
http://www.facebook.com/share.php?u=
Twitter
https://twitter.com/intent/tweet?text=&url=
Google Plus
https://plus.google.com/share?url=
@eduardo-matos
eduardo-matos / script.js
Last active December 14, 2015 19:08
Disparando eventos com jQuery
function CentralDeProdutos () {
$(this).on('adicionado', function (evt, sucesso) {
alert('Removido com sucesso: ' + sucesso);
});
$(this).on('removido', function (evt, sucesso, numeroProdutosRemovidos) {
alert('Removido com sucesso: ' + sucesso);
alert('Número de produtos removidos: ' + numeroProdutosRemovidos);
});
@eduardo-matos
eduardo-matos / script.js
Created March 11, 2013 13:29
JSONP call using raw AMD.
require([
'http://search.twitter.com/search.json?callback=define&q=%23javascript'
], function (jsonpResponse) {
console.log(jsonpResponse);
});
@eduardo-matos
eduardo-matos / analytics.js
Last active June 13, 2016 14:48
Loading Google Analytics using Dojo Toolkit (1.8+)
require([
'dojo/request/script'
], function(
script
) {
'use strict';
var _gaq = window._gaq = window._gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_trackPageview']);
@eduardo-matos
eduardo-matos / index.html
Last active December 15, 2015 01:39
Playing with DojoX GFX
<div id="surface"></div>
@eduardo-matos
eduardo-matos / load-css.js
Last active December 15, 2015 02:49
load-css module in Dojo
define([
'dojo/on',
'dojo/_base/window',
'dojo/dom-construct',
'dojo/Deferred'
], function (
on,
win,
domConstruct,
Deferred
@eduardo-matos
eduardo-matos / fetchall.sh
Created March 28, 2013 14:24
GIT: Update all remote tracking changes.
#!/bin/sh
# Usage: fetchall.sh branch ...
set -x
git fetch --all
for branch in "$@"; do
git checkout "$branch" || exit 1
git rebase "origin/$branch" || exit 1
done
@eduardo-matos
eduardo-matos / script.js
Created May 6, 2013 16:24
Emiting custom events on plain object.
require([
'dojo/on',
'dojo/Evented',
'dojo/_base/lang'
], function (
on,
Evented,
lang
) {
'use strict';
@eduardo-matos
eduardo-matos / removeDuplicate.js
Created May 7, 2013 14:01
Array - remove duplicate items.
function removeDuplicate(oldArray) {
var newArray = [];
var i = 0;
var len = oldArray.length;
for(; i < len; i++) {
if(newArr.indexOf(arr[i])<0) {
newArr.push(arr[i])
@eduardo-matos
eduardo-matos / temp-ignore.txt
Created May 24, 2013 11:23
GIT - temporarily ignore file
# So, to temporarily ignore changes in a certain file:
git update-index --assume-unchanged -- <file>
# Then when you want to track changes again:
git update-index --no-assume-unchanged -- <file>