Skip to content

Instantly share code, notes, and snippets.

View jnwelzel's full-sized avatar
💻
[object Object]

Jonathan Welzel jnwelzel

💻
[object Object]
View GitHub Profile
@jed
jed / LICENSE.txt
Created May 20, 2011 13:27 — forked from 140bytes/LICENSE.txt
generate random UUIDs
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Jed Schmidt <http://jed.is>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@clm-a
clm-a / index-with-fields_for.html.erb
Created March 16, 2011 09:44
Howto : work with index in Rails 3's fields_for
<%= form_for parent do |parent_form_builder| %>
<%= parent_form_builder.text_field :name %>
<% parent.children.each_with_index do |child, index| %>
<% parent_form_builder.fields_for :children, child do |child_form_builder| %>
<%= child_form_builder.select :age, (0..99).to_a %>
<%# generates "parent[:children_attributes][index][age]" as name for the input %>
<% end %>
<% end %>
<%= f.submit %>
<% end %>
var Q = require("q");
exports.read = function (path, timeout) {
var response = Q.defer();
var request = new XMLHttpRequest(); // ActiveX blah blah
request.open("GET", path, true);
request.onreadystatechange = function () {
if (request.readyState === 4) {
if (request.status === 200) {