Skip to content

Instantly share code, notes, and snippets.

View andresmoschini's full-sized avatar

Andres Moschini andresmoschini

  • Making Sense
  • Mar del Plata
View GitHub Profile
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script language="javascript">
$(function () {
$(".DemoPopup").click(function () {
//TODO: height and wifdth should be calculated
$("#sb-container").height("5000px").width("10000px").show();
@andresmoschini
andresmoschini / DelimitedDelete.sql
Created January 20, 2012 13:52
Which is the least ugly?
DELETE q FROM (
SELECT TOP 1000000 *
FROM sc_logging
WHERE DATEDIFF(day, Date, CURRENT_TIMESTAMP) > 15
ORDER BY Date ASC) q
DELETE FROM sc_logging
WHERE Id IN (
SELECT TOP 1000000 Id
class ClientA
{
public virtual List<Invoice> Invoices { get; set; }
//...
public Product GetMostBuyedProduct(DateTime from, DateTime to)
{
//...
}
@andresmoschini
andresmoschini / DateTimeOffsetExample.cs
Created August 8, 2012 14:22
Ejemplos del uso de DateTimeOffset
static class DateTimeOffsetExample
{
static void Main(string[] args)
{
DateTimeOffset localDateTime = DateTimeOffset.Now; // Setting up a DateTimeOffset with my local machine time: 2012-08-07 05:50:00 pm Offset -05:00 (We are in DST)
Console.WriteLine(localDateTime.DateTime); // Is a DateTime, the output is the time as was recorded in the client machine (no offset involved): 2012-08-07 05:50:00 pm
Console.WriteLine(localDateTime.Offset); // A TimeSpan (hh:mm): -05:00:00
Console.WriteLine(localDateTime.LocalDateTime); // A DateTime, because I'm on the same machine it is: 2012-08-07 05:50:00 pm
//I'm creating this particular DateTime Offset for demostration, lets imagine I got this from the DB (for the record the client machine was on Bs As)
@andresmoschini
andresmoschini / gitorious1.sh
Created September 26, 2012 17:44
gitorious1
apt-get install mc build-essential dkms openssh-server colordiff locate ntp pwgen rsync vim git git-core git-cvs git-doc git-svn apache2 apache2-threaded-dev apg aspell aspell-en build-essential geoip-bin imagemagick libapache2-mod-xsendfile libaspell-dev libcurl4-openssl-dev libdbd-mysql-ruby libexpat1-dev libgeoip-dev libgeoip1 libmagick++-dev libmagick++4 libmysql-ruby libmysqlclient-dev libonig-dev libpcre3 libpcre3-dev libreadline-dev libreadline5 libruby libsqlite3-dev libxslt1-dev libyaml-dev memcached mysql-client mysql-server openjdk-6-jre postfix ruby ruby-dev rubygems sphinxsearch sqlite3 unzip zip zlib1g zlib1g-dev
@andresmoschini
andresmoschini / Yammer.cs
Created November 21, 2012 17:34
Testing Gist & Yammer
public class Yammer
{
public string Name { get; set; }
}

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

@andresmoschini
andresmoschini / gist:6073066
Created July 24, 2013 18:17
Print last added lines to a file in the console
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Threading.Tasks;
namespace ConsoleApplication7
{
class Program
[class|="icon"] {
width:10px;
height:10px;
display:inline-block;
line-height:10px;
background-image: url("../img/icon_sprite.png");
background-repeat: no-repeat;
}
.icon-arrow-left{
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>The HTML5 Herald</title>
</head>
<body>