Skip to content

Instantly share code, notes, and snippets.

View kstevens715's full-sized avatar

Kyle Stevens kstevens715

View GitHub Profile
@kstevens715
kstevens715 / pagination_view.js.coffee
Created December 25, 2012 03:08
Ember.js AJAX table pagination helper using Twitter Bootstrap. Assumes an ArrayController is in place that implements refreshData(page_num). Replace `Nepco` with [YOURAPPNAME], and in the view with your table add `{{view [YOURAPPNAME].PaginationView}}`. Lots of work to be done still. Plan on having this just be one component in a generic Datatab…
###
Twitter Bootstrap compatible pagination view.
Relies on an ArrayController being in place that implements
refreshData(page_num)
###
# Names of previous and next buttons can be adjusted:
PREV = "Prev"
NEXT = "Next"
@kstevens715
kstevens715 / quantum_view.xml
Created November 21, 2012 13:41
Shows how to use the QVNOption in Worldship to use Quantum View notifications. For my future reference.
<ShipmentInformation>
<ShipperNumber>#####</ShipperNumber>
<ServiceType>GND</ServiceType>
<NumberOfPackages>1</NumberOfPackages>
<BillingOption>PP</BillingOption>
<QVNOption>
<QVNRecipientAndNotificationTypes>
<EMailAddress>[email protected]</EMailAddress>
<Ship>Y</Ship>
<Exception>Y</Exception>
@kstevens715
kstevens715 / active_record.rb
Created June 20, 2012 14:34
A monkey patch for Rails to fix SchemaDumper to not include table_name_prefix. Will probably be fixed in Rails soon, but needed this now. Based on PR: https://github.com/kennyj/rails/commit/211dcdeaa922c74ac20d274308fb5d41ad490194
# config/initializers/active_record.rb
# Loads the monkey patch.
require 'active_record'
require 'active_record/schema_dumper'
require 'schema_dumper'
ActiveRecord::SchemaDumper.class_eval do
include Nepco::SchemaDumper
end
@kstevens715
kstevens715 / address_controller.rb
Created June 2, 2012 01:03
CoffeeScript file for working with Twitter Bootstrap forms.
# This is just a basic sample of a controller needed to work with popups.js
class AddressesController < ApplicationController
before_filter :load_addressable
def new
@address = @addressable.addresses.build(:name => params[:name])
render :partial => 'form'
end
@kstevens715
kstevens715 / _breadcrumbs.html.erb
Created May 16, 2012 00:47
Generates Twitter Bootstrap compatible breadcrumbs with the Crummy gem.
<% render_crumbs do |crumbs| %>
<ul class="breadcrumb">
<% crumbs.each_with_index do |crumb, index| %>
<li>
<% if index < crumbs.size - 1 %>
<%= link_to *crumb %>
<span class="divider">/</span>
<% else %>
<li class="active"><%= crumb[0] %></li>
<% end %>