Skip to content

Instantly share code, notes, and snippets.

@staxmanade
staxmanade / downloadableGitHubFiles.js
Created February 21, 2014 22:41
downloadable github files
/*
*
* The hope was to be able to drag out of the browser files from github onto the file system.
* I thought I saw the prototype work correctly once, but can't get it working anymore :(
*
*
*
*
* License: Make It Work: ( someone help me make this work )
*
<html dir="<$BlogLanguageDirection$>">
<head>
<title>301 Moved Permanently</title>
<noscript>
<ItemPage><Blogger><meta http-equiv="refresh" content="0,url=http://staxmanade.com/blog/<$BlogItemNumber$>"></Blogger></ItemPage>
<MainOrArchivePage><meta http-equiv="refresh" content="0,url=http://staxmanade.com"></MainOrArchivePage>
</noscript>
<script type="text/javascript">
document.location.href = '<ItemPage><Blogger>http://staxmanade.com/blog/<$BlogItemNumber$></Blogger></ItemPage><MainOrArchivePage>http://staxmanade.com</MainOrArchivePage>';
</script>
{% assign series = '' %}
{% assign thisPost = nil %}
{% for post in site.posts %}
{% if post.url == page.url %}
{% assign series = post.series %}
{% assign thisPost = post %}
{% endif %}
{% endfor %}
{% assign count = '0' %}
@staxmanade
staxmanade / forEach.js
Last active August 29, 2015 14:12
forEach implementation on the JavaScript Object
Object.prototype.forEach = function(callback) {
var key = 0;
for (key in this) {
if (this.hasOwnProperty(key)) {
if (callback.call(this, key, this[key]) === false) {
break;
}
}
}
return this;
@staxmanade
staxmanade / UIImage+FailFast.h
Created February 12, 2015 17:01
Fail Fast and assert when [UIImage imageNamed:name] cannot load an image
//
// UIImage+FailFast.h
//
// Created by Jason Jarrett on 2/11/15.
// Copyright (c) 2015 Jason Jarrett. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (FailFast)
[TestFixture]
public class InheritedFixture
{
protected int _setupValue;
[SetUp]
public void ShouldNotRun()
{
_setupValue = 10;
}
@staxmanade
staxmanade / gist:750864
Created December 22, 2010 00:16
RadDocumentViewerViewModel
Public Class RadDocumentViewerViewModel
Private pdfWebControl As PdfWebControl
Property ControlID As String = Guid.NewGuid.ToString().Replace("-", "")
Property DocumentKey As String
Sub New(ByVal specialDocumentKey As String, ByVal documentName As Func(Of String), ByVal fileContents As Func(Of Byte()))
pdfWebControl = New PdfWebControl()
@staxmanade
staxmanade / gist:750881
Created December 22, 2010 00:27
RadDocumentViewerViewModel view
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl(Of RadDocumentViewerViewModel)" %>
<div id="rad_document_viewer_container" style="height:100%;">
<iframe src="<%= Model.IFrameSrc %>" id="<%= Model.ControlID %>" frameborder="0" style="height:100%; width:100%; border: 0px none rgb(255, 255, 255);"></iframe>
</div>
@staxmanade
staxmanade / gist:1059430
Created July 1, 2011 21:26
Pseudo code I think could be used to leverage StatLight.Core
using System;
using System.Collections.ObjectModel;
using StatLight.Client.Harness.Events;
using StatLight.Core.Common;
using StatLight.Core.Configuration;
using StatLight.Core.Events;
using StatLight.Core.Events.Aggregation;
using StatLight.Core.Reporting;
using StatLight.Core.Runners;
using StatLight.Core.WebBrowser;
@staxmanade
staxmanade / gist:1180060
Created August 30, 2011 02:57
Fun(for a 4yr old) - little powershell speak what you type (
function Start-The-Fun()
{
$voice = new-object -com SAPI.SpVoice;
while($true)
{
write-host "->" -NoNewLine;
$msg = read-host;
$Voice.Speak( $msg, 1 ) | out-null;
}