Skip to content

Instantly share code, notes, and snippets.

View lcaballero's full-sized avatar

Lucas Caballero lcaballero

View GitHub Profile
@lcaballero
lcaballero / console.snippet
Created March 5, 2012 07:16
Visual Studio snippet xml that expands and surrounds for a console.xxx( | ) call
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<!-- JS console Snippet -->
<Header>
<Title>console</Title>
<Author>Lucas Caballero</Author>
<Shortcut>console</Shortcut>
<Description>Markup snippet for console</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
@lcaballero
lcaballero / jquery-plugin-closure.snippet
Created March 5, 2012 07:45
Visual Studio snippet xml that expands and surrounds with the typical jQuery closure plug-in like syntax.
<CodeSnippet Format="1.1.0" xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<!-- JS surround with closure Snippet -->
<Header>
<Title>closure</Title>
<Author>Lucas Caballero</Author>
<Shortcut>jqclosure</Shortcut>
<Description>Surround/Expand with the typeical jQuery closure plug-in syntax.</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
@lcaballero
lcaballero / Xml Serializing example.
Last active December 11, 2015 12:19
Example serializing things in C#/.NET -- I have to look this up almost everytime.
XmlSerializer xs = new XmlSerializer(typeof(Resources));
StringWriter sw = new StringWriter();
XmlTextWriter xw = new XmlTextWriter(sw);
xw.Formatting = Formatting.Indented;
xs.Serialize(xw,
new Resources
{
Caches = new List<Cache>
{
new Cache
@lcaballero
lcaballero / tmLaguage Syntax Keys
Created February 26, 2013 04:33
Scraped .tmLanguage files. Looking for the syntax keys, which in this pulls only the name tags with dotted, fully qualified, tuples (so not very sophisticated).
comment.block.antlr
comment.block.applescript
comment.block.bibtex
comment.block.c
comment.block.css
comment.block.d
comment.block.documentation
comment.block.documentation.javadoc
comment.block.documentation.js
comment.block.documentation.json
@lcaballero
lcaballero / gist:5089204
Created March 5, 2013 10:00
Recursive Linq Traversing a Tree. This version traverses a directory structure.
public static IEnumerable<string> Files(
this string root, Func<string, bool> accept)
{
return
Directory.GetFiles(root).Where(accept)
.Concat(
Directory.GetDirectories(root)
.SelectMany(d => d.Files(accept)));
}
@lcaballero
lcaballero / gist:5095517
Created March 5, 2013 23:54
Typical .To(a,b) for Linq.
public static IEnumerable<int> To(this int from, int to)
{
for (int i = from; i < to; i++)
{
yield return i;
}
}
@lcaballero
lcaballero / Quotes
Last active December 15, 2015 16:19
Quotes I've found. This is as good a place to put them as any, I suppose.
"Less than 10% of the code has to do with the ostensible purpose of the system; the rest deals with input-output, data validation, data structure maintenance, and other housekeeping." -- Mary Shaw (from Pro Asp.Net 4 CMS)
"Low-level programming is good for the programmer's soul." -- John Carmack (from Pro Asp.Net 4 CMS)
"If the automobile had followed the same development cycle as the computer, a Rolls-Royce would today cose $100, get a million miles per gallon, and explode once a year, killing everyone inside." -- Robert X. Cringly (from Pro Asp.Net 4 CMS)
"What you leave behind is not what is engraved in stone monuments, but what is woven into the lives of others." -- Pericles
"The learning process is something you can incite, literally incite, like a riot." - Audre Lorde
package main
import (
"fmt"
_ "github.com/lib/pq"
_ "github.com/jmoiron/sqlx"
"database/sql"
"reflect"
)
@lcaballero
lcaballero / go-ab
Last active December 20, 2015 12:39
Go version of AB
package main
import (
"flag"
"io/ioutil"
"http"
"time"
"fmt"
"os"
)
@lcaballero
lcaballero / Content Carousel in JS
Last active December 21, 2015 09:39
Content Carousel in JS