Skip to content

Instantly share code, notes, and snippets.

@jcsrb
jcsrb / document_series.rb
Created July 7, 2011 11:11
find the gap
class DocumentSeries < ActiveRecord::Base
#...
#
# this returns an array of the free counter numbers in the series
#
def empty_series_counter_slots
(self.counter_start .. self.counter_current).to_a - self.documents.collect{|d| d.document_series_counter}
end
- if @content_for_banner
= yield(:banner)
@jcsrb
jcsrb / scopes.rb
Created December 10, 2011 12:33
usefull scopes for Rails3
#include in your model
#include Scopes
module Scopes
def self.included(base)
#scope for NOT IN
#usage:
# Model.not_in(1)
# Model.not_in(1,2,4)
# Model.not_in([1,2,4])
# Model.not_in(1,2,3,[4,5,6])
@jcsrb
jcsrb / Gemfile
Created December 15, 2011 15:21
Getting ruby-debug working on ruby 1.9.3
#...
group :development do
gem 'mongrel', '>= 1.2.0.pre2'
gem 'linecache19', :git => 'git://github.com/mark-moseley/linecache'
gem 'ruby-debug-base19x', '~> 0.11.30.pre4'
gem 'ruby-debug19'
end
#...
@jcsrb
jcsrb / dabblet.css
Created January 2, 2012 22:00
Untitled
#heart {
transform: rotate(45deg);
position: relative;
width: 250px;
height: 250px;
margin: 200px auto;
}
#heart div {
@jcsrb
jcsrb / dabblet.css
Created January 2, 2012 21:52
Untitled
#heart {
transform: rotate(45deg);
position: relative;
width: 250px;
height: 250px;
margin: 200px auto;
}
#heart div {
@jcsrb
jcsrb / dabblet.css
Created January 2, 2012 21:45
Untitled
#heart {
transform: rotate(45deg);
position: relative;
width: 250px;
height: 250px;
margin: 200px auto;
}
#heart div {
@jcsrb
jcsrb / example.html
Created January 5, 2012 13:55
jQuery Hover actions
<a
data-hover-actions="true"
data-hover-text="remove from favourites"
data-hover-class="ui button orange follow"
class="ui button green active follow"
href="/toggle_favourite"
>
<span class="icon"></span>
is one of your favourites
</a>
@jcsrb
jcsrb / dabblet.css
Created January 11, 2012 13:09
Panel Styles
/**
* Panel Styles
*/
/*body_bg.png*/
body{ background: url(http://i.imgur.com/9OqsE.png);}
body > div{
margin-top:20px;
margin-left:20px;
min-height: 240px;
min-width: 240px;
// taken from https://github.com/lokesh/color-thief
/*
CanvasImage Class
Class that wraps the html image element and canvas.
It also simplifies some of the canvas context manipulation
with a set of helper functions.
*/
var CanvasImage = function(image){
// If jquery object is passed in, get html element
this.imgEl = (image.jquery)? image[0]: image;