Skip to content

Instantly share code, notes, and snippets.

View ElvisLives's full-sized avatar

Peter S. ElvisLives

  • Location3 Media.
  • Denver
View GitHub Profile
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
public class MappingConventions
{
public static void Initialize()
{
var __conventionPack = new ConventionPack()
{
new IgnoreIfNullConvention(true),
new NamedIdMemberConvention("Id"),
new CamelCaseElementNameConvention(),
new NamedExtraElementsMemberConvention("ExtraElements"),
@ElvisLives
ElvisLives / CsharpAdWordsClientLogin.cs
Created October 14, 2011 18:24
How to get an auth token for accessing the Google adwords api via ClientLogin C# MsTest snippet
using System;
using System.IO;
using System.Net;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Google.ClientLogin.Example
{
[TestClass]
public class CsharpAdWordsClientLogin
@ElvisLives
ElvisLives / GoogleAdwordsAdhocReportingv201109Example.cs
Created October 14, 2011 18:42
An Example of calling the AdHoc reporting of the Google Adwords API v201109
using System;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
/// <summary>
/// Here is an example of calling the AdHoc reporting of the Google Adwords API v201109
/// </summary>
public void GoogleAdwordsv201109_Adhoc_reports_CSharp_Example()
@ElvisLives
ElvisLives / CassetteConfigurationExternalQuerystring
Created May 15, 2012 19:56
How to add a external url javascript resource that uses a querystring in Cassette
using System.Text.RegularExpressions;
using System.Web.Handlers;
using Cassette;
using Cassette.Configuration;
using Cassette.Scripts;
using Cassette.Stylesheets;
namespace SomeCompany.Web
{
/// <summary>
@ElvisLives
ElvisLives / BackgroundWorkerRestartTest.cs
Created May 24, 2012 19:25
How to handle BackgroundWorker restarts on Errors/Exceptions
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace BackgroundWorkerRestart.Tests
{
[TestClass]
public class BackgroundWorkerRestartTest
@ElvisLives
ElvisLives / RavenDbIndexResharper.DotSettings
Created June 11, 2012 18:38
RavenDbIndex Resharper File Template .DotSettings
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4CE831FF9AED4846BFBEB870FD43C301/@KeyIndexDefined">True</s:Boolean>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4CE831FF9AED4846BFBEB870FD43C301/Description/@EntryValue">RavenDB Index</s:String>
<s:String x:Key="/Default/PatternsAndTemplates/LiveTemplates/Template/=4CE831FF9AED4846BFBEB870FD43C301/Text/@EntryValue">using System.Linq;&#xD;
using Raven.Client.Indexes;&#xD;
&#xD;
namespace $Namespace$&#xD;
{&#xD;
public class $ClassName$ : AbstractIndexCreationTask&lt;$ClassIndexFor$, $ClassName$.ReduceResult&gt;&#xD;
{&#xD;
@ElvisLives
ElvisLives / AzureContribFact.cs
Created October 8, 2012 15:42
Figuring Out Azure Contrib
using System;
using AzureContrib.WindowsAzure.StorageClient;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.StorageClient;
using Xunit;
namespace Tests.Azure
{
public class AzureIntegrationTests
{
@ElvisLives
ElvisLives / gist:3988101
Created October 31, 2012 16:32
Testing out dapper against sql azure
using System;
using System.Data.SqlClient;
using System.Linq;
using Dapper;
using Xunit;
namespace Dapper.Testing
{
public class DapperyQueryTest
{
@ElvisLives
ElvisLives / requestHandlers.js
Created November 13, 2012 16:27
A snippet with a windows dir command for people doing www.nodebeginner.org that aren't using cygwin and are running some form of Windows
var exec = require("child_process").exec;
function start(response) {
console.log("Request handler 'start' was called.");
// find all Excel files recursively
exec("dir C:\\ *.xls /s",
{ timeout: 10000, maxBuffer: 20000*1024 },
function (error, stdout, stderr) {
response.writeHead(200, {"Content-Type": "text/plain"});