Skip to content

Instantly share code, notes, and snippets.

View omariosouto's full-sized avatar

Mario Souto omariosouto

View GitHub Profile
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Text('Hello!'),
)
);
}
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Text('Hello!'),
)
);
}
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
home: Text('Hello!'),
)
);
}
function classNames(...possibleCSSClasses) {
return possibleCSSClasses.map((possibleCSSClass) => {
let className;
if(typeof possibleCSSClass === 'string') {
className = possibleCSSClass
}
if(typeof possibleCSSClass === 'object' && !Array.isArray(possibleCSSClass)) {
className = Object.keys(possibleCSSClass).filter((possibleCSSClassName) => {
return possibleCSSClass[possibleCSSClassName]
<span className={classNames(
'novoTweet__status',
'outra classe',
{
'novoTweet__status--invalido': !this.isNovoTweetLowerOrEqual140()
}
)}>
{this.state.novoTweet.length}/140
</span>
<span className={`
novoTweet__status
${
!this.isNovoTweetLowerThan140()
? 'novoTweet__status--invalido'
: ''
}`}>
{this.state.novoTweet.length}/140
</span>
fetch(`https://twitelum-api.herokuapp.com/tweets`, {
method: 'POST',
body: JSON.stringify({ conteudo: 'aaa', login: 'omariosouto' }),
headers: {
'content-type': 'application/json'
}
})
.then(function (data) {
return data.json()
})
fetch('http://twitelum-api.herokuapp.com/tweets')
.then(function(respostaDoServidor) {
return respostaDoServidor.json()
})
.then(function(dadosConvertidosEmObjeto) {
console.log(dadosConvertidosEmObjeto)
})
fetch('http://twitelum-api.herokuapp.com/tweets')
.then(function(respostaDoServidor) {
respostaDoServidor.json().then(function(dadosConvertidosEmObjeto) {
console.log(dadosConvertidosEmObjeto)
})
})
fetch('http://twitelum-api.herokuapp.com/tweets')
.then(function(respostaDoServidor) {
console.log(respostaDoServidor)
})