Skip to content

Instantly share code, notes, and snippets.

View cori's full-sized avatar
🏠
Scruggs!

cori schlegel cori

🏠
Scruggs!
View GitHub Profile
@cori
cori / .bashrc
Created October 1, 2010 13:53 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@cori
cori / gist:672685
Created November 11, 2010 16:05
C# String extension method implementing VB's Like() method (shamelessly cribbed from http://www.vbusers.com/codecsharp/codeget.asp?ThreadID=25)
using System;
using System.Text.RegularExpressions;
namespace ETC.Helpers
{
public static class StringExtensions
{
/// <summary>
/// Indicates whether the regular expression specified in "pattern" could be found in the "text".
@cori
cori / unescape-bookmarklet.js
Created May 26, 2011 13:27
expanded bookmarklet code to unescape selected text or text provided in a prompt
sel= function (){
if (window.getSelection){
return window.getSelection();
}else if (document.getSelection){
return document.getSelection();
}else if (document.selection){
return document.selection.createRange().text;
}else return;
};
if (sel()!=""){
@cori
cori / guid_window.js
Created May 26, 2011 19:52 — forked from strobemonkey/guid.js
gimme a guid (popup)
var guid = function(){
return 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'.replace(/[x]/g, function(c) {
var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
return v.toString(16);
}).toUpperCase();
};
var nil=prompt("Here's your GUID",guid());
@cori
cori / custom_hook_client.php
Created October 8, 2011 13:55
Wordpress Custom hook problem
class hook_client {
static function start() {
//logging here shows that this function is being called
add_filter('custom_filter', array(__CLASS__, 'filter_handler'), 1, 2 );
//logging here shows that the custom_filter hook is being hooked to
}
static function filter_handler($content, $postdata) {
@cori
cori / SciTE.properties
Created September 26, 2012 11:27
site properties for output of javascript console.log() calls to scite output window
# from http://blog.scriptoid.com/2010/07/run-javascript-from-scite.html and http://blog.dotsmart.net/2007/12/19/editing-and-testing-scripts-in-scite/ via http://stackoverflow.com/questions/11053560/testing-and-editing-javascript-both-standalone-and-in-html-in-scite
# *.vbs files
command.go.$(file.patterns.wscript)=cscript.exe //nologo "$(FilePath)"
command.go.subsystem.$(file.patterns.wscript)=0
# *.js files
# path to jrunscript from jdk
command.go.*.js=D:\Program Files\Java\jdk1.7.0_07\bin\jrunscript $(FileNameExt)
#command.go.*.js=cscript.exe //nologo "$(FilePath)"
@cori
cori / gist:3946687
Created October 24, 2012 15:15
Stack trace for Selenium WebDriver CssSelector rejecting attribute values that start with a number
at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByCssSelector(String cssSelector)
at OpenQA.Selenium.By.<>c__DisplayClass1e.<CssSelector>b__1c(ISearchContext context)
at OpenQA.Selenium.By.FindElement(ISearchContext context)
at OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
at SeleniumTests.IWebDriverExtensions.IsElementPresent(IWebDriver driver, By by)
@cori
cori / gist:4594041
Last active December 11, 2015 11:28
handlebars checkbox group output and plain old tml test page for webshims, checkValidity
<!-- from handle bars -->
<form id="captionProviderTemplateAddEditForm" method="POST" action="">
<div id="CaptionFormats" class="control-group">
<label class="control-label">Supported Caption Formats</label>
<div class="SupportedCaptionFormats controls">
<label for="CaptionFormat1" class="checkbox">DFXP</label>
<input type="checkbox" id="CaptionFormat1" name="supportedCaptionFormats" value="1" class="group-required">
<label for="CaptionFormat2" class="checkbox">SRT</label>
<input type="checkbox" id="CaptionFormat2" name="supportedCaptionFormats" value="2" class="group-required">
<label for="CaptionFormat4" class="checkbox">SMI</label>
@cori
cori / gist:5272971
Last active December 15, 2015 14:18
Subscribe on NewsBlur
javascript:var nbsub = function(){var d = document;var url=d.location;var nb_url='http://www.newsblur.com/?url=';window.location=nb_url+encodeURIComponent(url)}();nbsub();
@cori
cori / gist:11399172
Created April 29, 2014 12:44
keybase.io verification
### Keybase proof
I hereby claim:
* I am cori on github.
* I am cori (https://keybase.io/cori) on keybase.
* I have a public key whose fingerprint is E845 3AB2 FB9A 1269 C930 16ED 2132 FF07 6906 A448
To claim this, I am signing this object: