Skip to content

Instantly share code, notes, and snippets.

class Foo
foo: () =>
when 'pending'
if modelApprover()
this._setupEditButton()
this._setupRejectButton()
if pendingApprovalFromUser()
this._setupApproveButton()
class user
key :approval_hierarchy, ApprovalHierarchy
end
class ApprovalHierarchy
attr_accessor :approval_hierarchy
def init(args=array of hashes)
approval_hierarchy = args
end
@packetmonkey
packetmonkey / Gemfile
Created February 11, 2013 15:57
Dynamically loading a mongomapper plugin
source :rubygems
gem 'bson_ext'
gem 'mongo_mapper', git: 'git://github.com/jnunemaker/mongomapper'
@packetmonkey
packetmonkey / Gemfile
Created February 6, 2013 15:47
Simple example test case of a MongoMapper bug
source :rubygems
gem 'mongo_mapper', git: 'git://github.com/jnunemaker/mongomapper'
def render_item(item)
if item.sell_price
"<b>#{item.name }</b>\n#{item.description } - #{item.sell_price }"
else
"<b>#{item.name }</b>\n#{item.description }"
end
end
def render_item(item)
"".tap do |str|
╭─evan@Evans-MBP ~/Desktop
╰─$ ruby ruby_reference.rb
1.9.2
{:name=>"Nachos", :descriptions=>["Cheesy Chips"]}
{:name=>"Bagels", :descriptions=>["Really everything on it"]}
=-=-=-=-=-=
Before
{:name=>"Nachos", :descriptions=>["Cheesy Chips"]}
After
@packetmonkey
packetmonkey / gist:2421509
Created April 19, 2012 15:02
Example Config
class ExampleApp < Sinatra::Base
configure :development do
logger = Logger.new 'log/query.log'
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => logger)
MongoMapper.config = { 'development' => { 'uri' => 'mongodb://localhost/example_app-development' } }
MongoMapper.connect('development')
end
configure :test do
MongoMapper.database = "example_app-test"
@packetmonkey
packetmonkey / parallax.html
Created March 5, 2012 19:28
Parallax demo
<html>
<head>
<title>ASC</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$(window).scroll(function(){
var topVal = 350 - $(window).scrollTop() * 1.3;
$("#cloud1").css({top: topVal});
});
SAVAGE VAMPIRES
(SW - WoD Quickie Conversion, Version 1.3)
by
Patrick Phillips (patrickphillips-at-hotmail.com)
I -- Introduction
This material is being used by me in a campaign in which the Camarilla are strictly NPC badguys. It's highly likely that the rules would need a little jiggering if you wanted to have vampire PCs. However, this at least gives you a place to start.
@packetmonkey
packetmonkey / gist:1010315
Created June 6, 2011 14:02
My bash profile
[ -z "$PS1" ] && return # If not running interactively, don't do anything
### Load other external chunks of code
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
source `brew --prefix`/Library/Contributions/brew_bash_completion.sh # Homebrew bash completion
source `brew --prefix`/etc/bash_completion.d/git-completion.bash # Homebrew installed git bash completion
### Color Shortctus
Color_Off='\e[0m' # Text Reset