Skip to content

Instantly share code, notes, and snippets.

View RedWolves's full-sized avatar

Ralph Whitbeck RedWolves

  • Atlassian
  • Rochester, NY
View GitHub Profile
@RedWolves
RedWolves / index.html
Created July 24, 2014 16:32
Angular Controller
<!doctype html>
<html ng-app>
<head>
<title>Angular Example</title>
<script src="angular.js"></script>
<script src="script.js"></script>
</head>
<body ng-controller="MainController">
<h1>{{message}}</h1>
</body>
@RedWolves
RedWolves / gist:4f5355f2492d4690f298
Created July 24, 2014 16:17
Function Abstractions
var work = function () {
console.log("working hard!");
};
var doWork = function(f) {
console.log("starting");
try {
f();
@RedWolves
RedWolves / gist:3835788
Created October 4, 2012 19:17
jquery web templates error
array(17) { ["jquery.com"]=> array(3) { ["blog_id"]=> int(1) ["cookie_domain"]=> string(11) ".jquery.com" ["options"]=> array(3) { ["blogname"]=> string(6) "jQuery" ["stylesheet"]=> string(10) "jquery.com" ["active_plugins"]=> array(1) { [0]=> string(23) "jquery-static-index.php" } } } ["blog.jquery.com"]=> array(3) { ["blog_id"]=> int(2) ["cookie_domain"]=> string(11) ".jquery.com" ["options"]=> array(2) { ["blogname"]=> string(11) "jQuery Blog" ["stylesheet"]=> string(15) "blog-jquery-com" } } ["api.jquery.com"]=> array(3) { ["blog_id"]=> int(3) ["cookie_domain"]=> string(11) ".jquery.com" ["options"]=> array(2) { ["blogname"]=> string(24) "jQuery API Documentation" ["stylesheet"]=> string(14) "api.jquery.com" } } ["plugins.jquery.com"]=> array(3) { ["blog_id"]=> int(4) ["cookie_domain"]=> string(11) ".jquery.com" ["options"]=> array(2) { ["blogname"]=> string(14) "jQuery Plugins" ["stylesheet"]=> string(18) "plugins.jquery.com" } } ["learn.jquery.com"]=> array(3) { ["blog_id"]=> int(5) ["cookie_domain"]=>
@RedWolves
RedWolves / gist:3824059
Created October 2, 2012 23:50
Arduino Blink LED to SOS Morse code
int LED = 13;
int s = 300;
int o = 800;
void setup() {
// put your setup code here, to run once:
pinMode(LED, OUTPUT);
}
void character(int speed) {
@RedWolves
RedWolves / gist:2664255
Created May 12, 2012 05:06
Another implementation to @dieseltravis compare jQuery version strings gist https://gist.github.com/2662417 Demo in comments.
var jQueryVer = {
isEqual: function (test, act) {
this.version = test || this.version;
if (this.version) {
//if actual jquery version is passed in use that if not get it.
act = act || jQuery.fn.jquery;
return this._compare(act);
}
},
//Boolean value on if the actual jQuery Version is greater then the test version.
@RedWolves
RedWolves / uri.js
Created April 22, 2012 22:37 — forked from jlong/uri.js
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@RedWolves
RedWolves / gist:2439790
Created April 21, 2012 21:40
What's the point?
<script src="/static/js/libs/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="/static/js/libs/jquery.min.js"><\/script>')</script>
@RedWolves
RedWolves / gist:2438558
Created April 21, 2012 17:21
Converting function arguments that weren't formally declared to accept into an Array.
// Create a reference to the Array.slice "static" method.
var slice = [].slice;
// call some function with one required argument.
var somefunction = function (requiredArgument) {
// arguments is an Array-like local variable available within all functions.
// arguments refers to the function's arguments within the function, you can use the
// arguments object if you call a function with more arguments than it is formally declared to accept.
// https://developer.mozilla.org/en/JavaScript/Reference/Functions_and_function_scope/arguments
@RedWolves
RedWolves / script.js
Created January 11, 2012 01:04
Yay Contextual
$("#product-links").delegate("a", "click", function(e) {
e.preventDefault();
var $this = $(this),
$id = $($this.attr("href"));
if ($id.is(":not(.ui-dialog)")) {
$id.dialog({
modal: true,
width: 540
});
} else {
@RedWolves
RedWolves / gist:1218298
Created September 15, 2011 01:28
Windows 8 error on initializing Datepicker control
'WWAHost.exe' (Script): Loaded 'Script Code (Windows Internet Explorer)'.
JavaScript runtime error: Unable to add dynamic content. A script attempted to inject dynamic content, or elements previously modified dynamically, that might be unsafe. For example, using the innerHTML property or the document.write method to add a script element will generate this exception. If the content is safe and from a trusted source, use a method to explicitly manipulate elements and attributes, such as createElement, or use msWWA.execUnsafeLocalFunction.