This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http = require('http'); | |
var fs = require('fs'); | |
var url = require('url'); | |
var path = require('path') | |
http.createServer(function(req, res) { | |
//res.writeHead(200,{"Content-Type":"text/html"}); --> Não informe ao navegador um statusCode 200 se você ainda não sabe o que vai acontecer abaixo... | |
var uri = url.parse(req.url).pathname; //usamos a biblioteca url! | |
var filename = path.join(process.cwd(), uri); //mapeamos o caminho solicitado para o caminho onde a aplicação está sendo executada. Por exemplo: | |
//http://localhost:3000/images/image.png vira c:\node\projetoTeste\images\image.png. VOcê precisa mapear o arquivo pro fileSystem para poder abrir e servir o binário! | |
console.log(uri); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var strUrl = "/Home/EnviarArquivo"; | |
$(document).ready(function () { | |
$("#formEnviar").submit(function () { | |
confirmSubmission(this); //apenas refatorei o código para uma função externa, assim fica melhor a leitura e permita que você submita o form através de outros locais e não somente de dentro do próprio form! | |
return false; //aqui está o que fará com que o form não seja enviado | |
}); | |
}) | |
function confirmSubmission(form){ | |
bootbox.confirm("Confirma Envio do arquivo ?", function (result) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Facebook.GrupoASPNET.Exemplos.Models | |
{ | |
public sealed class Person : IValidatableObject | |
{ | |
[Display(Name = "Código")] | |
public Int32 PersonId {get;set;} | |
[Display(Name = "Tipo de pessoa")] | |
[Required(ErrorMessage="Informe o tipo de pessoa: Física/Jurídica")] | |
public PersonFiscalType FiscalType {get;set;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
$btn_votar = filter_input(INPUT_POST,'votar', FILTER_SANITIZE_STRING); | |
if(!$btn_votar) | |
header('location:../votacao.php'); | |
$categoria= $_POST['categoria']; | |
$nome=$_POST['voto1']; | |
$ip=$_SERVER['REMOTE_ADDR']; | |
require_once('../conexao.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const String Letters = "abcdefghijklymnopqrstuwxyz"; //bota o resto ai | |
const String Numbers = "0123456789"; | |
const String Symbols = "@$!?"; //põe mais se quiser | |
const Int32 Size = 10; | |
public static String CreatePassword() | |
{ | |
var random = new Random(); | |
var password = new StringBuilder(Size); | |
var upperUsed = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function smooth(r, g, b, repetitions){ | |
/* Returns a smootheness HSV translation to a RGB value | |
@author: Guilherme Branco Stracini (guilherme[at]editorainovacoa[dot]com[dot]br) | |
@date: 2017-10-24 | |
@version: 1.0 | |
@remarks: Based on Python implementation of https://www.alanzucconi.com/2015/09/30/colour-sorting/ (accessed on 2017-10-24) | |
@returns: {Object} Returns a object containing the H, S and V keys for each item (Hue, Saturation and Value) | |
*/ | |
var lum, hsv, h, v; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="example"></div> | |
<script type="text/javascript" src="smoothness.hexadecimal.sorting.js"></script> | |
<script type="text/javascript"> | |
//Usa os valores jรก cadastrados para o campo produto/SKU da VTEX | |
var samples = ['#FFFAFA','#F8F8FF','#F5F5F5','#DCDCDC','#FFFAF0','#FDF5E6','#FAF0E6','#FAEBD7','#FFEFD5','#FFEBCD','#FFE4C4','#FFDAB9','#FFDEAD','#FFE4B5','#FFF8DC','#FFFFF0','#FFFACD','#FFF5EE','#F0FFF0','#F5FFFA','#F0FFFF','#F0F8FF','#E6E6FA','#FFF0F5','#FFE4E1','#FFFFFF','#000000','#2F4F4F','#696969','#708090','#778899','#BEBEBE','#D3D3D3','#191970','#000080','#6495ED','#483D8B','#6A5ACD','#7B68EE','#8470FF','#0000CD','#4169E1','#0000FF','#1E90FF','#00BFFF','#87CEEB','#87CEFA','#4682B4','#B0C4DE','#ADD8E6','#B0E0E6','#AFEEEE','#00CED1','#48D1CC','#40E0D0','#00FFFF','#E0FFFF','#5F9EA0','#66CDAA','#7FFFD4','#006400','#556B2F','#8FBC8F','#2E8B57','#3CB371','#20B2AA','#98FB98','#00FF7F','#7CFC00','#00FF00','#7FFF00','#00FA9A','#ADFF2F','#32CD32','#9ACD32','#228B22','#6B8E23','#BDB76B','#F0E68C','#EEE8AA','#FAF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Enums/Test.cs | |
public enum Test | |
{ | |
NONE = 0, | |
ONE = 1, | |
TWO = 2, | |
THREE = 3, | |
FOUR = 4, | |
FIVE = 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<textarea id=t></textarea> | |
<br /> | |
<button onclick="copy()">Copiar</button> | |
<div style='background:#FCF;' id='log'></div> | |
<script> | |
var log = document.getElementById('log'); | |
function copy() { | |
var t = document.getElementById('t') | |
t.select() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
session_start(); | |
error_reporting(E_ERROR | E_WARNING | E_PARSE); | |
$checked = false; | |
$encerrado = false; | |
$preenchido = false; | |
$ganhador = null; | |
function ganhador(){ | |
global $ganhador; |
OlderNewer