Skip to content

Instantly share code, notes, and snippets.

/*
To avoid polluting the global namespace this uses an anonymous
function which is called with either the URL for an external
JavaScript file or a function. In either case jQuery will be loaded
from the Google CDN before your code is executed so it's free to
depend on jQuery without checking for it and can do things like
jQuery.getScript() to load other components (e.g. jQuery UI),
stylesheets, etc.
*/
(function (target, msg) {
GIT CHEAT SHEET
git status -
A view of what you're working on. Shows whats files staged to checkin, and whats not yet been staged.
gitk / menu option "start gui" -
A graphical UI for reviewing current changes and staging them for checkin
git diff
Shows changes between current source tree and what is staged for commit
# Git functions
# Mark Embling (http://www.markembling.info/)
# Is the current directory a git repository/working copy?
function isCurrentDirectoryGitRepository {
if ((Test-Path ".git") -eq $TRUE) {
return $TRUE
}
# Test within parent dirs
Writing blocks of code:
${EXPR} => write result of expression as encoded string
!{EXPR} => write result of expression as unencoded string
[[,]] => <, > (when in a codeblock outside a string literal, used for generics)
'string' => "string" (when in a codeblock)
<use namespace="..."/>
Manipulating variables:
@fschwiet
fschwiet / consolechanges.mkd
Created February 23, 2011 04:49
nunit console changes for fixture failures

First let me state the changes are console only, I think the GUI behavior is intuitive.

NUnit-console's return values are to be changed.

existing return codes:

	public static readonly int OK = 0;
	public static readonly int INVALID_ARG = -1;
	public static readonly int FILE_NOT_FOUND = -2;

public static readonly int FIXTURE_NOT_FOUND = -3;

public class ProductExtender : AbstractOperation
{
private IDocumentStore _store;
private Type _type;
private Dictionary<string, string> _fields;
public ProductExtender(IDocumentStore store, Type type, Dictionary<string, string> fields)
{
_store = store;
_type = type;
@fschwiet
fschwiet / gist:1075367
Created July 11, 2011 05:58
Microsoft.IIS.PowerShell.Framework.INamespaceNode
namespace Microsoft.IIS.PowerShell.Framework {
public interface INamespaceNode
{
// Methods
bool AddProperty(string propertyName, string propertyType, object index, bool force, object value);
void ClearData(ServerManager sm);
bool ClearProperty(Collection<string> propertyToClear);
PSObject GetProperty(Collection<string> providerSpecificPickList, object atIndex);
bool RemoveProperty(string propertyName, object index);
@fschwiet
fschwiet / gist:1172142
Created August 25, 2011 22:12
learned something C# & new today
public class Class1 : IEnumerable
{
public void can_use_creation_shorthand_with_arbitrary_class_supporting_Add()
{
var hmm = new Class1()
{
{1,2},
{3,4}
};
}
@fschwiet
fschwiet / gist:1302170
Created October 20, 2011 20:01
install IIS via powershell
#
# http://technet.microsoft.com/en-us/library/cc722041%28v=WS.10%29.aspx
#
# Feature names are case-sensitive, and you will get no warnings if you mispell a feature or
# do not include prerequisite features first. Proceed with care.
#
function InstallFeature($name) {
cmd /c "ocsetup $name /passive"
@fschwiet
fschwiet / gist:1324940
Created October 29, 2011 19:04
an interesting bit of code. An http endpoint as minified resources main.js, main.test.js, main.css, main.ie.css, main.print.css.
public class StaticResources : NancyModule, IResourceBundler
{
public StaticResources()
{
this.isAvailableAt("cdn/");
this.includesFiles(
@"lib\jquery",
@"lib\jquery-ui-1.8.16\jquery.ui.core.js",
@"lib\jquery-ui-1.8.16\jquery.ui.widget.js",