Skip to content

Instantly share code, notes, and snippets.

View runlevel5's full-sized avatar

Trung Lê runlevel5

View GitHub Profile
TODO List:
- Gradient selection for tile (calendar module)
- Fix Today button in same month
- Move ">" arrow up abit to center it
- limit the character of event name on a row so it won't go over to the arrow section, possible, do the strip of overflown characters to be "..."
- Event Details restyle, matched up with mockup
# RGB color
pink = 153, 16, 171
purple = 131, 56, 155
date {
::no-event {
::unselected {
bg: white;
fg: black;
News
• News video - long headings are truncated in detail view (?? is it already fixed?)
• News photo gallery - long heading over laps date in detail view (DONE)
• News list view – shorten characters displayed for a story heading from 35 to 30 characters (to allow for comment number) (DONE)
Forums
• Creating a new Thread – media button is not available at all times. Eg. when typing a subject or message. The media button is not seen. A done button
should appear above keyboard, but it not always shown. Need to resolve bug.
@runlevel5
runlevel5 / gist:1920642
Created February 27, 2012 01:49
Install jquery-ui in Rails 3.1 or newer

ruby-journal.com presents 'How to install jquery-ui that works with asset pipeline in Rails 3.1 or newer'

  1. Edit app/assets/javascripts/application.js:
  //= require jquery
  //= require jquery_ujs
  //= require jquery-ui
size_option_type = OptionType.find_or_create_by_name_and_presentation_and_display_as_dropdown('size', 'Size', true)
product = Product.find_by_style_number('316012')
rows = {
'9343710067392' => '6',
'9343710067408' => '8',
'9343710067415' => '10',
'9343710067422' => '12'
}
rows.each_pair do | sku, size |
@runlevel5
runlevel5 / gist:1982041
Created March 5, 2012 23:30
ActiveRecord helper - find_or_create method that takes in hash or array of hash

very useful for your db/seeds.rb

class ActiveRecord::Base
  def self.find_or_create(attributes)
    if attributes.is_a?(Array)
      attributes.each do |attr|
        self.find_or_create(attr)
      end
 else
# db/migrate/20120322062620_create_db.rb
class CreateDB < ActiveRecord::Migration
def change
create_table "agn_agency", :id => false, :force => true do |t|
t.string "agency_code"
t.string "u_version"
t.string "agn_name"
t.string "agn_iagn_no"
t.string "agn_sita_adr"
t.string "agn_type_code"
orders = Order.all(:conditions => ["completed_at >= ?", 60.days.ago])
line_items = LineItem.find_all_by_order_id(orders.map(&:id))
inventory_units = InventoryUnit.find_all_by_order_id(orders.map(&:id))
invalid_line_items = []
invalid_inventory_units = []
line_items.each do |li|
str = ""
Communication::LEGACY_MERGE_FIELDS_MAP.each_pair do |k, v|
str.gsub!(k, v) unless v.nil?
end
str
@runlevel5
runlevel5 / gist:2231299
Created March 28, 2012 22:53
Remove spree_auth login partial
#okay, we need to the login form partial that spree_auth insert into spree_core, so we could do so by replace them with empty content, and make sure our overrides happen after spree_auth's auth_user_login_form
Deface::Override.new(:virtual_path => "spree/checkout/registration",
:name => "remove_auth_user_login_form",
:sequence => {:after => "auth_user_login_form"}
:replace_contents => "[data-hook='registration'] #account, #registration[data-hook] #account",
:text => "",
:disabled => false)