Skip to content

Instantly share code, notes, and snippets.

View beccasaurus's full-sized avatar

Rebecca Taylor beccasaurus

View GitHub Profile
@beccasaurus
beccasaurus / README.markdown
Created May 5, 2011 19:37
Adds hooks to jQuery.validate's form/element validation methods (via trigger())

jQuery Validate Hooks

If you're using [ASP.NET MVC3][], it uses [jQuery Validate][] to do client-side validations. Instead of using [jQuery Validate][] directly, however, it wraps it with its own jQuery plugin called [jQuery.Validate.Unobtrusive][]. [jQuery.Validate.Unobtrusive][] sets up [jQuery Validate][] for you, behind the scenes, so you don't have an opportunity to customize your [jQuery Validate][] settings at all!

We've been running into trouble with this when we've been doing our own custom client-side validations. We need a way to integrate with the build-in [ASP.NET MVC3][] validation so we can:

@beccasaurus
beccasaurus / README.markdown
Created March 21, 2011 22:17
MSBuild equivalent of Visual Studio "Publish"

Publish via MSBuild

Note: the publish-via-msbuild.bat shown here simply builds the site and drops it into a directory, transforming the Web.configs

It does NOT sync the directory in any meaningful way.

To do that, I recommend using a tool like Rsync or MSDeploy

MSDeploy example:

@beccasaurus
beccasaurus / . 🔥💋 OkCupid "Who Likes You" Extension .md
Last active May 1, 2024 20:40
🔥💋 OkCupid "Who Likes You" Extension

💘 OkCupid "Who Likes You" Extension


Yes, I did.

The Who Likes You page SUCKS to manage.

@beccasaurus
beccasaurus / : Reading Mech data from MegaMek.md
Last active April 5, 2023 18:33
Reading Mech data from MegaMek

Reading Mech data from MegaMek

MegaMek is licensed under the GNU General Public License v2.0

Therefore, this code is also licensed under GPLv2

The BattleTech IP is owned by The Topps Company, Inc and is licensed by Catalyst Game Labs.
The main website for BattleTech is here - BattleTech: The Board Game of Armored Combat

The MegaMek/megamek repository contains thousands of .mtf files containing definitions for BattleTech mechs and their information, e.g. this file defining the [Marauder 3R](https://github.com/MegaMek/megamek/blob/master/megamek/data/mechfi

@beccasaurus
beccasaurus / goto-branch.sh
Last active January 5, 2023 15:34
Quick hack for checkout git branches into different directories (for when I'm actively working on different branches and want different working directories)
# Working on lots of different branches of different repos
# has been a pain lately, especially when trying to address
# issues in multiple branches at once.
GOTO_BRANCH_DIR="$HOME/.goto-branch"
GOTO_BRANCH_REPOS="$GOTO_BRANCH_DIR/repos"
GOTO_BRANCH_BRANCHES="$GOTO_BRANCH_DIR/branches"
_goto-branch_usage() {
echo "Usage: goto-branch repo-name [branch-name | master]"
@beccasaurus
beccasaurus / define_function.rb
Created August 12, 2011 22:25
Capybara helper for defining a JavaScript function in a page (globally, attached to window)
# Given the name and body for a JavaScript function, this defines the
# function globally in the page.
#
# This is most useful for making helper JavaScript functions that you can
# call later, eg. foo = evaluate_script('myFunction()')
#
# Usage:
#
# page.define_function :whatever, %{
# var foo = 'hello';
@beccasaurus
beccasaurus / Gemfile
Created June 19, 2012 15:54
Double checking that Capybara's RSpec matchers work as advertised
source :rubygems
# Locking these to the exact versions used in a project I'm working on (experimenting)
gem "rspec", "2.10.0"
gem "capybara", "1.1.2"
gem "selenium-webdriver", "2.22.2"
@beccasaurus
beccasaurus / README.markdown
Created April 19, 2011 17:50
Without this, returning a 400 gives you just "Bad Request" ... with this, you can return a custom response

If you don't have the XML snippet below in your Web.config and your .NET app tries to return a 400 with custom data, you get this:

HTTP/1.1 400 Bad Request
Cache-Control: private
Content-Type: text/html
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET

Date: Tue, 19 Apr 2011 17:47:46 GMT

@beccasaurus
beccasaurus / contenteditable.html
Created June 25, 2012 06:39
Playing around with contenteditable=true
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
function write() {
var $out = $("#output");
$out.text($out.text() + "\n" + JSON.stringify(arguments));
}
@beccasaurus
beccasaurus / Get STDOUT and STDERR in Separate Variables.sh
Last active May 7, 2021 18:24
Get STDOUT and STDERR in Separate Variables
#! /usr/bin/env bash
foo() {
echo "STDOUT contents (called with args $*)"
echo "STDERR contents (called with args $*)" >&2
return 42
}
printOutBothStdoutAndStderrSeparately() {
echo "$({