Skip to content

Instantly share code, notes, and snippets.

View ninnemana's full-sized avatar
🏠

Alex Ninneman ninnemana

🏠
View GitHub Profile
@ninnemana
ninnemana / gist:1452609
Created December 9, 2011 17:58
Get A CURT Images
var result = XDocument.Load("http://docs.curthitch.biz/API/GetPart?partID=11000").Descendants().Descendants("Images").Where(x => x.Name.Equals("a")).ToList();
result.Dump();
@ninnemana
ninnemana / PartListAdapter.java
Created April 11, 2012 22:08
Custom ArrayAdapter
/**
*
*/
package curt.android.ginger.Part;
import java.util.Iterator;
import java.util.List;
import android.app.Activity;
import android.graphics.Typeface;
package hello
import (
"html/template"
"net/http"
"fmt"
)
func init() {
http.HandleFunc("/", hello)
@ninnemana
ninnemana / index.go
Created July 5, 2012 19:23
Testing out the encoding/csv package in golang
package main
import (
"encoding/csv"
"net/http"
"html/template"
"fmt"
"strconv"
)
@ninnemana
ninnemana / gist:3341096
Created August 13, 2012 14:11
Display Multiple HTML files
func (t Template) DisplayMultiple(templates []string) {
if t.Layout == "" {
t.Layout = "layout.html"
}
log.Println(templates)
if t.Bag == nil {
t.Bag = make(map[string]interface{})
}
templ := template.Must(template.ParseFiles(t.Layout))
{{with .Homepage}}
{{template "content" .}}
{{else}}
{{with .Sidebar}}
<div class="span2 sidebar well">
{{template "sidebar" .}}
</div>
<div class="span10 well">
{{else}}
<div class="span12 well">
@ninnemana
ninnemana / main.cs
Created August 30, 2012 14:19
Enum Casting from Form field
public class IndexController : Controller {
public void Index() {
string form_value = "Change";
Item i = new Item();
i.MaterialCode = (MatCode)Enum.Parse(typeof(MatCode), form_value);
}
}
public class Item {
public MatCode MaterialCode = new MatCode();
@ninnemana
ninnemana / wget.sh
Created August 30, 2012 15:32
hitchinfo.com clone using wget
wget --recursive --page-requisites --html-extension --convert-links --domains hitchinfo.com --restrict-file-names=windows --no-clobber www.hitchinfo.com
@ninnemana
ninnemana / export.go
Created September 5, 2012 22:24
CSV Export
prices, _ := pricing.Get(r)
var buf bytes.Buffer
buf.WriteString("CURT Part ID,Customer Part ID, Price, Sale Start, Sale End\n")
for i := 0; i < len(prices)-1; i++ {
price := prices[i]
var priceBuf bytes.Buffer
priceBuf.WriteString(strconv.Itoa(price.PartID))
priceBuf.WriteByte(',')
@ninnemana
ninnemana / Global.asax.cs
Created September 13, 2012 15:27
Extended JsonMediaTypeFormatter to Support JSONP
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
namespace API {