Skip to content

Instantly share code, notes, and snippets.

@nimacks
nimacks / queryStringsInJavascript
Created May 30, 2014 04:54
How to retrieve query string values in javascript
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));}
Usage:
var prodId = getParameterByName('prodId');
public static class ObjectExtensions
{
/// <summary>
/// Acts as a null dereference operator
/// </summary>
/// <typeparam name=”T”> Type of Object for null check</typeparam>
/// <typeparam name=”TResult”> resulting type of the expression</typeparam>
/// <param name=”item”> Object to check for null on </param>
/// <param name=”deriver”> delegate to return result</param>
/// <returns></returns>
@nimacks
nimacks / gist:7253276
Created October 31, 2013 17:04
AWS S3 Service Wrapper
using System.Collections.Generic;
using System.Diagnostics;
using Amazon;
using Amazon.S3;
using Amazon.S3.Model;
namespace S3Navigator.AWS
{
public class AwsService
{
private readonly AmazonS3 _client;