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
@andresmoschini
andresmoschini / PullRequestsMergining.md
Last active August 29, 2015 14:21
Altenativas para mergear Pull Requests

Altenativas para mergear Pull Requests

Dueño del repositorio hace los merges

Pros

  • Control total sobre que se mergea.
  • El dueño del repo es el único responsable del código.

Cons

@andresmoschini
andresmoschini / Maybe.cs
Last active August 29, 2015 14:26
Maybe Monad C# implementation
using System;
using System.Collections;
using System.Collections.Generic;
namespace Utilities
{
public static class Maybe
{
public static Maybe<T> From<T>(T value) => new Maybe<T>(value);
public static Maybe<T> None<T>() => default(Maybe<T>);
<!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; }
}
{
"$schema": "http://json-schema.org/draft-04/schema",
"id": "campaign-social-preferences.json",
"type": "object",
"properties": {
"shareButtons": {
"type": [ "array", "null" ],
"items": {
"type": "string",
"enum": [

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 %}.