Skip to content

Instantly share code, notes, and snippets.

View portal7's full-sized avatar

Alfredo Severo portal7

  • Buenos Aires, Argentina
View GitHub Profile
@portal7
portal7 / simple.cs
Created May 21, 2014 16:10
Clean HTML String to Text
var inputString = "<html>blablalba</html>"
string cleanTextFromHtml = Regex.Replace(inputTextVar, @"<[^>]+>|&nbsp;", "").Trim();
@portal7
portal7 / PrimeraMayuscula
Created May 23, 2014 16:48
Texto Primera Letra Mayuscula de forma Nativa C#
public static string ToInvarianTitleCase(this string self)
{
if (string.IsNullOrWhiteSpace(self))
{
return self;
}
return CultureInfo.InvariantCulture.TextInfo.ToTitleCase(self);
}
@portal7
portal7 / normalizadorcadena.cs
Created May 26, 2014 20:13
Normalizacion de Caracteres
static string RemoveDiacritics(string text)
{
var normalizedString = text.Normalize(NormalizationForm.FormD);
var stringBuilder = new StringBuilder();
foreach (var c in normalizedString)
{
var unicodeCategory = CharUnicodeInfo.GetUnicodeCategory(c);
if (unicodeCategory != UnicodeCategory.NonSpacingMark)
{
@portal7
portal7 / weathericon
Last active August 29, 2015 14:19 — forked from aloncarmel/weathericon
function setWeatherIcon(condid) {
switch(condid) {
case '0': var icon = '<i class="wi-tornado"></i>';
break;
case '1': var icon = '<i class="wi-storm-showers"></i>';
break;
case '2': var icon = '<i class="wi-tornado"></i>';
break;
case '3': var icon = '<i class="wi-thunderstorm"></i>';
using System;
namespace ConsoleApplication1.Migrations
{
using System.Data.Entity.Migrations;
internal sealed class Configuration : DbMigrationsConfiguration<DatabaseContext>
{
public Configuration()
{
<!DOCTYPE html>
<html>
<head>
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<ul></ul>
<script>
@portal7
portal7 / jquery.json.extender.js
Last active October 30, 2015 14:08
jQuery Json Parser Extender Plugin
/*!
* jQuery.parseJSON() extension (supports ISO & Asp.net date conversion)
*
* Version 1.0 (13 Jan 2011)
*
* Copyright (c) 2011 Robert Koritnik
* Licensed under the terms of the MIT license
* http://www.opensource.org/licenses/mit-license.php
*/
(function ($) {
using System;
using System.Text;
using System.Security.Cryptography;
public class Program
{
private const string key = "key";
private const string message = "message";
private static readonly Encoding encoding = Encoding.UTF8;
@portal7
portal7 / vertical-center-boostrap3.css
Last active November 12, 2015 13:49
Class Center for Vertical Centering on Bootstrap 3
.vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */
min-height: 100vh; /* These two lines are counted as one :-) */
display: flex;
align-items: center;
}
@portal7
portal7 / importCSVFromFTP_ToMySQLDB.php
Created February 12, 2016 16:47
Connect to FTP Download a CSV and process with PHP to MYSQL Database
<?php
$source = "DespGoods.csv";
$target = fopen("DespGoods.csv", "w");
$conn = ftp_connect("ftp.server.com") or die("Could not connect");
ftp_login($conn,"ftpusername","ftppassword");
ftp_fget($conn,$target,$source,FTP_ASCII);
echo "file downloaded.\n";