Given an integer, and a range of integers (both positive and negative) as input.
We need to calculate the possible combinations of the integers from the range that add up to the given integer.
For example:
Integer: 5
Range: -1, 0, 1, 2, 3, 4
Given an integer, and a range of integers (both positive and negative) as input.
We need to calculate the possible combinations of the integers from the range that add up to the given integer.
For example:
Integer: 5
Range: -1, 0, 1, 2, 3, 4
# generic install and usage of rhc | |
# install rhc gem | |
export RB_USER_INSTALL=true | |
export PATH=$PATH:/home/holly/.gem/ruby/1.8/bin | |
gem install --user-install --source http://gems.rubyforge.org --source https://openshift.redhat.com/app/repo/ rhc | |
# json-1.5.1 | |
# parseconfig-0.5.2 | |
# rhc-0.69.3 |
/** | |
* ## Merging mixin views in backbone.js ## | |
* | |
* really just more a test for tumblr gistr | |
*/ | |
/** | |
* Merge the mixin (a Backbone.View) into another Backbone.View. Automatically merge events, defaults, and call the parent initializer. | |
**/ | |
function mergeMixin(view, mixin) { |
#!/usr/bin/env ruby | |
require "rubygems" | |
gem "minitest" | |
require "minitest/autorun" | |
require "minitest/pride" | |
class Palindrome | |
def search string | |
@array = string.gsub(/[^0-9a-z ]/i, '').gsub(' ', '').downcase.split '' | |
@palindromes = [] |
namespace :assets do | |
desc "Check that all assets have valid encoding" | |
task :check => :environment do | |
paths = ["app/assets", "lib/assets", "vendor/assets"] | |
extensions = ["js", "coffee", "css", "scss"] | |
paths.each do |path| | |
dir_path = Rails.root + path |
def log_regex | |
@log_regex ||= begin | |
ip_regex = '(?:\d+\.){3}\d+' | |
log_regex = /^ | |
(#{ip_regex})\s-\s-\s # IP | |
\[(.*?)\]\s # Date | |
"(.*?)"\s # Request | |
(\d+)\s # Response Code | |
(\d+)\s # Bytes Sent by Server | |
([\d\.]+)\s # Request Time |
module Instruments | |
def self.set_logger(l, m) | |
@logger = l | |
@method = m | |
end | |
def self.logger | |
@logger | |
end |
# Returns get parameters. | |
# | |
# If the desired param does not exist, null will be returned | |
# | |
# To get the document params: | |
# @example value = $(document).getUrlParam("paramName"); | |
# | |
# To get the params of a html-attribut (uses src attribute) | |
# @example value = $('#imgLink').getUrlParam("paramName"); | |
jQuery.fn.extend |
require 'rubygems/remote_fetcher' | |
require 'rubygems/user_interaction' | |
require 'rubygems/errors' | |
require 'rubygems/text' | |
## | |
# SpecFetcher handles metadata updates from remote gem repositories. | |
class Gem::SpecFetcher |
<h1>Settings</h1> | |
<%= simple_form_for @settings, :as => 'settings', :url => admin_settings_path, :html => { :class => 'form form-horizontal' } do |f| %> | |
<fieldset> | |
<legend>Points Earning</legend> | |
<%= f.input :site_name %> | |
<%= f.input :per_page %> | |
</fieldset> | |
<div class="control-group"> |