Skip to content

Instantly share code, notes, and snippets.

View andrerocker's full-sized avatar
🤓
Clojure / SRE

Andre Souza andrerocker

🤓
Clojure / SRE
View GitHub Profile
@andrerocker
andrerocker / sqlserver-dump.ps1
Created October 30, 2010 22:12
Powershell Script to: Export all data from yours SQLServer like mysqldump
$database_host = "<host>"
$database_name = "<database>"
$output_file = "<output_file>"
$user = "<username>"
$password = "<password>"
[system.reflection.assembly]::loadWithPartialName('Microsoft.SqlServer.SMO')
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $database_host
$server.connectionContext.loginSecure = $false
@andrerocker
andrerocker / sqlserver-dump-only-data.ps1
Created October 30, 2010 22:36
Powershell Script to: Export ONLY the data from yours SQLServer like mysqldump
$database_host = "<host>"
$database_name = "<database>"
$output_file = "<output_file>"
$user = "<username>"
$password = "<password>"
[system.reflection.assembly]::loadWithPartialName('Microsoft.SqlServer.SMO')
$server = new-object "Microsoft.SqlServer.Management.Smo.Server" $database_host
$server.connectionContext.loginSecure = $false
$server.connectionContext.set_Login($user)
@andrerocker
andrerocker / DateUtil.java
Created November 7, 2010 13:48
Java Encontrar Primeiro e Ultimo Dia de Uma Semana
package com.braincoretechnology.rules.util;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
public class DateUtil
{
public static Date resolvePrimeiroUltimo(Date data, boolean isPrimeiro)
{
@andrerocker
andrerocker / bt-lock-form-frag.js
Created November 7, 2010 17:41
Fragmento bt-lockform
/*
* Bloqueia o Formulario
*/
HTMLFormElement.prototype.lockForm = function()
{
var elmnts = this.elements;
armazenaEstadoFormulario(this);
for(i=0; i<elmnts.length; i++)
habilitaItemForm(elmnts[i], false);
@andrerocker
andrerocker / bt-lockform-frag.js
Created November 7, 2010 17:44
Fragmento de Codigo para Desbloqueio do Formulario
/**
* Desbloqueia o Formulario
*/
HTMLFormElement.prototype.unlockForm = function()
{
var elmnts = this.elements;
var store = buildStoreForm(this, false);
for(i=0; i<elmnts.length; i++)
habilitaItemForm(elmnts[i], !store[i]);
@andrerocker
andrerocker / bt-lockform-frag.js
Created November 7, 2010 17:49
Trecho de implementação - Estado do Formulario
/**
* Retorna estado do Formulario
*/
HTMLFormElement.prototype.isLocked = function()
{
var store = buildStoreForm(this, false);
if(store.length>0)
return store['locked'];
@andrerocker
andrerocker / centro.php
Created November 7, 2010 18:11
post blog upload
<?php
$action = $_REQUEST["acao"];
if($action=="upload-logo")
{
processaLogo();
}
function processaLogo()
{
@andrerocker
andrerocker / upload.html
Created November 7, 2010 18:14
post blog upload
<form method="post" action="centro.php" enctype="multipart/form-data">
<input type="hidden" name="acao" value="upload-logo">
<input type="file" name="logo">
<input type="submit" value="Enviar">
</form>
@andrerocker
andrerocker / upload-frag.php
Created November 7, 2010 18:17
post blog frag upload
<?php
$action = $_REQUEST["acao"];
if($action=="upload-logo")
{
processaLogo();
}
?>
@andrerocker
andrerocker / upload-frag.php
Created November 7, 2010 18:21
post blog fragmento processa logo
<?php
function processaLogo()
{
$logo = processaUploadLogo($_FILES["logo"]);
if(!$logo)
{
header("location: index.php?retorno=upload-invalido");
return;
}