Skip to content

Instantly share code, notes, and snippets.

View mewdriller's full-sized avatar

Drew Miller mewdriller

View GitHub Profile
@mewdriller
mewdriller / BindingMap.as
Created March 11, 2011 15:17
Robotlegs utility similar to EventMap to help automagically remove bindings in a Mediator's preRemove logic.
package com.clutch.robotlegs
{
import mx.binding.utils.BindingUtils;
import mx.binding.utils.ChangeWatcher;
public class BindingMap implements IBindingMap
{
private var _bindings:Vector.<ChangeWatcher> = new Vector.<ChangeWatcher>();
public function BindingMap()
@mewdriller
mewdriller / Main.as
Created October 26, 2011 22:13
A hack to get RobotLegs to recognize/mediate the views already on the stage.
package io.base2
{
import flash.display.MovieClip;
import flash.display.DisplayObject;
import flash.events.Event;
public class Main extends MovieClip
{
public function Main()
{
#!/usr/bin/env ruby
#^syntax detection
site 'http://community.opscode.com/api/v1'
cookbook 'apt'
cookbook 'git',
git: 'https://github.com/fnichol/chef-git.git'
cookbook 'build-essential'
cookbook 'rvm',
class Genre < ActiveRecord::Base
attr_accessible :name
end
/*
* add this to your own css file,
* to overwrite the _chosen_ styling, to look more like bootstrap!
*
* note: for the error part to work, an .error class-name must be added
* to a wrapping DIV, to display the bootstrap error styling. I have
* just use the wrapping .control-group DIV
*
* credit: Rasmus Burkal, @rabu81
* Drew Miller, @mewdriller
<form>
<div class="properties">
<!-- Owner -->
<label>Owner</label>
<select class="input-block-level" data-provide="chosen">
<option value="s240946" selected="selected">Andrew Miller</option>
<option value="s244005">Anthony Borres</option>
</select>
<!-- Managers -->
<form>
<div class="properties">
<!-- Owner -->
<label>Owner</label>
<select class="input-block-level" data-provide="chosen">
<option value="s240946" selected="selected">Andrew Miller</option>
<option value="s244005">Anthony Borres</option>
</select>
<!-- Managers -->
<form>
<div class="properties">
<!-- Owner -->
<label>Owner</label>
<select class="input-block-level" data-provide="chosen">
<option value="s240946" selected="selected">Andrew Miller</option>
<option value="s244005">Anthony Borres</option>
</select>
<!-- Managers -->
<form id="edit-task-3">
<div class="properties">
<!-- Owner -->
<label>Owner</label>
<select class="input-block-level" data-provide="chosen">
<option value="s240946" selected="selected">Andrew Miller</option>
<option value="s244005">Anthony Borres</option>
</select>
<!-- Managers -->
@mewdriller
mewdriller / ability.rb
Last active December 19, 2021 01:48
Serializing CanCan rules to JSON for use in a client-side application
class Ability
include CanCan::Ability
def initialize(user)
can :read, Comment
if user.valid?
can :create, Comment
can :manage, Comment, author_id: user.id
end