Skip to content

Instantly share code, notes, and snippets.

View walterg2's full-sized avatar

George T Walters II walterg2

View GitHub Profile
@walterg2
walterg2 / jsApply.html
Created September 2, 2011 15:24
Quick Example of a good use of JavaScript's apply function
<!doctype html>
<html>
<head>
</head>
<body>
<h1>Apply Test</h1>
<p>Click the Next and Back buttons or use your arrow keys to see your counter go up and down.</p>
<div id="counter"></div>
<form action="#">
<input type="button" name="next" value="Next" id="next" />
@walterg2
walterg2 / structure.html.erb
Created April 24, 2012 15:56
Hash won't work in option_from_collection_for_select
<%= form_for(@structure) do |f| %>
<%= f.select :structural_material, options_from_collection_for_select(@materials, :material, :material), :prompt => "Select" %>
<% end %>
@walterg2
walterg2 / Character.js
Created June 13, 2012 11:51
Issue when attempting to initialize a Backbone model with invalid data
/*jslint nomen: true, regexp: true */
/*globals window, document, Backbone, _ */
var Character = Backbone.Model.extend({
alignments: {
"Evil": "Evil",
"Neutral": "Neutral",
"Good": "Good"
},
validate: function (attrs) {
@walterg2
walterg2 / main.less
Created March 11, 2013 18:29
What is the proper way to import Bootstrap LESS files to use as mixins for project? I have this so far, but it's including the buttons.less file in my output CSS. Using: lesscss-maven-plugin, spring web
// Core variables and mixins
@import "bootstrap/variables"; // Modify this for custom colors, font-sizes, etc
@import "bootstrap/mixins";
// CSS Reset
@import "bootstrap/reset";
// CSS Buttons - Want to use these as mixins, not styles...
@import "bootstrap/buttons";
@walterg2
walterg2 / HomePage.groovy
Created March 27, 2013 13:33
CucmberJVM, SeleniumWebDriver, HTMLUnit, Geb issue: AJAX call firing when page loads is not able to be validated by script. As far as I'm aware, this should workas I'm waiting for the page to get the loanInformation object to be present
com.temp.myApp.cucumber.pages
import geb.Page
class HomePage extends Page {
static url = ""
static at = { title == "Home" }
static content = {
mainHeading { $('h1') }
loanInformation(required: false) { $('dl', 0) }
@walterg2
walterg2 / keybase.md
Created May 15, 2014 11:49
Keybase Identity

Keybase proof

I hereby claim:

  • I am walterg2 on github.
  • I am walterg2 (https://keybase.io/walterg2) on keybase.
  • I have a public key whose fingerprint is 19AE 555C 4947 EE8F 4EBC 03A4 9BC9 AD04 70CF 859B

To claim this, I am signing this object:

@walterg2
walterg2 / info.md
Last active August 29, 2015 14:16
How do you mock out the HTTP Backend that is called from a service, but responses are used inside a controller in Angular

Problem

Want to create a service that holds all of our HTTP calls, but to test the controller that is using that service, how do we allow the ability to pass through to the real service, but mock out the HTTP calls to the server?

@walterg2
walterg2 / currentState.js
Last active August 29, 2015 14:17
Angular JS Directive for Event Delegation
;
var Northwoods = Northwoods || {};
Northwoods.Directives = Northwoods.Directives || {};
Northwoods.Directives.FocusableForm = function ($animate, $timeout) {
return {
restrict: 'A',
link: function (scope, element) {
var FOCUSED_CLASS = 'focused',
elements = element.find('input');