Skip to content

Instantly share code, notes, and snippets.

public IEnumerable<DataGridRow> obtenerDataGridRows(DataGrid grid)
{
var itemsSource = grid.ItemsSource as IEnumerable;
if (null == itemsSource) yield return null;
foreach (var item in itemsSource)
{
var row = grid.ItemContainerGenerator.ContainerFromItem(item) as DataGridRow;
if (null != row) yield return row;
}
}
@RicardoACS
RicardoACS / UpGitBash
Created December 27, 2015 18:17
Subir código de forma manual via Git Bash
git init
git add .
git commit -m "initial commit"
git remote add [NombreProyecto] [URL for remote repository]
git push [NombreProyecto] master
@RicardoACS
RicardoACS / EncriptarPHP
Created November 15, 2015 02:22
Encriptar Password en PHP
//Funcion
function crypt_blowfish_bydinvaders($password, $digito = 7)
{
$set_salt = './1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
$salt = sprintf('$2a$%02d$', $digito);
for($i = 0; $i < 22; $i++)
{
$salt .= $set_salt[mt_rand(0, 22)];
}
@RicardoACS
RicardoACS / Disco
Created November 11, 2015 00:47
Buscar disco Linux
echo "- - -" > /sys/class/scsi_host/host0/scan
@RicardoACS
RicardoACS / LVM.txt
Created October 28, 2015 01:04
Creación Discos LVM
Instalación LVM vía CLI
1) Incorporar disco en la máquina
2) Particionar disco
fdisk /dev/sdb
8e Linux lvm
3) Crearlo como PV
pvcreate /dev/sdb1
@RicardoACS
RicardoACS / updateUser
Created October 11, 2015 03:30
Modificar Home User (CentOS)
ls -la (sobre /home/usuario)
cp .* /carpetaDestino
@RicardoACS
RicardoACS / validadorAPSX.cs
Last active October 29, 2015 23:14
Usar validadores en ASPX
<appSettings>
<add key="ValidationSettings:UnobtrusiveValidationMode" value="None" />
</appSettings>
@RicardoACS
RicardoACS / validarRut.cs
Created June 19, 2015 23:14
Validar Rut Chile
public bool validarRut(string rut ) {
bool validacion = false;
try
{
rut = rut.ToUpper();
rut = rut.Replace(".", "");
rut = rut.Replace("-", "");
int rutAux = int.Parse(rut.Substring(0, rut.Length - 1));
char dv = char.Parse(rut.Substring(rut.Length - 1, 1));
@RicardoACS
RicardoACS / juegoAvion.cpp
Created May 25, 2015 02:47
Juego de avion C++
#include <stdio.h>
#include <Windows.h>
#include <conio.h>
#include <stdlib.h>
#include <list>
#include <mmsystem.h>
using namespace std;
#define ARRIBA 72
#define IZQUIERDA 75
@RicardoACS
RicardoACS / poligonos.cs
Created May 21, 2015 00:00
Poligonos, Elipses y lineas
<Canvas>
<Rectangle Fill="Blue" Stroke="Black" Canvas.Left="40"
Canvas.Top="40" Height="40" Width="40">
</Rectangle>
<Ellipse Fill="Green" Stroke="Blue" StrokeThickness="2"
Canvas.Left="60" Canvas.Top="120" Height="55" Width="55">
</Ellipse>
<Path Stroke="DarkBlue" StrokeThickness="3">
<Path.Data>