Skip to content

Instantly share code, notes, and snippets.

View raymyers's full-sized avatar
🌳
Automating!

Ray Myers raymyers

🌳
Automating!
View GitHub Profile
def deep_attributes
self.attributes.merge 'service_appointments_attributes'=>service_appointments.collect{|sa|
sa.attributes.merge 'student_appointments_attributes'=>sa.student_appointments.collect{|std_a|
std_a.attributes.merge 'student_appointment_goals_attributes'=>std_a.student_appointment_goals.collect{|sag|
sag.attributes
}
}
}
end
def deep_attributes
attributes_to_copy(self).merge 'service_appointments_attributes'=>service_appointments.collect{|sa|
attributes_to_copy(sa).merge 'student_appointments_attributes'=>sa.student_appointments.collect{|std_a|
attributes_to_copy(std_a).merge 'student_appointment_goals_attributes'=>std_a.student_appointment_goals.collect{|sag|
attributes_to_copy(sag)
}
}
}
end
package com.cadrlife.util;
/*
* A simple Java class to provide functionality similar to Wget.
*/
import java.io.*;
import java.net.*;
import org.apache.commons.io.IOUtils;
package com.cadrlife;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
public class SampleGet {
public static void main(String[] args) {
final JGet jGet = new JGet();
final LinkedHashMap<String, List<String>> families = new LinkedHashMap<String, List<String>>();
!!! Strict
%html(lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml")
%head
%title Page Title
%meta(http-equiv="Content-Type" content="text/html; charset=UTF-8")
= stylesheet_link_tag :all
= javascript_include_tag :all
= csrf_meta_tag
%style{ :type => "text/css" }
:sass
beans = { // ...
groovyPageResourceLoader(com.cadrlife.jhaml.grailsplugin.HamlGroovyPageResourceLoader) {
baseResource = new org.springframework.core.io.FileSystemResource(".")
}
}
/ Haml
#profile
.left.column
#date= date
#address= user.address
.right.column
#email= user.email
#bio= user.bio
<!-- GSP/JSP -->
<div id="profile">
<div class="left column">
<div id="date"><%= date %></div>
<div id="address"><%= user.address %></div>
</div>
<div class="right column">
<div id="email"><%= user.email %></div>
<div id="bio"><%= user.bio %></div>
</div>
%html
%head
%title Welcome to Grails
%meta(name="layout" content="main")
:css
#nav {
margin-top:20px;
margin-left:30px;
width:228px;
float:left;
#! /usr/bin/env python
import sys
import httplib
from urlparse import urlparse
from time import time
try:
# Python 2.6
import json
except:
# Prior to 2.6 requires simplejson