Skip to content

Instantly share code, notes, and snippets.

@justinstoller
justinstoller / README.markdown
Created August 14, 2011 03:27 — forked from ariera/README.markdown
Nestable, sortable and dragable categories

Nestable, sortable and dragable categories:

In the project I'm working on we wanted to have a Category model which we wanted to be nestable. But we also liked the user to have a draggable interface to manage and rearrange the order of his categories. So we chose awesome_nested_set for the model and jQuery.nestedSortable for the UI.

It took me some time to arrange things to work properly so I wanted to share my work in case it helps anybody.

Before beginning

you might want to take a look at a demo app

  1. go to: http://awesomenestedsortable.heroku.com/groups/
  2. click in show of any group
@justinstoller
justinstoller / rspec-syntax-cheat-sheet.rb
Created August 14, 2011 03:28 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@justinstoller
justinstoller / sinatra_plugin.rb
Created February 23, 2012 19:20
jenkins_embedding_rack
root@ubuntu-precise:~/work/sinatra_plugin# cat models/sinatra_plugin.rb
require 'rubygems'
require 'sinatra/base'
require 'jenkins/rack'
class SomeSinatraApp < Sinatra::Base
get '/hi' do
'Help'
end
end
@justinstoller
justinstoller / config.erb
Created February 29, 2012 08:36
jenkins_triggers
root@ubuntu-precise:~/work/my_trigger# cat views/my_trigger/config.erb
<%
f = taglib('lib/form')
f.entry :title => 'MyTrigger', :field => 'my_trigger_text_box_entry',
:description => 'This is the form field for MyTrigger' do
f.textbox :title => 'MyTriggers TextBox', :field => 'my_trigger_text_box'
end
%>
@justinstoller
justinstoller / .gitignore
Created March 6, 2012 06:37 — forked from aussielunix/.gitignore
jenkins configs to github
#
# The following ignores...
# Miscellaneous Jenkins litter
*.log
*.tmp
*.old
*.bak
*.jar
*.json
activemodel (3.0.7)
activerecord (3.0.7)
activesupport (3.0.7)
arel (2.0.10)
builder (2.1.2)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.4)
couchrest (1.0.2)
daemons (1.1.3)
diff-lcs (1.1.3)
require 'spec_helper'
let(:defaults) do
{ 'owner' => 'root', 'group' => 'root' }
end
describe 'scott_test' do
it do should contain_file('foo', 'bar', 'baz').with(
{ 'ensure' => 'present' }.merge(defaults)
) end
require 'rubygems'
require 'rubygems/package_task'
Dir['tasks/**/*.rb'].each { |t| load t }
spec = Gem::Specification.new do |s|
s.name = "hiera-json"
s.version = described_version
s.author = "Puppet Labs"
s.email = "info@puppetlabs.com"
@justinstoller
justinstoller / smf_prop.pp
Last active December 11, 2015 16:48
An example smf property defined type (I don't remember if it works...)
#
# This provides simple setting of smf service properties idempotently
# Usage:
# smf_prop { 'application/pkg/server pkg/port=blah': }
#
# Example (from my defunct ips repo manifest
# Smf_prop {
# notify => Service[ $service ],
# require => Exec[ "create-pkgrepo-${path}" ],
# }
test_name "Basic AIX Package Provider" do
# AIX Provider only should run on AIX machines
confine :to, :platform => /aix/
agents.each do |agent|
# Test variables
package = 'sudo.rte'
version1 = '1.7.10.4'