Skip to content

Instantly share code, notes, and snippets.

View danilodorgam's full-sized avatar
🏠
Working from home

Danilo Dorgam danilodorgam

🏠
Working from home
  • Dorgam Network
  • Brasília DF
  • 19:17 (UTC -03:00)
View GitHub Profile
if(nota[1] != undefined){
if(repet == 1){
soma=nota[1]*qtd;
}else{
for(i=1; i<= qtd; i++){
soma += nota[i];
}
}
media = soma/qtd;
frmMedia.txtMedia1.value = "Sua Nota Media R$"+media;
@danilodorgam
danilodorgam / trocaparimpar.c
Created April 6, 2015 21:40
//Objetivo: Separar os números em par e impar //Parametros: Referencia ao vetor e tamanho do vetor //retono: Void
//Objetivo: Separar os números em par e impar
//Parametros: Referencia ao vetor e tamanho do vetor
//retono: Void
void trocaParImpar(int *num, int qtd){
int cont, cont2, par=0, impar=0;
for( cont=0; cont < qtd; cont++ ){
for( cont2 = qtd- 1; cont2 > cont; cont2-- ){
if( *(num+cont)%2==0 ){
par=*(num+cont);
@danilodorgam
danilodorgam / bd.php
Created April 30, 2015 23:43
w3 total
<?php
return array(
'version' => '0.9.4.1',
'cluster.messagebus.debug' => false,
'cluster.messagebus.enabled' => false,
'cluster.messagebus.sns.region' => '',
'cluster.messagebus.sns.api_key' => '',
'cluster.messagebus.sns.api_secret' => '',
'cluster.messagebus.sns.topic_arn' => '',
/*
Objetivo: Ler uma estrutura no arquivo em binario
parametro: endereço da estrutura e do contador de candidatas
retorno: void
*/
void lerArquivoBinario(Candidata *candidata, int *contaMiss){
FILE *arq;
if((arq=abreArquivo("backup.txt","rb","S"))!=NULL){
fseek ( arq , 1 , SEEK_SET );
while(!feof(arq)|| *contaMiss == MAX_MODELOS){
@danilodorgam
danilodorgam / campos.js
Last active August 29, 2015 14:24
js para adicionar campos ao formulário
<script type="text/javascript">
$(document).ready(function(){
var input = '<label style="display: block"><br><div class="row">';
input +='<div class="col-xs-6 col-md-4"><input class="form-control" id="disabledInput" type="text" placeholder="Materia" required ></div>';
input +='<div class="col-xs-6 col-md-4"><input class="form-control" id="disabledInput" type="text" placeholder="Aluno" required ></div>';
input +='<div class="col-xs-6 col-md-4"><input class="form-control" id="disabledInput" type="text" placeholder="Professor" required ></div>';
input +='</div><a href="#" class="remove"> <span class="glyphicon glyphicon-remove-sign" aria-hidden="true"></span></a></label>';
$("input[name='addFormacao']").click(function( e ){
$('#formacao_adicional').append( input );
@danilodorgam
danilodorgam / ajax.js
Last active October 4, 2015 17:08
teste com html + php + ajax
$('#seila').submit(function(e){
e.preventDefault();
if($('#enviar').val()=='Enviando..'){
return (false);
}
//em vez de mudar o valor do butão poderia mudar inserir o circulo rodando
$('#enviar').val('Enviando..');
$.ajax({
url: 'processa.php',
@danilodorgam
danilodorgam / gist:65b60bd6a91956adc370
Created October 24, 2015 00:41
abrir um jks no cmd
keytool -v -list -keystore keypis.jks
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Api extends CI_Controller{
//Função uasada para receber a prova finalizada e salvar no banco de dados
public function set_prova(){
$this->load->model('apiModel');
$post_date = file_get_contents("php://input");
$data = json_decode($post_date);
CREATE DATABASE IF NOT EXISTS `cadastro` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `cadastro`;
-- MySQL dump 10.13 Distrib 5.7.9, for Win64 (x86_64)
--
-- Host: localhost Database: cadastro
-- ------------------------------------------------------
-- Server version 5.6.17
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
@danilodorgam
danilodorgam / EnableCors.php
Created July 23, 2017 16:02 — forked from geekcom/EnableCors.php
Enable Cors Middleware
<?php
namespace App\Http\Middleware;
use Closure;
class EnableCors
{
/**
* Handle an incoming request.