Skip to content

Instantly share code, notes, and snippets.

View DiegoPinho's full-sized avatar

Diego Martins de Pinho DiegoPinho

View GitHub Profile
@DiegoPinho
DiegoPinho / react-bootstrap.js
Last active June 18, 2018 16:49
react-bootstrap.js
const Jumbotron = ReactBootstrap.Jumbotron;
const Button = ReactBootstrap.Button;
const App = () => {
return (
<Jumbotron>
<h1>Olá!</h1>
<p>
Este é um exemplo do Componente Jumbotron construído com o
React-Boostrap!
/**
* Sticker.js: A Javascript library that allows you to create a Sticker Effect
*
* @project-site http://stickerjs.cmiscm.com/
* @repository https://github.com/cmiscm/stickerjs
* @author Jongmin Kim - cmiscm.com
* @version 1.0 (2014/02/05)
* @license MIT License
*/
(function(){var m,b=null,h=["webkit","Moz","ms","O"],d="all 0.6s cubic-bezier(.23,1,.32,1)",j="all 0s",e=document.createElement("style");e.appendChild(document.createTextNode(" .shadowL {background: -moz-linear-gradient(right, rgba(0,0,0,0) 0%, rgba(0,0,0,0.01) 1%, rgba(0,0,0,0.7) 100%);background: -webkit-gradient(linear, right top, left top, color-stop(0%,rgba(0,0,0,0)), color-stop(1%,rgba(0,0,0,0.01)), color-stop(100%,rgba(0,0,0,0.7)));background: -webkit-linear-gradient(right, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 1%,rgba(0,0,0,0.7) 100%);background: -o-linear-gradient(right, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 1%,rgba(0,0,0,0.7) 100%);background: -ms-linear-gradient(right, rgba(0,0,0,0) 0%,rgba(0,0,0,0.01) 1%,rgba(0,0
Reveal.initialize({
// Display presentation control arrows
controls: true,
// Help the user learn the controls by providing hints, for example by
// bouncing the down arrow when they first encounter a vertical slide
controlsTutorial: true,
// Determines where controls appear, "edges" or "bottom-right"
@DiegoPinho
DiegoPinho / exemplo-props.js
Created May 10, 2018 18:05
Exemplo de componente com propriedades - UNIVEM
const App = () => {
return (
<Pessoa nome = "Diego Martins de Pinho" />
)
}
const Pessoa = (props) => {
return (
<p><b>Nome: </b>{props.nome}</p>
)
// Inserir no HTML
// <script src="https://rawgithub.com/darkskyapp/skycons/master/skycons.js"></script>
buildPageWithTemperatureInformation(latitude, longitude) {
var APIKEY = '22bbde6414ada496401cb62696a8ac7e';
var API_URL = 'https://api.darksky.net/forecast/' + APIKEY + "/";
var API_EXCLUDE = '?units=si&lang=pt&exclude=minutely,hourly,alerts,flags';
var trickToFixCORS = "&callback=?";
$.getJSON(API_URL + params + API_EXCLUDE + trickToFixCORS, function(data) {
function getLocation() {
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(showLocation, function(error) {
alert("error! :(");
console.log(error);
});
}
}
function searchForTermOnWikipedia(term) {
// example: https://en.wikipedia.org/w/api.php?action=opensearch&search=zyz&limit=1&namespace=0&format=jsonfm
var action = 'action=opensearch';
var search = 'search=' + term;
var format = 'json';
var params = '?' + action + '&' + search + '&' + format + '&callback=?';
var url = WIKIPEDIA_API_URL + params;
$.getJSON(url, function(data) {
@DiegoPinho
DiegoPinho / glide.js
Created April 16, 2018 18:27
artigo da code prestige
<div class="glide">
<div class="glide__track" data-glide-el="track">
<ul class="glide__slides">
<li class="glide__slide">0</li>
<li class="glide__slide">1</li>
<li class="glide__slide">2</li>
</ul>
</div>
</div>
@DiegoPinho
DiegoPinho / nodemailer.js
Created February 6, 2018 16:31
Enviando e-mail usando Node.js
'use strict';
const nodemailer = require('nodemailer');
// Generate test SMTP service account from ethereal.email
// Only needed if you don't have a real mail account for testing
nodemailer.createTestAccount((err, account) => {
// create reusable transporter object using the default SMTP transport
let transporter = nodemailer.createTransport({
host: 'smtp.ethereal.email',
@DiegoPinho
DiegoPinho / App.js
Last active January 22, 2018 13:12
Script do artigo "Como criar um app React consumindo um back-end Node com Express"
import React, {Component} from 'react';
import logo from './logo.svg';
import './App.css';
class App extends Component {
state = {
response: ''
};
componentDidMount() {