Skip to content

Instantly share code, notes, and snippets.

j = JournalEntry.new(MyModel) # => create dir: `/myrepo/_journal/$TIMESTAMP.$USEC`
j.write('myfile.txt' => 'contents') # => creates changes.zip
j.delete('oldfile.txt') # => creates deletes.txt
j.close # => rename `/myrepo/_journal/$TIMESTAMP.$USEC` to `/myrepo/_journal/$TIMESTAMP.$USEC.MyModel`
# latest at: http://gist.github.com/3810
require 'pathname'
class Pathname
def to_fancypath
Fancypath.new(self)
end
end
#!/usr/local/bin/ruby -w
##
# Modified from http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/StakingOutFileChanges.rdoc
#
# Watches files and runs a command when any of them are modified.
#
# If one argment is given, will run that command and watch app, lib, test, spec.
#
# rstakeout "ruby test/functional/models/order.rb"
# 294 ids
$record_ids = %w[
08cxhp6j27ks 0f0vpxd8k26p 0fz6vv0f82h7 0gxjrgdb92v3 0q1p7g72ndr7 0tv2cn69fmhl 0wkfjr347x9k 0xls3bxgq713 0yzqx5d1d6ny 129rnw0f6fff 12j8pn66382p 18wc9f36y263 18z5rjbqhyfp 196n2gzy0zcv 1ckwnx3xn6h7 1dqlkf3zktff 1f3m0zrspypl 1jrs12cfvb9s 1s9yg3f31lg3 1v8jxbvpwv4r 1vs1jw0d350c 1wtp2lhk4m1w 23dxz3d226r9 23rzdyp7t5yg 23z4qvb51w0v 26cchgzz1s10 2cscvhb851zs 2dldd4zslgyb 2jsdl7fk5v1f 2k64kbngnbh4 2l9g33rv7bj1 2mjpdgm1q3lj 2r6tpybytkrk 2ysklrg6t6tw 333r38wr6mfh 34vznw64ly9f 398xpzwl14v3 3qw93q4zc0xt 3y3jb2v654q4 44gg6p6r1hsf 44sj8ncf2pdd 46vj967k2syj 4yrzrzz8qr73 5416rz057zqr 57d7sb1wv4wm 5jh6h5kmd4bv 5nwz0v7m00jj 5s1ywybwfky5 5vlbl1cypsyy 5vm3dkxm9d3s 607p62f0lq04 63ydbhqxy01l 65rfwz5v3frq 6nknp3m22smn 6vrdzsd3sqpg 6w2463ggyk3p 6x3qcgmzzyw6 73y4wcx73737 7f7r1728ksqt 7fsjpvmzp7l6 7q8cp08md59n 7zc2b1qzqzn3 826t80ndhkld 8ckc6qryxy3z 8h5rwltrhjw2 8qwnq22ftfc3 8vg08jcyq78b 95gw17jc8n9f 971m5v5zntrq 97p93f75dbkm 99l11hj22z5n 9cgfhs966x1h 9dgs3kg8dcp3 9gx16fyzq8lf 9ht3vmzry2x4 9kszflxm5gd7 9p305m
# removes leading indentation, sometimes nicer than using a heredoc
def clip(str)
return str unless str.include?("\n")
first_indent = str.match(/\n\s*/).to_s
str.gsub( first_indent, "\n" ).strip
end

FancyViews - Proposed TRED project

UI on the web is generally built with three technologies:

  1. HTML (specifically the DOM parts)
  2. CSS
  3. JS

In theory, the last two are optional and are just really there to make things fancy. In practice, fancy is a basic requirement.

var viewController = (function(){
var baseClass = Class({
initialize: function(element) {
this.element = $(element);
}
});
var controllers = {};
// probably insane
#!/usr/bin/env ruby
puts DATA.read
__END__
foo
// global set by server
COMMENTS = [{'title': 'hello', 'body': 'im a lonley comment'}];
// template & controller codez together as friends
html5(function(html) {
html.import('jquery');
html.import('json');
html.n('body', function(body) {
var $item = $('.item').remove().
methods({
load: function(attribs) {
this.set(attribs);
this.e.trigger('item:loaded',this);
return this;
},
set: function(attribs) {
this.id = attribs.id;