Skip to content

Instantly share code, notes, and snippets.

View ElemarJR's full-sized avatar
🏠
Working from home

Elemar Rodrigues Severo Junior ElemarJR

🏠
Working from home
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>Deferred Objects</title>
</head>
<body>
<p id="p1">This paragraph fadeOut in 1000ms</p>
<p id="p2">This paragraph fadeOut in 2000ms</p>
<button id="fadeOutButton">fade out now!</button>
<!DOCTYPE html>
<html>
<head>
<title>Deferred Objects</title>
</head>
<body>
<p id="p1">This paragraph fadeOut in 1000ms</p>
<p id="p2">This paragraph fadeOut in 2000ms</p>
<button id="fadeOutButton">fade out now!</button>
<!DOCTYPE html>
<html>
<head>
<title>Deferred Objects</title>
</head>
<body>
<div id="output"></div>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Deferred Objects</title>
</head>
<body>
<button id="resolveButton">resolve</button>
<button id="rejectButton">reject</button>
<button id="getStateButton">get state</button>
<!DOCTYPE html>
<html>
<head>
<title>Sammy demo</title>
</head>
<body>
<ul id='content'></ul>
<form action='#/addLine' method='post'>
define(['amplify', 'jquery'],
function (amplify, $) {
var
data,
init = function() {
$.mockJSON.data.STATE =
[ 'RS', 'SP', 'RJ', 'MG'];
$.mockJSON.data.CUSTOMER_FIRST_NAME =
['Elemar', 'Gabriel', 'Israel', 'Pedro'];
$.mockJSON.data.CUSTOMER_LAST_NAME =
var fibonacci = _.memoize(function(n) {
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
});
var numbers = [1,2,3,4,8];
var q = _.countBy(numbers, function(x) { return x % 2 == 0 ? 'even' : 'odd'; } );
// q = { "odd": 2, "even": 3}
var numbers = [1,2,3,4,5,6,7,8,9,0,11];
var gt5 = _.select(numbers, function (x) { return x > 5; });
// gt5 = [6,7,8,9,11]
var squares = _.map(numbers, function (x) { return x * x; });
// squares = [1,4,9,16,25,36,49,81,0,121]
var product = _.reduce(gt5, function (a,b) { return a * b; } , 1);
// product = 33264
require(['app/ds.twitter'], function (ds) {
var callbacks = {
success : function(result) {
// aqui, tratamento os resultados ...
},
error : function(error, status) {
// aqui, tratamento caso algo ocorra de errado...
}
};
ds.getMentions(callbacks, 'elemarjr');