Skip to content

Instantly share code, notes, and snippets.

View standingwave's full-sized avatar

Gabriel Williams standingwave

  • Self Employed
  • San Francisco, CA
View GitHub Profile
### Keybase proof
I hereby claim:
* I am standingwave on github.
* I am standingwave (https://keybase.io/standingwave) on keybase.
* I have a public key whose fingerprint is 7DB1 F0DC A051 D82A B421 2195 ABCC 0EA9 ED26 C00C
To claim this, I am signing this object:
- base_view: assessments
joins:
- join: users
foreign_key: user_id
- join: course_registrations
foreign_key: course_registration_id
- join: course_prototypes
foreign_key: ${course_registrations.course_prototype_id}
- base_view: course_registrations
joins:
- join: users
foreign_key: user_id
joins:
- join: course_prototypes
foreign_key: course_prototype_id
@standingwave
standingwave / gist:3930001
Created October 22, 2012 06:41
convert xml to json
function xmlToJson(xml_string) {
var json = {};
if(xml_string.nodeType == 1) { // element
// do attributes
if(xml_string.attributes.length > 0) {
json["@attributes"] = {};
for (var j = 0; j < xml_string.attributes.length; j++) {
var attribute = xml_string.attributes.item(j);
json["@attributes"][attribute.nodeName] = attribute.nodeValue;
@standingwave
standingwave / gist:1335986
Created November 3, 2011 07:44
Article text and images
<div class='article-text'>
<img src='/images/image1.png' class="imageTwoClass" style="float:left;">
<img src='/images/image2.png' class="imageOneClass" style="float:right;">
<p>Who knows, it might even work.</p>
<p>Some more text for this article.</p>
<p>This is a third paragraph.</p>
</div>
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just
// put a "data-behaviors" attribute on your view elements, and then assign callbacks
// for those named behaviors via Behaviors.add.
var Behaviors = {
add: function(trigger, behavior, handler) {
document.observe(trigger, function(event) {
var element = event.findElement("*[data-behaviors~=" + behavior + "]");
if (element) handler(element, event);
});
zip -vr filename dir/ -x "*.DS_Store" "*.git/*"