This file contains 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
orderize: function(options) { | |
var sortOrder = []; | |
if (!options) { | |
var options = $.shopscaler.productOptions.container.find("li"); | |
options.each(function(i) { | |
sortOrder.push($(this).attr("id").split("-")[2]); | |
}); | |
} else { | |
$.each(options, function() { | |
alert(this.split("-")[2]); |
This file contains 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
orderize: function() { | |
var options = $.shopscaler.productOptions.container.find("li"); | |
options.each(function(count) { | |
var $this = $(this); | |
var previousOrder = $this.attr("id").split("-")[1]; | |
if (previousOrder != count) { | |
var hiddenTag = $("#product_options_attributes_"+previousOrder+"_id"); | |
if (hiddenTag.size() == 1) { | |
Attribute.replace_id(hiddenTag, "id", "_"+previousOrder+"_", "_"+count+"_"); |
This file contains 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 Attribute = { | |
replace_id: function(selector, attribute, oldVal, newVal) { | |
var oldValue = selector.attr(attribute); | |
var newValue = oldValue.replace(oldVal, newVal); | |
selector.attr(attribute, newValue) | |
return selector; | |
} | |
}; |
This file contains 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
require 'nokogiri' | |
require 'pstore' | |
# | |
# Rack::DomainSprinkler | |
# | |
# Modifies outgoing HTML markup so that common static assets like script source | |
# files, images, and stylesheets will be served from one of a number of domains | |
# rather than just a single one in order to improve parallelization of resource |
This file contains 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
[color] | |
diff = auto | |
status = auto | |
branch = auto |
This file contains 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
# Put this file eg. xml_parser.rb into your config/initializers directory, reboot your application | |
ActiveSupport::XmlMini.backend = "Nokogiri" | |
module ActiveSupport | |
module XmlMini_Nokogiri | |
def parse(data) | |
if !data.respond_to?(:read) | |
data = StringIO.new(data || '') |
This file contains 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
require 'serialport' | |
require 'highline/import' | |
class HighLine | |
public :get_character | |
end | |
class ThreadedTerminal | |
class << self | |
MODEM = '/dev/tty.usbmodem0000001' |
This file contains 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
require 'grape' | |
module My | |
class API < Grape::API | |
prefix 'api' | |
## params key list | |
################################################################################################################# | |
# 1. login | |
# 2. sign |
This file contains 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
window.t = (id, vars = {}) -> | |
template = i18n[__locale][id] or i18n['en'][id] or "(?) #{id}" | |
_.template(template, vars) | |
# yes, that's it |
This file contains 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
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libyaml-dev | |
cd /tmp | |
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz | |
tar -xvzf ruby-1.9.3-p194.tar.gz | |
cd ruby-1.9.3-p194/ | |
./configure --prefix=/usr/local | |
make | |
make install |
OlderNewer