REST API para leitura de contracheques do estado da ParaÃba.
POST https://contrachequepb.herokuapp.com/api/contracheques/login
/* Allow Landscape mode for specific ViewControllers */ | |
-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window { | |
UIViewController* topVC = [self topViewControllerWith: self.window.rootViewController]; | |
if ([topVC respondsToSelector:@selector(canRotate)]) { | |
return UIInterfaceOrientationMaskAllButUpsideDown; | |
} | |
return UIInterfaceOrientationMaskPortrait; | |
} | |
/* get the top ViewController */ |
fetch('/users', { | |
method: 'POST', | |
headers: { | |
'Accept': 'application/json', | |
'Content-Type': 'application/json', | |
'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').getAttribute('content')}, | |
credentials: 'same-origin', | |
body: JSON.stringify( { id: 1, name: 'some user' } ) | |
}) | |
.then(function(data) { |
$(function() { | |
$('#id-do-form').submit(function() { | |
var valuesToSubmit = $(this).serialize(); | |
$.ajax({ | |
type: "POST", | |
url: $(this).attr('action'), //sumbits it to the given url of the form | |
data: valuesToSubmit, | |
dataType: "JSON" // you want a difference between normal and ajax-calls, and json is standard | |
}).success(function(json){ | |
console.log("success", json); |
require 'net/http' | |
require 'json' | |
def listar_usuarios(quantidade, my_proc) | |
uri = URI('http://jsonplaceholder.typicode.com/users') | |
response = Net::HTTP.get(uri) | |
JSON.parse(response) | |
my_proc.call(quantidade) | |
yield JSON.parse(response) if block_given? | |
puts "Finalizando listagem de usuarios" |
require 'net/http' | |
require 'json' | |
def listar_usuarios | |
uri = URI('http://jsonplaceholder.typicode.com/users') | |
response = Net::HTTP.get(uri) | |
JSON.parse(response) | |
yield JSON.parse(response) if block_given? | |
puts "Finalizando listagem de usuarios" | |
end |
class Automovel | |
def self.tipo_cambio | |
puts "Manual" | |
end | |
def acelera | |
puts "Acelerando automóvel..." | |
end | |
end |
class Automovel | |
def acelera | |
# Aciona injeção eletrônica | |
# injeta combustível e etc... | |
puts "Acelerando automóvel..." | |
end | |
end | |
class Carro < Automovel | |
def acelera |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.