This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Site.util.number_to_currency = function num2money(n_value) { | |
| // validate input | |
| if (isNaN(Number(n_value))) return 'ERROR'; | |
| // save the sign | |
| var b_negative = Boolean(n_value < 0); | |
| n_value = Math.abs(n_value); | |
| // round to 1/100 precision, add ending zeroes if needed | |
| var s_result = String(Math.round(n_value * 1e2) % 1e2 + '00').substring(0, 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| scoped = order("#{ sort_by } #{ direction }") | |
| scoped = scoped.where( :publisher_id => params[:publisher_id] ) if params[:publisher_id].present? | |
| scoped = scoped.where( :category_id => params[:category_id] ) if params[:category_id].present? | |
| scoped = scoped.where( "title like ?", "%#{ params[:title] }%" ) if params[:title].present? | |
| scoped = scoped.where( "description like ?", "%#{ params[:description] }%" ) if params[:description].present? | |
| scoped = scoped.drafts if params[:drafts_only].present? | |
| scoped = scoped.published if params[:published_only].present? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class CategoriesController < ApplicationController | |
| before_filter :require_admin | |
| before_filter :get_category, :only => [:show,:edit,:update,:destroy] | |
| respond_to :html, :xml, :json | |
| responders :flash, :http_cache, :collections | |
| def index | |
| respond_with( @categories = Category.query(params) ) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Application.handlers = { | |
| registration_submit : function(){ | |
| var form = Ext.getCmp('registration_form_panel'); | |
| form.submit(); | |
| }, | |
| poll_submit : function(){ | |
| var form = Ext.getCmp('poll_question_2_panel_form'); | |
| form.submit(); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Application.handlers = { | |
| registration_submit : function(){ | |
| var form = Ext.getCmp('registration_form_panel'); | |
| form.submit(); | |
| }, | |
| poll_submit : function(){ | |
| var form = Ext.getCmp('poll_question_2_panel_form'); | |
| form.submit(); | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var value = 1, | |
| other_value = 2, | |
| and_another = "what up girl whatchu wearing?", | |
| method = function(){ | |
| alert('we do it big'); | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Application = {}; | |
| Application.is = { | |
| init : function(navigator) { | |
| var platforms = this.platforms, | |
| ln = platforms.length, | |
| i, platform; | |
| navigator = navigator || window.navigator; | |
| for (i = 0; i < ln; i++) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # assignment is pretty | |
| # you never have to worry about typing 'var' | |
| # and no need to wrap args in () | |
| fs = require "fs" | |
| sys = require "sys" | |
| global.client = require "./client" | |
| args = process.argv.slice 2 | |
| # i like that in coffeescript | |
| # you automatically return the last statement |