Skip to content

Instantly share code, notes, and snippets.

View thePunderWoman's full-sized avatar

Jessica Janiuk thePunderWoman

View GitHub Profile
@thePunderWoman
thePunderWoman / AcesValidation.cs
Last active December 19, 2015 21:58
Validate Steering Configuration
if(AcesNodes.Contains("BodyType") || AcesNodes.Contains("BodyNumDoors")) {
int BodyTypeID = configs.Where(x => x.ConfigAttributeType.AcesType.name.Equals("BodyType")).Select(x => x.vcdbID).FirstOrDefault() ?? 0;
int BodyNumDoorsID = configs.Where(x => x.ConfigAttributeType.AcesType.name.Equals("BodyNumDoors")).Select(x => x.vcdbID).FirstOrDefault() ?? 0;
predicate = predicate.And(p => p.VehicleToBodyStyleConfigs.Any(y => ((BodyTypeID > 0) ? y.BodyStyleConfig.BodyTypeID.Equals(BodyTypeID) : true) && ((BodyNumDoorsID > 0 ) ? y.BodyStyleConfig.BodyNumDoorsID.Equals(BodyNumDoorsID) : true)));
}
if(AcesNodes.Contains("WheelBase")) {
int WheelBaseID = configs.Where(x => x.ConfigAttributeType.AcesType.name.Equals("WheelBase")).Select(x => x.vcdbID).FirstOrDefault() ?? 0;
predicate = predicate.And(p => p.VehicleToWheelbases.Any(y => y.WheelbaseID.Equals(WheelBaseID)));
}
if (AcesNodes.Contains("DriveType")) {
@thePunderWoman
thePunderWoman / gist:6021713
Created July 17, 2013 15:36
AddThis to block ie8
<!-- AddThis Button BEGIN -->
<div class="addthis_toolbox addthis_default_style addthis_32x32_style">
<a class="addthis_button_email"></a>
<a class="addthis_button_facebook"></a>
<a class="addthis_button_twitter"></a>
<a class="addthis_button_google_plusone_share"></a>
<a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a>
</div>
<script>
function loadScript(url, callback) {
@thePunderWoman
thePunderWoman / gist:5913262
Created July 2, 2013 21:21
All vehicles and their count of t-connectors
select Y.year, M.make, MO.model, S.style,
(SELECT COUNT(*)
FROM VehiclePart VP
INNER JOIN Part P ON VP.partID = P.partID
WHERE VP.vehicleID = V.vehicleID AND P.classID = 11) AS tconnectors
from Vehicle V
INNER JOIN Year Y on V.yearID = Y.yearID
INNER JOIN Make M on V.makeID = M.makeID
INNER JOIN Model MO on V.modelID = MO.modelID
INNER JOIN Style S on V.styleID = S.styleID
WITH BULLETSQRY(partID, text, BulletCount) as (
SELECT
CB.partID, text, COUNT(*) AS BulletCount
FROM
Content C
INNER JOIN ContentBridge CB ON C.contentID = CB.contentID
WHERE cTypeID = 2 AND CB.partID = 11000
GROUP BY
CB.partID, text
HAVING COUNT(*) > 1
@thePunderWoman
thePunderWoman / Pricing.cs
Created June 11, 2013 16:35
Update to Set Pricing
public SimplePricing Set(string key) {
Authenticate(key);
CurtDevDataContext db = new CurtDevDataContext();
// Validate required fields
if (this.price == 0) { throw new Exception("Price failed to validate against null or zero."); }
if (this.partID == 0) { throw new Exception("Part Number failed to validate against null or zero."); }
if (this.isSale == 1) {
if (this.sale_start == null || this.sale_start < DateTime.Today.AddDays(-1)) { throw new Exception("If record is going to marked as sale, sale start is required and cannot be in the past."); }
if (this.sale_end == null || this.sale_end < DateTime.Now || this.sale_end <= this.sale_start) { throw new Exception("If record is going to marked as sale, sale end is required, cannot be in the past, and cannot be sooner or equal to the sale start."); }
@thePunderWoman
thePunderWoman / gist:5729389
Created June 7, 2013 13:47
Linkable Setting image
@if (settings.Get("FreeShippingBanner") != "") {
if (settings.Get("FreeShippingLink") != "") {
<a href="@settings.Get("FreeShippingLink")"><img src="@settings.Get("FreeShippingBanner")" alt="Free Shipping" /></a>
} else {
<img src="@settings.Get("FreeShippingBanner")" alt="Free Shipping" />
}
}
<div class="social_links">
@if (!String.IsNullOrEmpty(settings.Get("FacebookPageURL"))) {
<a href="@settings.Get("FacebookPageURL")" title="@settings.Get("SiteName") on Facebook">
<img src="/Content/img/footer/facebook_dark.png" alt="@settings.Get("SiteName") on Facebook" class="dark fb" />
<img src="/Content/img/footer/facebook_active.png" alt="@settings.Get("SiteName") on Facebook" class="active fb" />
</a>
}
@if (!String.IsNullOrEmpty(settings.Get("TwitterPageURL"))) {
<a href="@settings.Get("TwitterPageURL")" title="@settings.Get("SiteName") on Twitter">
<img src="/Content/img/footer/twitter_dark.png" alt="@settings.Get("SiteName") on Twitter" class="dark tweet" />
@thePunderWoman
thePunderWoman / Fixed.go
Created May 9, 2013 16:24
Duplicate entry issue
func SaveLogs(logs []History) {
for i, _ := range logs {
go logs[i].Save()
}
}
Jessicas-MacBook-Pro:SiteMonitor janiukjf$ cap deploy
* 2013-05-09 09:27:46 executing `deploy'
* 2013-05-09 09:27:46 executing `deploy:update'
** transaction: start
* 2013-05-09 09:27:46 executing `deploy:update_code'
updating the cached checkout on all servers
executing locally: "git ls-remote [email protected]:curt-labs/SiteMonitor.git HEAD"
command finished in 1736ms
* executing "if [ -d /home/deployer/SiteMonitor/shared/cached-copy ]; then cd /home/deployer/SiteMonitor/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard 5b3f5da6b0772ffc0a93cae72d31cdbc18d43d7d && git clean -q -d -x -f; else git clone -q [email protected]:curt-labs/SiteMonitor.git /home/deployer/SiteMonitor/shared/cached-copy && cd /home/deployer/SiteMonitor/shared/cached-copy && git checkout -q -b deploy 5b3f5da6b0772ffc0a93cae72d31cdbc18d43d7d; fi"
servers: ["curt-api-server1.cloudapp.net", "curt-api-server2.cloudapp.net"]
func Index(w http.ResponseWriter, r *http.Request) {
tmpl := plate.NewTemplate(w)
tmpl.ParseFile("templates/index.html", false)
err := tmpl.Display(w)
if err != nil {
log.Println(err)
}