Skip to content

Instantly share code, notes, and snippets.

View wendleypf's full-sized avatar
🖥️
Job

Wendley Paulo de França wendleypf

🖥️
Job
View GitHub Profile
# coding utf-8
print 'hello Medium'
this.addEventListener('fetch', function (event) {
console.log('fetch');
});
@wendleypf
wendleypf / sw.js
Last active January 15, 2018 17:33
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('sw-builder.js')
.then(function (reg) {
console.log('serviceWorker registrado.');
}).catch(function (error) {
console.warn('serviceWorker falhou.');
});
} else {
console.log('serviceWorker não é suportado.');
}
# coding: utf-8
def row(k,w0,l,mu):
reason = l/ mu
w = w0
weights = []
for i in range(0, k+ 1):
weights.append(w)
w *= reason
Set<Saudacao> saudacoes = new HashSet<>();
String query = "SELECT ASSUNTO, TIPO FROM SAUDACAO";
try {
Statement st = conn.createStatement();
ResultSet rs = st.executeQuery(query);
while (rs.next()) {
Saudacao saudacao = new Saudacao();
saudacao.setAssunto(rs.getString("ASSUNTO"));
saudacao.setTipo(rs.getInt("TIPO"));
saudacoes.add(saudacao);
package br.edu.ufcg.embedded.util;
public class AuthException extends RuntimeException {
public AuthException(String message) {
super(message);
}
}
@wendleypf
wendleypf / TokenService.java
Created May 1, 2017 15:09
Component de token da aplicaçao
package br.edu.ufcg.embedded.component;
import br.edu.ufcg.embedded.model.Coach;
import br.edu.ufcg.embedded.model.Student;
import br.edu.ufcg.embedded.model.User;
import br.edu.ufcg.embedded.service.CoachService;
import br.edu.ufcg.embedded.service.StudentService;
import br.edu.ufcg.embedded.util.AuthException;
import org.apache.tomcat.util.codec.binary.Base64;
import org.json.JSONObject;
@wendleypf
wendleypf / Crud.java
Created May 1, 2017 15:06
Interface crud - service
package br.edu.ufcg.embedded.util;
import java.util.List;
public interface Crud<T> {
T create(T t);
List<T> getAll();
T getById(Long id);
@wendleypf
wendleypf / hamming.py
Created December 8, 2016 19:59
Geração e Verificação de código de Hamming
# coding: utf-8
'''
@author: wendley
'''
def gerador_codigo_de_hamming(byte):
byte_hamming = range(12)
byte_hamming[2] = int(byte[0])
byte_hamming[4] = int(byte[1])
byte_hamming[5] = int(byte[2])
@wendleypf
wendleypf / paridade.py
Created December 8, 2016 19:56
Verificador de paridade
#coding: utf-8
'''
@author: wendley
'''
def verificador_de_paridade(input_value):
numero_de_uns = 0
for bit in input_value:
if bin(int(bit)) == bin(1):
numero_de_uns += 1