Skip to content

Instantly share code, notes, and snippets.

@abrambailey
abrambailey / blah
Created August 12, 2012 06:49
blah
class Comment < ActiveRecord::Base
belongs_to :commentable, :polymorphic => true
belongs_to :user
attr_accessible :body, :user
validates_length_of :body, :minimum => 1
validates_presence_of :user
end
@abrambailey
abrambailey / gister123.rb
Created August 31, 2012 01:45
gister123
f.series(:data => @values, :dataLabels => { :formatter => %|function() { return this.x; }|.js_code, :enabled => true, :rotation => 90, :x=>-3, :y=>15, :color=>"#FFFFFF" } )
<script type="text/javascript">
(function() {
var onload = window.onload;
window.onload = function(){
if (typeof onload == "function") onload();
var options, chart;
options = { "title": { "text": "Top Brands by Score" },"legend": { "layout": "vertical","style": { },"enabled": false },"xAxis": { "categories": ["x","y","z"] },"yAxis": { "title": { "text": null },"labels": { } },"tooltip": { "enabled": true,"formatter": function() { return '<b>'+ this.x +'</b>: '+ this.y.toFixed(1) +' %'; } },"credits": { "enabled": false },"plotOptions": { "areaspline": { } },"chart": { "defaultSeriesType": "column","renderTo": "my_id","height": 230,"width": 200,"backgroundColor": "#F0F0F0" },"subtitle": { },"series": [{"data":[77.5,67.0,55.0],"dataLabels":{"formatter":"function() { return this.x; }","enabled":true,"rotation":90,"x":-3,"y":15,"color":"#FFFFFF"},"name":null}] };
chart = new Highcharts.Chart(options);
};
(function(){function E(a,b){var c;a||(a={});for(c in b)a[c]=b[c];return a}function ja(){for(var a=0,b=arguments,c=b.length,d={};a<c;a++)d[b[a++]]=b[a];return d}function N(a,b){return parseInt(a,b||10)}function zb(a){return typeof a==="string"}function rb(a){return typeof a==="object"}function ic(a){return Object.prototype.toString.call(a)==="[object Array]"}function Sb(a){return typeof a==="number"}function Eb(a){return sa.log(a)/sa.LN10}function rc(a){return sa.pow(10,a)}function Fb(a,b){for(var c=
a.length;c--;)if(a[c]===b){a.splice(c,1);break}}function A(a){return a!==G&&a!==null}function R(a,b,c){var d,e;if(zb(b))A(c)?a.setAttribute(b,c):a&&a.getAttribute&&(e=a.getAttribute(b));else if(A(b)&&rb(b))for(d in b)a.setAttribute(d,b[d]);return e}function sb(a){return ic(a)?a:[a]}function r(){var a=arguments,b,c,d=a.length;for(b=0;b<d;b++)if(c=a[b],typeof c!=="undefined"&&c!==null)return c}function J(a,b){if(Tb&&b&&b.opacity!==G)b.filter="alpha(opacity="+b.opacity*100+")";E(a.style,b)}function na(a,
b,c,d,e){a=S
@abrambailey
abrambailey / gist:4058552
Created November 12, 2012 10:31
my source
/* line 26, ../../../../.rvm/gems/ruby-1.9.3-p286@goodsounds/gems/bootstrap-sass-2.1.1.0/vendor/assets/stylesheets/bootstrap/_mixins.scss */
.clearfix {
*zoom: 1;
}
/* line 15, ../../../../.rvm/gems/ruby-1.9.3-p286@goodsounds/gems/bootstrap-sass-2.1.1.0/vendor/assets/stylesheets/bootstrap/_mixins.scss */
.clearfix:before, .clearfix:after {
display: table;
content: "";
line-height: 0;
}
@abrambailey
abrambailey / gist:4175004
Created November 30, 2012 10:23
truncate with full length tooltip
def trunk(input, length, path=nil)
shorten = truncate(input, :length => length)
return link_to shorten, path, :rel=>"tooltip", :title=>input if path
content_tag(:span, shorten, :rel=>"tooltip", :title=>input)
end
@abrambailey
abrambailey / gist:4174971
Created November 30, 2012 10:20
truncate with full length tooltip
def trunk(input, length, *path)
shorten = truncate(input, :length => length)
if path.empty?
return content_tag(:span, shorten, :rel=>"tooltip", :title=>input)
else
return link_to shorten, path[0], :rel=>"tooltip", :title=>input
end
end
def update
@style = Style.find(params[:id])
if @style.update_attributes(params[:style])
redirect_to add_path
else
respond_to do |format|
format.html { render action: "edit" }
format.json { render json: @style.errors, status: :unprocessable_entity }
end
$(document).ready( function () {
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{
if ( typeof sNewSource != 'undefined' && sNewSource != null ) {
oSettings.sAjaxSource = sNewSource;
}
// Server-side processing should just call fnDraw
if ( oSettings.oFeatures.bServerSide ) {
%select{:name => "tags", :id=>"tags"}
- @tags.each do |tag|
%option{:value => "ha"} tag