Alguns assuntos extras para o treinamento de Javascript da Caelum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(win){ | |
if(win.attachEvent) return; | |
var attachEvent = function(on, callback) { | |
var on = on.substring(2,on.length); | |
return this.addEventListener(on, callback); | |
} | |
win.Element.prototype.attachEvent = attachEvent; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.gitconfig from @boblet | |
# initially based on http://rails.wincent.com/wiki/Git_quickstart | |
[core] | |
excludesfile = /Users/oli/.gitignore | |
legacyheaders = false # >git 1.5 | |
quotepath = false | |
# http://stackoverflow.com/questions/136178/git-diff-handling-long-lines | |
pager = less -r | |
# if ↑ doesn’t work, try: pager = less -+$LESS -FRX |
Para consumir os dados servidos pelo servidor usando Ajax, podemos usar o CORS (Cross-Origin Resource Sharing). Ele consiste de 2 headers, um na requisiçáo e um na resposta.
Setando header Access-Control-Allow-Origin
com JAX-RS:
// Alteraramos o método buscaPagamento para usar um ResponseBuilder
// e setar o header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sleep(seconds) | |
{ | |
var e = new Date().getTime() + (seconds * 1000); | |
while (new Date().getTime() <= e) {} | |
} | |
var Obj = function() { | |
this.fn = function(arg) { | |
console.log('Long operation zzzz...'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Author: Vitor Mattos <[email protected]> | |
# | |
# Shell script that configures gnome-terminal to use my custom theme | |
# based on X::DotShare. Written for Ubuntu 11.10, tested on Ubuntu 14.04 | |
# | |
# Works for gnome-terminal < 3.8 | |
#BLACK |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" | |
" Author: Vitor Mattos <[email protected]> | |
" | |
" My favorite VIM theme | |
" Based on Lucario: https://github.com/raphamorim/lucario | |
" | |
" | |
set t_Co=256 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
++++++++++ | |
[ | |
>+++++++++++ | |
>++++++++++ | |
>++++++++++++ | |
>+++++++++++ | |
>+++++++++++ | |
>+++++ | |
>+++++++++++ | |
>+++++++++++ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Deploys project to WebDAV-compliant server | |
# Uses a package.json for semantic versioning | |
# Requires: curl, jq | |
# Required env vars: | |
# WEBDAV_REMOTE: remote url of WebDAV-compliant server. Protocol and path included | |
# WEBDAV_PROJECT: project name | |
# WEBDAV_USER: basic auth/digest user name |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
/*************************** | |
* Estratégias de cálculo * | |
*************************** | |
* | |
* Essas funções devem retornar void e receber dois int como parametros | |
* Por quê? Veja o próximo comentário... | |
* | |
*/ |
OlderNewer