Skip to content

Instantly share code, notes, and snippets.

View ninnemana's full-sized avatar
🏠

Alex Ninneman ninnemana

🏠
View GitHub Profile
@ninnemana
ninnemana / form-validator.go
Created February 11, 2014 19:58
Uses Gorilla Schema package for form validation
type SetPriceData struct {
CustomerID int `schema:"customerID"`
PartID int `schema:"partID"`
Price float64 `schema:"price"`
IsSale int `schema:"isSale"`
SaleStart string `schema:"sale_start"`
SaleEnd string `schema:"sale_end"`
}
func SetPrice(rw http.ResponseWriter, req *http.Request) {
@ninnemana
ninnemana / widget.html
Created March 6, 2014 19:14
Basic Hitch Widget
<div id="configurator" wiring="true" accessories="true" lookupstyle="alex2" buynow="false"></div>
<script type="text/javascript" src="http://labs.curtmfg.com/widget_v2/hitch-widget_v2.js"></script>
@ninnemana
ninnemana / race.go
Last active August 29, 2015 13:57
Race Condition Problem
func MysqlError(err error) (ret bool) {
ret = (err != nil)
if ret {
log.Println("MySQL error: ", err)
}
return
}
func (v Vehicle) GetVcdbVehicle() (Vehicle, error) {
function Vehicle(id){
this.ID = id || 0;
this.BaseVehicle = {};
this.Submodel = '';
this.SubmodelID = 0;
this.Configurations = [];
this.Bound = false;
this.RegionAbbr = '';
this.Parts = [];
this.Configurations = [];
@ninnemana
ninnemana / shit.go
Created April 21, 2014 16:12
Hate it!
var stmt *thrsafe.Stmt
var err error
switch strings.ToLower(strings.Replace(vc.Type, " ", "", -1)) {
case "abbreviations":
stmt, err = database.GetStatement("vcdb_GetAbbreviations")
break
case "aspiration":
stmt, err = database.GetStatement("vcdb_GetAspiration")
break
case "bedlength":
@ninnemana
ninnemana / index.go
Created July 3, 2014 20:00
Gin Basic main
package main
import (
"flag"
"github.com/gin-gonic/gin"
"log"
"net/http"
"os"
"time"
)
var stmt *thrsafe.Stmt
switch strings.ToLower(strings.Replace(v.Type, " ", "", -1)) {
case "aspiration":
stmt, err = database.GetStatement("vcdb_GetAspiration")
case "bedlength":
stmt, err = database.GetStatement("vcdb_GetBedLength")
case "bedtype":
stmt, err = database.GetStatement("vcdb_GetBedType")
case "bodytype":
stmt, err = database.GetStatement("vcdb_GetBodyType")
@ninnemana
ninnemana / rackwarehouse.html
Created July 29, 2014 14:55
Rack Warehouse Hitch Widget Integration
<div id="configurator" wiring="true" accessories="true" lookupstyle="alex2" buynow="true" checkout="rackwarehouse" customer_id="10598601"></div>
<script type="text/javascript" src="http://labs.curtmfg.com/widget_v2/hitch-widget_v2.js"></script>
cookbook_path ["cookbooks", "site-cookbooks"]
node_path "nodes"
role_path "roles"
environment_path "environments"
data_bag_path "data_bags"
#encrypted_data_bag_secret "data_bag_key"
knife[:berkshelf_path] = "cookbooks"
@ninnemana
ninnemana / index.html
Created August 27, 2014 19:03
ADH Inc Hitch Widget
<div id="configurator" wiring="true" accessories="true" lookupstyle="alex2" buynow="true" checkout="paypal" customer_email="adhinc1@gmail.com" merchant_id="adhinc1@gmail.com" customer_id="10282801"></div>
<script type="text/javascript" src="http://labs.curtmfg.com/widget_v2/hitch-widget_v2.js"></script>