Skip to content

Instantly share code, notes, and snippets.

@jonezy
jonezy / gist:c1d3b6d7c3d1415486f7
Created August 6, 2015 18:43
webrequest without 403
HttpWebRequest request = (HttpWebRequest) WebRequest.Create("http://www.the416.net/416/?format=rss");
request.UserAgent = "My Test Application";
using(var response = request.GetResponse()) {
using(var dataStream = response.GetResponseStream()) {
using(var reader = new StreamReader(dataStream)) {
var data = reader.ReadToEnd();
Console.Write(data) ;
}
}
}
db.XIgniteCompanies.aggregate(
{ $group: {
// Group by fields to match on (a,b)
_id: { a: "$Symbol", b:"$Exchange"},
// Count number of matching docs for the group
count: { $sum: 1 },
// Save the _id for matching docs
docs: { $push: "$_id" }
@jonezy
jonezy / timing_info_query.sql
Last active August 29, 2015 14:20
Query for timing info records
select * from Log
where ApplicationName != 'Q4Go'
and SUBSTRING([Message], 0, 14) = '[TIMING INFO]'
order by Date desc
----
select * from Log
--where ApplicationName != 'Q4Go'
--and SUBSTRING([Message], 0, 14) = '[TIMING INFO]'
@jonezy
jonezy / config-transformations
Last active August 29, 2015 14:07
Web Config Transform Snippets
----
This portion goes closer to the top, again valid for web.config based projects
----
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Trunk-Release|AnyCPU'">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Test-Release|AnyCPU'">
<OutputPath>bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Dev-Debug|AnyCPU'">
if(doc.Url !== '') {
switch(doc.DocumentType) {
case "PDF":
case "CONVPDF":
documentsArr.push('<li class="IconLink PdfIcon" rel="2"><a target="_blank" href="'+doc.Url+'"><img alt="PDF" src="/files/design/icon-pdf.png"></a></li>');
break;
case "RTF":
documentsArr.push('<li class="IconLink WordIcon" rel="0"><a target="_blank" href="'+doc.Url+'"><img alt="RTF" src="/files/design/icon-doc.png"></a></li>');
break;
case "XLS":
SELECT u.FirstName, u.LastName, u.Email, c.Vehicle, c.Step,c.Colour,c.Roof,c.Stripe,c.Interior,c.Packages,c.Colourline,c.Wheel,c.Trim,c.Options,c.OptionsPrice, c.ConfiguredPrice, c.ProvinceConfigured, c.CreatedOn
FROM Configurations c
JOIN [User] u on c.UserID = u.UserID
where c.UserID != '99999999-9999-9999-9999-999999999999'
order by c.CreatedOn DESC
@jonezy
jonezy / default.html
Created November 22, 2013 14:45
absolute basic starting point for html.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
@jonezy
jonezy / js-module-template
Created November 19, 2013 19:18
Boilerplate for JS module development.
(function() {
var root = this;
var MyLibrary = root.MyLibrary = {};
MyLibrary.version = '0.0.0';
var MyMethod = MyLibrary.MyMethod = function(options) {
this.options = options;
this.initialize.apply(this);
@jonezy
jonezy / update_cacodes.sql
Created August 2, 2013 17:31
update mini ca codes
UPDATE TableName
SET CACode = REPLACE(CACode, SUBSTRING(CACode, 1, 2), '14')
@jonezy
jonezy / keys
Created June 4, 2013 14:53
dev mini.ca api keys
OTk5OTk5OTk5OQ==