Skip to content

Instantly share code, notes, and snippets.

View tucaz's full-sized avatar

tucaz tucaz

View GitHub Profile
@tucaz
tucaz / POP3.cs
Created January 30, 2012 23:36
Sample usage of AE.NET.Mail
//Sample usage of AE.NET.Mail
//https://github.com/andyedinborough/aenetmail
using (var pop = new AE.Net.Mail.Pop3Client(_host, _username, _password, _port, _useSSL))
{
var count = pop.GetMessageCount();
for (var i = count - 1; i >= 0; i--)
{
var msg = pop.GetMessage(i, false);
sSQL = @"SELECT
A.CTA_ID,
A.CTA_AG_NUM,
A.CTA_AG_NOM,
A.CTA_NUM,
A.CTA_NOM_GRT,
A.CTA_BCO_ID,
B.BCO_NOM,
A.CTA_DD_TEL,
A.CTA_TEL,
@tucaz
tucaz / gist:1557665
Created January 3, 2012 23:59
LOL Lisp
;5 + 4 (2 - (3 - (6 + 4/5))) / 3(6 - 2)(2 - 7)
(/ (+ 5 4
(- 2
(- 3
(+ 6
(/ 4 5)
)
)
)
@tucaz
tucaz / gist:1330999
Created November 1, 2011 16:24
jqGridWrapper
var myNamespace = myNamespace || {};
myNamespace.jqGridWrapper = function (gridId, pagerId, gridUrl, gridConfig) {
var grid = $(gridId).jqGrid({
url: gridUrl,
datatype: "json",
colNames: gridConfig.colNames,
colModel: gridConfig.colModel,
rowNum: 10,
rowList: [10, 20, 30],
@tucaz
tucaz / gist:1320202
Created October 27, 2011 17:26
Kill me now please
function PrintContent() {
printWindow = window.open("", "mywindow", "location=0,status=0,scrollbars=1,resizable=1");
var strContent = "<html><head>";
strContent = strContent + "<title" + ">Print Preview</title>";
strContent = strContent + "<link href=\"Styles/jqGrid/ui.jqgrid.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<link href=\"Styles/JQueryUI/jquery-ui-1.8.16.custom.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<link href=\"Styles/ASI/Main.css\" type=\"text/css\" rel=\"Stylesheet\" />";
strContent = strContent + "<script type=\"text/javascript\" src=\"ClientScript/Shared/jquery-1.6.2.min.js\"></scr" + "ipt>";
@tucaz
tucaz / gist:1285950
Created October 14, 2011 00:47
Modules + PubSub
//Module
Widget = function (core) {
var Entry = function (entryText, accountId) {
this.EntryText = entryText;
this.AccountId = accountId;
};
var EntriesViewModel = function () {
var that = this;
@tucaz
tucaz / LinkedList.js
Created July 5, 2011 00:03
Simple double linked list in javascript
var Node = function (v) {
if ( !(this instanceof arguments.callee) ) {
throw new Error("Constructor called as a function");
}
this.value = v;
this.next = null;
this.previous = null;
}
public class ProductDetailTranslator
{
public ProductDetail Translate(string xmlFrom)
{
var productTo = new ProductDetail();
var xmlReader = XmlReader.Create(new StringReader(xmlFrom));
var productDetail = XElement.Load(xmlReader);
var parentGroups = productDetail.Elements("Grouping").First().Elements("section")
.Select(parentGroup => new Group() { Name = parentGroup.Elements("displayname").First().Value, Items = GetChildren(parentGroup).ToList() });
@tucaz
tucaz / gist:757678
Created December 28, 2010 20:36
Comparativo C# v.s. F#
//C#
public T FindInList(List<T> source, List<T> target>
{
foreach(T item in source)
{
foreach(T targ in target)
{
if(item == targ)
return item
let entryDate = match List.filter dateToken tokens with
| r when r.Length > 0 ->
Some(Seq.head r)
| otherwise ->
None