query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Returns the code for the content for this class
def genFileContent(cls, bld) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_for(code_object)\n Code.new(render_doc_markup_for(code_object),\n start_line_for(code_object), :text).\n with_line_numbers(use_line_numbers?).to_s\n end", "def content\n @content\n end", "def code\n self.class.code\n end", "def content\n ...
[ "0.72156006", "0.7201191", "0.7166135", "0.7125523", "0.7125523", "0.7125523", "0.7125523", "0.7125523", "0.7125523", "0.7064818", "0.7034942", "0.7034942", "0.6998248", "0.6998248", "0.69468206", "0.6942142", "0.6901648", "0.6901648", "0.68890506", "0.68482333", "0.6794751",...
0.0
-1
Dear Mike, Dione, and Dani, is an enumerable the correct thing to use here and if so...why are they so difficult? Your's truly Christian
def rooms_from_category(category) rooms.find_all do |room| room.category(:bedroom) end require "pry"; binding.pry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enumerator ; end", "def enumerator ; end", "def enumerator; end", "def through; end", "def set(enumerable); end", "def each_identity; end", "def list\n return @enumerable\n end", "def test_each\n # codecite examples\n evens = Sequence.new(5, 2) {|a| a.last + 2} \n odds = Sequenc...
[ "0.6667736", "0.6667736", "0.6607584", "0.63838565", "0.6334184", "0.62893534", "0.6079067", "0.6060172", "0.60449433", "0.60204864", "0.5993902", "0.5993902", "0.5993902", "0.5993902", "0.5993902", "0.5993902", "0.59880507", "0.59807736", "0.59807736", "0.59807736", "0.59807...
0.0
-1
Retourne la classe css en fonction de la note obtenue
def class_div_note_finale if unote_finale > 15 'good' elsif unote_finale > 10 'moyen' else 'bad' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css_class\n end", "def css_class\n Meal.css_class_for_type(type)\n end", "def css; end", "def css; end", "def css; end", "def styles; end", "def styles; end", "def styles; end", "def style\n @style\n end", "def html_classes; end", "def style\n end", "def style; end", "def styl...
[ "0.76045567", "0.7041581", "0.6765111", "0.6765111", "0.6765111", "0.67005724", "0.67005724", "0.67005724", "0.66601825", "0.64726627", "0.6467561", "0.64413637", "0.64413637", "0.64413637", "0.6395259", "0.63721985", "0.6370656", "0.63099134", "0.62670076", "0.621764", "0.61...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def dashboard_params params.require(:dashboard).permit(:client_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
As of rails 4, `includes()` no longer causes active record to look inside the where clause to decide to outer join tables you're using in the where. Instead, `references()` is required in addition to `includes()` to force the outer join.
def build_relation(*where_conditions) relation = @model_class.where(*where_conditions) relation = relation.includes(joins).references(joins) if joins.present? relation end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def includes\r\n return nil unless @joins and not @joins.empty?\r\n includes = @joins.collect{|j| j.includes}\r\n end", "def eager_includes(include_referenced: true)\n {}\n end", "def includes(*associations)\n # Normalize association list to strict nested hash.\n normalize = ->(l...
[ "0.722107", "0.7217053", "0.6562206", "0.63115185", "0.61141926", "0.57249385", "0.5697809", "0.5694684", "0.5685911", "0.5644764", "0.5620146", "0.56098974", "0.56098974", "0.558723", "0.5554605", "0.5545164", "0.54769605", "0.54571545", "0.5455637", "0.5448652", "0.54324377...
0.55347306
17
Rails 4.2 deprecates `sanitize_sql_hash_for_conditions`
def sanitize_sql(conditions) if conditions.is_a?(Hash) sanitize_sql_activerecord5(conditions) else @model_class.send(:sanitize_sql, conditions) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_sql(query)\n ActiveRecord::Base.send(:sanitize_sql_array, query)\n end", "def sanitize!(conditions)\n conditions.reject {|key, value| !ALLOWED_KEYS.include?(key) }\n end", "def sanitize_sql(*args)\n klass.send(:sanitize_sql, args)\n end", "def sanitize(value)\...
[ "0.6894026", "0.67467076", "0.67098874", "0.6672833", "0.6621736", "0.6557758", "0.65109575", "0.64775413", "0.6451578", "0.6421358", "0.6267935", "0.6171043", "0.61277634", "0.6021716", "0.5975763", "0.5840726", "0.5838074", "0.58269495", "0.5825116", "0.581407", "0.5793589"...
0.8091459
1
To set the state of the game when getting info from Redis
def main_setter(board, score, gameover) @board = board @size = 4 @score = score @gameover = gameover end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_state\n end", "def game_state(game_id)\n\n end", "def guesser_ready(data)\n game = Game.find data['game_id']\n game.update status: 'playing'\n ActionCable.server.broadcast 'games', status: 'playing'\n end", "def setup_game\n begin\n @game = @cache.fetch(@key, expires_in: 24...
[ "0.63375986", "0.6221573", "0.62002796", "0.61887133", "0.61811906", "0.601478", "0.59848595", "0.5970881", "0.596924", "0.59516555", "0.59451324", "0.59027934", "0.58909553", "0.58725506", "0.58578604", "0.58466804", "0.58422357", "0.5834648", "0.5826356", "0.5819634", "0.58...
0.0
-1
by selling_date but sort transactions where the `property_type` is "land" or "mobile_home" at the bottom of the list
def all relation.order("CASE WHEN property_type IN ('land', 'mobile_home') THEN 1 ELSE 0 END, selling_date DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_items\n @items = @items.sort_by(&:created_at) if params[:order] == 'date'\n @items = @items.sort_by(&:created_at).reverse if params[:order] == 'date desc'\n @items = @items.sort_by(&:payee) if params[:order] == 'payee'\n @items = @items.sort_by(&:payee).reverse if params[:order] == 'payee desc...
[ "0.57442045", "0.5742331", "0.56227624", "0.5603789", "0.55538875", "0.55036515", "0.5498439", "0.5433121", "0.54286367", "0.53911895", "0.53874207", "0.5282424", "0.5263677", "0.5258117", "0.52539414", "0.522657", "0.5217822", "0.5205801", "0.52052057", "0.52052057", "0.5205...
0.7577803
0
GET /measurements GET /measurements.xml
def index @body_measurements = current_user.measurements.paginate(:all, :page => params[:page], :per_page => 8, :order => "measured_on desc") @body_measurement_goals = current_user.measurements.paginate(:all, :page => params[:page], :conditions => "is_goal", :order => "measured_on desc") @measurement = Measurement.new respond_to do |format| format.html # index.html.erb format.xml { render :xml => @measurements } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_measurements\n render json: @data_source.measurements\n end", "def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{for...
[ "0.6965853", "0.6864641", "0.68466413", "0.6833313", "0.6760013", "0.67069286", "0.6637615", "0.65907526", "0.6482243", "0.6482243", "0.6482243", "0.6403352", "0.61005056", "0.6061146", "0.6018937", "0.60135645", "0.60083693", "0.5959461", "0.59593", "0.59030455", "0.5897871"...
0.5401968
58
GET /measurements/1 GET /measurements/1.xml
def show @measurement = current_user.measurements.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @measurement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @measurement = Measurement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measurement }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measuremen...
[ "0.70081973", "0.6800175", "0.66959125", "0.6575745", "0.65573466", "0.64491254", "0.6433109", "0.6350959", "0.61745363", "0.61745363", "0.61745363", "0.61372674", "0.6129785", "0.6019971", "0.59931386", "0.5978341", "0.59729606", "0.59729606", "0.59303385", "0.5910016", "0.5...
0.68856055
1
GET /measurements/new GET /measurements/new.xml
def new @measurement = Measurement.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @measurement } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @measurement = Measurement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measurement }\n end\n end", "def new\n @standard_measurement = StandardMeasurement.new\n\n respond_to do |format|\n format.html # new.html.erb\...
[ "0.70565104", "0.6719033", "0.6703814", "0.66878384", "0.662929", "0.6618636", "0.6613896", "0.6603592", "0.6591426", "0.65700144", "0.6535644", "0.65247405", "0.6523973", "0.6519925", "0.6516455", "0.6510645", "0.6510645", "0.6500155", "0.64961433", "0.64961433", "0.64897245...
0.76939315
1
POST /measurements POST /measurements.xml
def create @measurement = current_user.measurements.new(params[:measurement]) respond_to do |format| if ( params[:water_percent] == "" && params[:comment] == "" && params[:visceral_fat] == "" && params[:is_goal] == "0" && params[:belly] == "" && params[:calf] == "" && params[:muscle_percent] == "" && params[:chest] == "" && params[:weight] == "" && params[:hip] =="" && params[:thigh] =="" && params[:resting_metabolism] =="" && params[:fat_percent] == "" && params[:neck] == "" && params[:bicep] == "" ) flash[:notice] = 'Your Measurement was not updated.' format.html { render :action => "new" } elsif @measurement.save flash[:notice] = 'Measurement was successfully created.' format.html { redirect_to(measurements_path) } else flash[:notice] = 'Your Measurement was not updated.' format.html { render :action => "new" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def measurements_post(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_post ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n q...
[ "0.6839558", "0.645486", "0.64176416", "0.63523924", "0.633185", "0.62931323", "0.62931323", "0.6140369", "0.6066952", "0.60463816", "0.59613615", "0.59105456", "0.58904576", "0.5858172", "0.5830072", "0.58181345", "0.5800924", "0.5782183", "0.5770392", "0.5735831", "0.567323...
0.5769293
19
PUT /measurements/1 PUT /measurements/1.xml
def update @measurement = current_user.measurements.find(params[:id]) respond_to do |format| if @measurement.update_attributes(params[:measurement]) flash[:notice] = 'Measurement was successfully updated.' format.html { redirect_to(measurements_path) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @measurement.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @measurement = Measurement.find(params[:id])\n\n respond_to do |format|\n if @measurement.update_attributes(params[:measurement])\n flash[:notice] = 'Measurement was successfully updated.'\n format.html { redirect_to(@measurement) }\n format.xml { head :ok }\n els...
[ "0.665875", "0.6418964", "0.629044", "0.62816983", "0.62816983", "0.62816983", "0.6202977", "0.6138616", "0.6115629", "0.6111737", "0.6098372", "0.60613626", "0.6005917", "0.5987134", "0.5968382", "0.59182686", "0.58877933", "0.58689874", "0.58590454", "0.5831127", "0.5831127...
0.6716901
0
DELETE /measurements/1 DELETE /measurements/1.xml
def destroy @measurement = current_user.measurements.find(params[:id]) @measurement.destroy respond_to do |format| format.html { redirect_to(measurements_path) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurements_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy...
[ "0.7341228", "0.6819416", "0.6723961", "0.6712516", "0.6631162", "0.64964795", "0.6495538", "0.6485158", "0.6482051", "0.64755064", "0.644376", "0.6442348", "0.6442348", "0.6442348", "0.64321685", "0.6415439", "0.63993573", "0.6360816", "0.63157725", "0.63081515", "0.628778",...
0.7227597
1
Current configuration number. Required. Must update when an accessory, service, or characteristic is added or removed on the accessory server. Accessories must increment the config number after a firmware update. This must have a range of 14294967295 and wrap to 1 when it overflows. This value must persist across reboots, power cycles, etc.
def current_configuration_number 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_version\n @attributes[:config_version]\n end", "def configuration_version\n return @configuration_version\n end", "def update_config\n @config_id = (@config_id + 1) % 2**24\n stop_ssdp_server\n notify :alive\n end", "def configuration_version=(va...
[ "0.57985604", "0.56213194", "0.55052704", "0.5472313", "0.5401919", "0.53820866", "0.53033143", "0.52302766", "0.5221376", "0.5215062", "0.5215062", "0.5210898", "0.52102476", "0.5196421", "0.517269", "0.50936216", "0.5070105", "0.5052257", "0.5050932", "0.50284374", "0.50208...
0.76040643
0
Accessory Category Identifier. Required. Indicates the category that best describes the primary function of the accessory. This must have a range of 165535.
def accessory_category_identifier @configuration.category_identifier end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def category16\n return @category16\n end", "def from_standard_cat_id(cat_id)\n cat_id + 2000\n end", "def to_standard_cat_id(category_id)\n category_id - 2000\n end", "def category23\n return @category23\n end", "def category(value)\n...
[ "0.62359405", "0.61106056", "0.6092969", "0.5933614", "0.59173715", "0.5888669", "0.5871456", "0.5859898", "0.5841864", "0.5806326", "0.5804024", "0.58035094", "0.5782169", "0.5781213", "0.5734815", "0.5731469", "0.5723405", "0.5715685", "0.5715685", "0.5702808", "0.56778485"...
0.79803157
0
Feature flags (e.g. "0x3" for bits 0 and 1). Required if nonzero.
def feature_flags 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flags\n fs = FRAME_FLAGS[type]\n [0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80]\n .select { |v| @flags_value & v > 0 }\n .map { |val| fs && fs.key(val) || (\"unknown_%02x\" % val).to_sym }\n end", "def flags\n # Hash#index becomes Hash#key in Ruby 1.9.\n index_method = RUBY...
[ "0.7106991", "0.6897127", "0.6749464", "0.67343044", "0.67253494", "0.67253494", "0.6568186", "0.6555869", "0.6513748", "0.6495291", "0.64731765", "0.6407783", "0.63836455", "0.63836455", "0.6373982", "0.63448626", "0.63132", "0.63132", "0.6307794", "0.629056", "0.626724", ...
0.79949164
0
Device ID (Device ID (page 36)) of the accessory. The Device ID must be formatted as "XX:XX:XX:XX:XX:XX", where "XX" is a hexadecimal string representing a byte. Required. This value is also used as the accessory's Pairing Identifier.
def device_id accessory_info.device_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manufacturer_id\n mac[0..7]\n end", "def id; Common.device_id(@handle); end", "def device_id\n apn_device_token\n end", "def mount_uuid(device)\n device[\"uuid\"] || \"#{device['pciBusNumber']}#{device['pciDeviceNumber']}\"\n end", "def device_id=(value)\n @device_id ...
[ "0.6650141", "0.6524009", "0.65004176", "0.6334394", "0.62185943", "0.62185943", "0.62185943", "0.62185943", "0.6063535", "0.60326", "0.59294474", "0.59294474", "0.59294474", "0.59294474", "0.5891051", "0.5865704", "0.5844715", "0.5816764", "0.5807487", "0.5807487", "0.580182...
0.7948977
0
Model name of the accessory (e.g. "Device1,1"). Required.
def model_name configuration.model_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def model_name\n fetch('device.model_name')\n end", "def model\n\t\t\t\t@@name ||= cpuinfo.find { |x| x.start_with?('model name') }.to_s.split(?:)[-1].to_s.strip\n\t\t\tend", "def get_name\n \"#{@manufacturer} #{@model}\"\n end", "def display_name\n self.device_name || \"#{vendor} #{mo...
[ "0.6658347", "0.65587103", "0.63465416", "0.6075161", "0.60517156", "0.6007748", "0.5913335", "0.586484", "0.586484", "0.5832105", "0.5829733", "0.5827096", "0.572589", "0.5693562", "0.5693562", "0.5681665", "0.56389344", "0.5623749", "0.5623749", "0.56057966", "0.5598362", ...
0.5693795
13
Protocol version string . (e.g. "1.0"). Required if value is not "1.0". The client should check this before displaying an accessory to the user. If the major version is greater than the major version the client software was built to support, it should hide the accessory from the user. A change in the minor version indicates the protocol is still compatible. This mechanism allows future versions of the protocol to hide itself from older clients that may not know how to handle it.
def protocol_version 1.0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocol_version\n @protocol_version\n end", "def protocol\n v = @head.fetch[1]\n raise \"Invalid protocol version name '#{v}'\" unless v =~ /^[0-9]+$/\n v.to_i\n end", "def client_protocol_version\n match = @automation_client << VERSION_CONSTANT_NAME >> /\\d*/\n ver...
[ "0.7065714", "0.6875885", "0.6680349", "0.657341", "0.6572211", "0.6570602", "0.6561342", "0.6547135", "0.6513224", "0.6509664", "0.64903367", "0.6476166", "0.6465508", "0.6458576", "0.6436795", "0.64357877", "0.63741386", "0.6372931", "0.6337539", "0.6331588", "0.6328641", ...
0.71443456
0
Current state number. Required. This must have a value of "1".
def current_state_number 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n self['STATE'].to_i\n end", "def state\n ...
[ "0.75518525", "0.75518525", "0.75518525", "0.75518525", "0.75518525", "0.75518525", "0.7165593", "0.70717674", "0.707", "0.6917625", "0.6858879", "0.683597", "0.6824861", "0.67835927", "0.6770794", "0.6749962", "0.67178357", "0.66342056", "0.66289854", "0.662097", "0.6596022"...
0.90071774
0
input params details Hash creds Hash Creates profile hash Return Hash
def profile_hash(details, creds) params = {} params[:api_type] = details[:api_type] params[:license_key] = creds[:license_key] params[:login_id] = creds[:login_id] params[:version] = details[:version] params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_params(params_hash)\n {first_name: params_hash[\"first_name\"], last_name: params_hash[\"last_name\"], login: params_hash[\"login\"], email: params_hash[\"email\"], age: params_hash[\"age\"], gender: params_hash[\"gender\"], mobile_number: params_hash[\"mobile_number\"], home_number: params_hash[\"ho...
[ "0.63316673", "0.6186767", "0.61442834", "0.6048971", "0.59673345", "0.5844453", "0.5812668", "0.5773612", "0.57390225", "0.5733584", "0.569696", "0.5688433", "0.56313103", "0.56228846", "0.5620515", "0.560688", "0.5590333", "0.5583063", "0.5567251", "0.55136836", "0.549811",...
0.7602301
0
input params none Creates hash containing required namespaces Returns Hash
def namespaces ns = {} ns[:envelope] = {key:'env', value: 'http://www.w3.org/2003/05/soap-envelope'} ns[:content] = {key:'ns1', value: 'http://tempuri.org/'} ns[:profile] = {key:'ns2', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Admin'} ns[:wsa] = {key:'ns3', value: 'http://www.w3.org/2005/08/addressing'} ns[:shipment] = {key:'ns4', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.WayBillGeneration'} ns[:pickup] = {key:'ns5', value: 'http://schemas.datacontract.org/2004/07/SAPI.Entities.Pickup'} ns end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespaced_hash\n\t\tif @namespace\n\t\t\tself.log.debug \"Returning namespaced hash: %p\" % [ @namespace ]\n\t\t\treturn @hash[ @namespace ]\n\t\telse\n\t\t\tself.log.debug \"Returning toplevel namespace\"\n\t\t\treturn @hash\n\t\tend\n\tend", "def namespace_hash\n opt = {}\n namespaces.each do |t...
[ "0.6780536", "0.6748796", "0.6440844", "0.6384767", "0.6277352", "0.6193123", "0.6181907", "0.61389565", "0.6022141", "0.5953143", "0.5928151", "0.59237945", "0.59115016", "0.59115016", "0.5900436", "0.5900436", "0.58693445", "0.58693445", "0.58693445", "0.58693445", "0.58677...
0.6348194
4
input params none Creates hash with xml styled namespace key and value Returns Hash
def namespace_hash opt = {} namespaces.each do |type, attrs| key = "xmlns:#{attrs[:key]}" opt[key] = attrs[:value] end opt end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xmlns_hash\n {xmlns_attr => @uri.to_s}\n end", "def xmlns\n a = collection.map(&:xmlns).uniq\n a.delete nil\n h = {}\n a.each { |e| h.merge! e }\n h\n end", "def hash_xml(xml, params)\n params.each do |key, value|\n xml = xml_key_value(key, value,...
[ "0.72046477", "0.6488843", "0.6413959", "0.632494", "0.63216746", "0.6313086", "0.62136936", "0.61286217", "0.59840614", "0.59808946", "0.5948034", "0.59135586", "0.58593273", "0.58593273", "0.58482355", "0.577354", "0.5701416", "0.5701416", "0.5674257", "0.5618575", "0.55914...
0.72842026
0
input params name symbol Provides key for a given namespace block Returns String
def namespace_key(name) namespaces[name][:key] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def keyName _args\n \"keyName _args;\" \n end", "def key_for(key)\n key_parts = []\n key_parts << @namespace if @namespace && @namespace.length > 0\n \n # Gracefully handles arrays passed here as well, due to the flatten\n key_parts << key\n key_parts.flatten.join ':'\n end", "def ap...
[ "0.6952362", "0.66107166", "0.6548422", "0.6543802", "0.64207786", "0.63979405", "0.6382493", "0.6374394", "0.6374394", "0.63716847", "0.63481677", "0.63313764", "0.6321871", "0.6305411", "0.62155485", "0.6168985", "0.61511546", "0.6150384", "0.61479384", "0.61326885", "0.612...
0.66669595
1
input params xml Nokogiri::XML::Builder values Hash Appends Profile XML Block Returns Nokogiri::XML::Builder
def profile_xml(xml, values) ns_key = "#{namespace_key(:profile)}" xml[ns_key].Api_type values[:api_type] xml[ns_key].LicenceKey values[:license_key] xml[ns_key].LoginID values[:login_id] xml[ns_key].Version values[:version] xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def adjustXML(params)\n begin\n Nokogiri::XML::Builder.new do |xml|\n xml.Adjust('xmlns:i' => 'http://www.w3.org/2001/XMLSchema-instance',\n 'xmlns' => 'http://schemas.ipcommerce.com/CWS/v2.0/Transactions/Rest', 'i:type' =>\"Adjust\" ) {\n xml.ApplicationProfileId applicat...
[ "0.6072431", "0.6044903", "0.5989977", "0.59632987", "0.5899327", "0.5803321", "0.57723147", "0.57187515", "0.57159793", "0.5644152", "0.5611906", "0.55903727", "0.553693", "0.5512674", "0.54804975", "0.5413496", "0.54005283", "0.5387056", "0.53659105", "0.5338323", "0.531247...
0.59463334
4
input params xml Nokogiri::XML::Builder wsa string Appends Header XML Block Returns Nokogiri::XML::Builder
def header_xml(xml, wsa) xml.Header { xml["#{namespace_key(:wsa)}"].Action(wsa, "#{namespace_key(:envelope)}:mustUnderstand" => true) } xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_xml_header(xml,options)\n xml.instruct!(:xml, :version => '1.0', :encoding => 'utf-8')\n xml.instruct!(:qbmsxml, :version => API_VERSION)\n end", "def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UT...
[ "0.6509528", "0.6177531", "0.6108406", "0.6100883", "0.5938591", "0.59325767", "0.5897539", "0.58036494", "0.5800524", "0.5794032", "0.5784796", "0.57765085", "0.5752235", "0.57164997", "0.57103777", "0.5706095", "0.5697153", "0.5680998", "0.5669454", "0.5663201", "0.5641208"...
0.6021854
4
input params xml Nokogiri::XML::Builder params Hash Transform Hash to XML Returns Nokogiri::XML::Builder
def hash_xml(xml, params) params.each do |key, value| xml = xml_key_value(key, value, xml) end xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def from_hash_to_xml(hash)\n hash.to_xml(root: 'Request', skip_types: true, dasherize: false, skip_instruct: true)\n end", "def build_xml(hash)\n result_xml = \"\"\n builder = Builder::XmlMarkup.new(:target=>result_xml,:indent=>4)\n builder.tag!(\"configuration\") { \n hash.each do|name,value...
[ "0.6663924", "0.6500334", "0.64892787", "0.64802545", "0.6479961", "0.6425138", "0.64242554", "0.63454354", "0.62958556", "0.6286198", "0.6254357", "0.6252403", "0.6219665", "0.6219665", "0.6219665", "0.6219665", "0.6219665", "0.6219665", "0.6192875", "0.6163186", "0.61136216...
0.74917316
0
TODO: ITS A HACK NEEDS TO BE REMOVED input params key string Removes last letter from string Returns String
def singular(key) key = key[0..-2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_param(a_keys, string_replace_pair = nil)\n return \"\" if a_keys.nil?\n value = nil\n \n a_keys.each do |key|\n \n if key.nil?\n value = \"\"\n break\n end\n \n if value.nil?\n value = params[key]\n else\n value = value[key]\n end\n...
[ "0.6548127", "0.649044", "0.641167", "0.6376579", "0.6348171", "0.62759507", "0.61835957", "0.61698365", "0.6121921", "0.6119482", "0.61151516", "0.60640424", "0.6024865", "0.6024865", "0.60220003", "0.6015338", "0.5992579", "0.5980385", "0.5967669", "0.5937244", "0.59355485"...
0.0
-1
input params xml Nokogiri::XML::Builder message String params Hash extra Hash Appends Body XML Block Returns Nokogiri::XML::Builder
def body_xml(xml, message, params, extra) content_ns_key = "#{namespace_key(:content)}" xml.Body { xml[content_ns_key].send(message) do |xml| hash_xml(xml, params) extra.each do |key, value| xml[content_ns_key].send(key) { profile_xml(xml, value)} if key.downcase == 'profile' end end } xml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml[envelope_ns_key].Envelope(namespace_hash) {\n xml = header_xml(xml, opts[:wsa])\n xml = body_xml(xml, opts[:message], opts[:params], ...
[ "0.6673366", "0.64901507", "0.64178294", "0.63815624", "0.63729495", "0.6327653", "0.62272024", "0.6222409", "0.6173117", "0.6148509", "0.61327696", "0.6096793", "0.602321", "0.6011856", "0.60064226", "0.59910583", "0.59805185", "0.5979899", "0.59646016", "0.59045887", "0.587...
0.6471133
2
input params opts Hash Create XML Request Returns Nokogiri::XML::Builder
def request_xml(opts) envelope_ns_key = "#{namespace_key(:envelope)}" builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml| xml[envelope_ns_key].Envelope(namespace_hash) { xml = header_xml(xml, opts[:wsa]) xml = body_xml(xml, opts[:message], opts[:params], opts[:extra]) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xml_builder(opts=OPTS)\n if opts[:builder]\n opts[:builder]\n else\n builder_opts = if opts[:builder_opts]\n Hash[opts[:builder_opts]]\n else\n {}\n end\n builder_opts[:encoding] = opts[:encoding] if opts.has_key...
[ "0.7675224", "0.7243477", "0.72227716", "0.6989534", "0.69589084", "0.6958605", "0.6941335", "0.6933127", "0.69184613", "0.6903904", "0.68768656", "0.6862853", "0.6801359", "0.6779646", "0.6756451", "0.67446196", "0.67021155", "0.665016", "0.6595921", "0.6534636", "0.65085196...
0.79816663
0
input params opts Hash Fire XML request and return parsed response Returns Hash
def make_request(opts, request_type) if request_type == "pincode" body = request_data_pincode(opts) elsif request_type == "fetch_awb" body = request_data_fetch_awb(opts) elsif request_type == "shipment" body = request_data_shipment(opts) elsif request_type == "cancel" body = request_data_cancel(opts) end response = request(opts[:url], body) if request_type == "pincode" response_return(response, opts[:message]) elsif request_type == "fetch_awb" response_return_awb_fetch(response, opts[:message]) elsif request_type == "cancel" response_return_cancel(response, opts[:message]) elsif request_type == "shipment" response_return_shipment(response, opts[:message]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_xml_request_object( opts={} )\n\t\tdata = make_xml_request( opts )\n\t\treturn Mongrel2::Request.parse( data )\n\tend", "def request\n result = {}\n req_xml.blank? ? xml = '' : xml = req_xml\n doc = Hpricot.XML(xml)\n (doc/:RequestAuth/:UserPass/:User).inner_html = 'XXXXXXXX'\n (doc/:Requ...
[ "0.60898954", "0.60599065", "0.58702046", "0.5856311", "0.5848609", "0.5811417", "0.5762241", "0.576201", "0.57524514", "0.57434124", "0.5735415", "0.56679183", "0.5563534", "0.55620056", "0.54717684", "0.54529613", "0.54523104", "0.5385284", "0.537412", "0.53726965", "0.5369...
0.0
-1
input params prefix String content Hash Removes Junk content from response Returns Hash
def required_content(prefix, content) if content[:fault].nil? prefix_s = prefix.snakecase keys = (prefix_s + '_response').to_sym, (prefix_s + '_result').to_sym return content[keys[0]][keys[1]] else return {error: true, error_text: content[:fault]} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n @sha_in_phrase = \"\"\n @params = {}\n end", "def query_string_to_hash query_string\n Hash[*query_string.scan(/(.+?)=(.*?)(?:&|$)/).flatten].each_value {|v|\n v.gsub!('+', ' ')\n v.gsub!(/%([0-9a-f]{2})/i) { [$1.hex].pack 'C' }\n }\nend", "def http_query_string_sgcb\n <<-END...
[ "0.56650925", "0.5484712", "0.54672277", "0.5461012", "0.5407068", "0.5391569", "0.539061", "0.53817666", "0.5358833", "0.5352287", "0.5352287", "0.5325019", "0.5304713", "0.5278725", "0.5250268", "0.5237892", "0.5230543", "0.52170044", "0.5207745", "0.5191694", "0.5186182", ...
0.0
-1
input params url String body String Fires request and returns response Returns Hash
def request(url, body) #res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset="utf-8"'}, :verify => false) res = HTTParty.post(url, body: body, headers: {'Content-Type' => 'application/soap+xml; charset="utf-8"'}, :verify => false) p "response is: #{res}. response body is: #{res.body} for url: #{url}" content = JSON.parse(res.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(params, url=\"https://baconipsum.com/api?\")\n if params[\"paras\"] && params[\"sentences\"]\n puts \"Just a warning that sentences override paras...\"\n end\n endpoint = url + URI.encode_www_form(params)\n print \"Endpoint is : \"\n puts endpoint\n body = open(endpoint).read\n return body\nend",...
[ "0.66644126", "0.6285718", "0.6265867", "0.6212512", "0.6198425", "0.6156802", "0.6138468", "0.60922974", "0.6068635", "0.6062434", "0.6055962", "0.60509175", "0.60019356", "0.59859484", "0.5978815", "0.5976021", "0.59700996", "0.59606093", "0.5958127", "0.58750105", "0.58733...
0.5679149
35
input params xml String Converts XML to Hash Returns Hash
def xml_hash(xml) nori = Nori.new(strip_namespaces: true, :convert_tags_to => lambda { |tag| tag.snakecase.to_sym }) nori.parse(xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_xml(xml, params)\n params.each do |key, value|\n xml = xml_key_value(key, value, xml)\n end\n xml\n end", "def from_xml_to_hash(xml)\n Hash.from_xml(xml)\n end", "def to_hash\n XMLUtils.to_hash xml\n end", "def xml_to_hash(xml) #:nodoc:\r\n h = Hash.new\r\...
[ "0.7985432", "0.71275604", "0.7019319", "0.69680625", "0.6777598", "0.66800123", "0.66342956", "0.66043067", "0.64475095", "0.6410871", "0.63443726", "0.6330942", "0.6281352", "0.623608", "0.6098949", "0.6055402", "0.6020027", "0.60098785", "0.6001947", "0.59938717", "0.59498...
0.70849943
2
input params address String line_length Integer Splits address into array by count of characters Returns Array
def multi_line_address(address, line_length) multi_line_address_block = [] i = 0 address.split(/[ ,]/).each do |s| if multi_line_address_block[i].blank? multi_line_address_block[i] = s elsif (multi_line_address_block[i].length + s.length < line_length) multi_line_address_block[i] += ' ' + s else i += 1 multi_line_address_block[i] = s end end multi_line_address_block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end", "def address_lines(join_chars = ', ')\n address_lines_array.join(join_chars)\n end", "def retrieveaddressnameskey(fileonedata)\n arr = Array.new\n fileonedata.each_line.with_index do |single_line, index|\n ...
[ "0.6086027", "0.6086027", "0.59020334", "0.58477795", "0.57700545", "0.5739826", "0.57133204", "0.5703481", "0.5662795", "0.5649229", "0.56279105", "0.5496859", "0.5472747", "0.5464394", "0.5436896", "0.54214835", "0.54214835", "0.5396717", "0.53947943", "0.5386258", "0.53841...
0.74359864
0
week_number starts from 1, the first week of this year
def end_of_week(week_number, year = Time.zone.now.year) year ||= Date.today.year t = Time.zone.parse("#{year}-01-01").end_of_week + (week_number-1).weeks t.beginning_of_day end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year_week\n @year_week ||= (((date-start_of_year)+1)/7.0).ceil\n end", "def week_start(week_num, year = 0)\n year = Time.now.year if year == 0\n \n begin\n first_date_of_the_week = Date.commercial(year, week_num, 1)\n \n # Date.commercial throws an exception if it can't find the...
[ "0.8306293", "0.80637646", "0.78102523", "0.7529985", "0.74719477", "0.7470153", "0.73917955", "0.72958666", "0.72229254", "0.721358", "0.7193518", "0.71310675", "0.7127264", "0.71219087", "0.7055835", "0.70340496", "0.7028733", "0.70048755", "0.69946295", "0.698897", "0.6988...
0.6881642
26
Provides getter for finding theme procedure's name
def theme_finder_method #:nodoc: return @theme_finder_method if @theme_finder_method return self.superclass.theme_finder_method if self.superclass.respond_to? :theme_finder_method "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n theme.name\n end", "def template_theme_id_from_method_name(method_name)\n regex = Spree::TemplateTheme.complied_method_name_prefix_regex\n if method_name.to_s.match(regex) && template_theme_id = method_name.to_s.sub(regex, '')\n template_theme_id if Spree::TemplateTheme.ex...
[ "0.745707", "0.6762805", "0.66689485", "0.6659145", "0.621971", "0.6202992", "0.6181592", "0.61689234", "0.6159861", "0.6159074", "0.6010259", "0.5942806", "0.5937906", "0.5861762", "0.58470106", "0.5789407", "0.5742901", "0.5730958", "0.5730958", "0.5730958", "0.56972986", ...
0.6531961
4
Execute this method in your controller's class body to enable costomized actions Example: class ShoppingController before_filter :find_current_user has_customizable_actions :current_users_theme def index
def has_customizable_actions(finder_method) @actions_theme_finder_method = finder_method before_filter :cheap_themes_prepare_customized_actions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_filters\n set_user\n authorize\n end", "def index\n if current_user.try(:admin?)\n @custom_products = CustomProduct.all\n else\n redirect_to root_path\n end\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n e...
[ "0.6315138", "0.6188643", "0.6149817", "0.6133754", "0.5972841", "0.5965821", "0.5960279", "0.5957186", "0.5928054", "0.5918485", "0.58941346", "0.586889", "0.5819785", "0.58081853", "0.5803873", "0.5795353", "0.5793769", "0.5774699", "0.5774684", "0.57593894", "0.5757659", ...
0.65247446
0
Getter for action finding theme name
def actions_theme_finder_method #:nodoc: return @actions_theme_finder_method if @actions_theme_finder_method return self.superclass.actions_theme_finder_method if self.superclass.respond_to? :actions_theme_finder_method nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def theme_name\n \n if params[:action] == \"home\"\n @theme_name = ThemeOption.where(user_id: current_user.id).first.template.downcase\n else\n \"application\"\n end\n end", "def theme_name\n if params[:action] == \"home\"\n @theme_name = ThemeOption.where(user_id: current...
[ "0.785173", "0.7800623", "0.74086916", "0.7094086", "0.6790278", "0.6715456", "0.6587915", "0.65819085", "0.6573112", "0.6490524", "0.6478445", "0.6369332", "0.6361066", "0.6304999", "0.62673455", "0.6216364", "0.6206517", "0.6203986", "0.6184659", "0.61456585", "0.61342424",...
0.63886726
11
This method dynamically sets view_paths where Rails is looking for template files
def cheap_themes_setup_view_paths #:nodoc: theme = self.send(self.class.theme_finder_method) self.view_paths = ::ActionController::Base.view_paths.dup.unshift("#{RAILS_ROOT}/themes/#{theme}/views") \ if theme and theme =~ /^[\w\.\-\+]+$/i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_paths\n paths = Engines.plugins.by_precedence.map { |p| \"#{p.directory}/app/views/#{mailer_name}\" }\n paths.unshift(template_path_without_engine_additions) unless Engines.disable_application_view_loading\n paths\n end", "def template_paths\n paths = Rails.plugins.by_preced...
[ "0.7525188", "0.74878424", "0.7428354", "0.7372836", "0.730133", "0.722362", "0.71821463", "0.71395373", "0.7019477", "0.697655", "0.68982875", "0.6814577", "0.68112063", "0.68112063", "0.6800843", "0.6786888", "0.6786888", "0.6786888", "0.6745949", "0.6683381", "0.6604116", ...
0.73956984
3
Method which loads customized actions, adds them into controller as instance variables, and aliases original action methods so that they dynamically make decision wether execute standard, or themed action.
def cheap_themes_prepare_customized_actions #:nodoc: if (tfm = self.class.actions_theme_finder_method) and theme = self.send(tfm) \ and theme != nil and theme =~ /^[\w\.\-\+]+$/i and \ File.exists?("#{RAILS_ROOT}/themes/#{theme}/controllers/#{controller_name}/#{action_name}.rb") if Rails.configuration.cache_classes == false or not (self.respond_to? "cheap_themes_customized_action_#{controller_name}_#{action_name}") ruby_code = "def cheap_themes_customized_action_#{theme}_#{controller_name}_#{action_name}\n" f = File.new "#{RAILS_ROOT}/themes/#{theme}/controllers/#{controller_name}/#{action_name}.rb" ruby_code += f.read f.close ruby_code += "\nend" eval ruby_code end #self.send "cheap_themes_customized_action_#{controller_name}_#{action_name}" unless self.respond_to? "cheap_themes_original_action_#{action_name}" self.class_eval <<CLS_EVAL alias_method "cheap_themes_original_action_#{action_name}".to_sym, "#{action_name}".to_sym private "cheap_themes_original_action_#{action_name}".to_sym CLS_EVAL ruby_code = <<INS_EVAL def #{action_name} theme = self.send(self.class.actions_theme_finder_method) if self.respond_to? "cheap_themes_customized_action_\#{theme}_\#{controller_name}_\#{action_name}" self.send("cheap_themes_customized_action_\#{theme}_\#{controller_name}_\#{action_name}") else cheap_themes_original_action_\#{action_name} end end INS_EVAL self.class_eval ruby_code end puts "??????" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions\n @actions ||= self.class.registered_actions.inject({}){ |res, name| res.merge(name.to_sym => normalize_action_config(send(ACTION_METHOD_NAME % name))) }\n end", "def define_actions_from_routes\n (effective_resource.member_actions - effective_resource.crud_actions).each do |action|\n ...
[ "0.70253336", "0.6803451", "0.66849554", "0.66676664", "0.6578159", "0.6578159", "0.6578159", "0.6447404", "0.64327675", "0.6432553", "0.63674796", "0.63606644", "0.63380027", "0.6325354", "0.63096833", "0.6284598", "0.6256681", "0.6243191", "0.6165427", "0.6164937", "0.61571...
0.6869152
1
custom method to return the Pile's top most (most recently updated card) when displaying a pile during game play I only need the topMost card
def topMostCard object.cards.mostRecentlyUpdated.one[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top\n cards.first\n end", "def high_card\n @cards.sort[-1]\n end", "def get_top_order\n cards.maximum('card_order') || 0\n end", "def higher_item\n return nil unless list_id\n Card.find :first,\n :conditions => \"list_id = #{list_id} AND list_position > #{list_position}\"...
[ "0.80254686", "0.77822596", "0.75621617", "0.7364492", "0.7272669", "0.699253", "0.69880885", "0.69679177", "0.6882524", "0.6873999", "0.68197584", "0.6793394", "0.67237663", "0.6659285", "0.6653447", "0.66349614", "0.66198695", "0.6598164", "0.65829575", "0.65653765", "0.655...
0.8292629
0
GET /programming_ls GET /programming_ls.json
def index @programming_ls = ProgrammingL.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def list_languages\n\t\trender json: Language.all.to_json\n\tend", "def set_programming_l\n @programming_l = ProgrammingL.find(params[:id])\n end", "def show\n ...
[ "0.6371114", "0.63018894", "0.6271351", "0.6067761", "0.6051087", "0.5928001", "0.5917779", "0.59081", "0.59081", "0.58326715", "0.5827412", "0.5819191", "0.58132464", "0.5802261", "0.57765377", "0.57738197", "0.57688224", "0.5748535", "0.5745939", "0.57363534", "0.573216", ...
0.7078502
0
GET /programming_ls/1 GET /programming_ls/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @programming_ls = ProgrammingL.all\n end", "def index\n @lophs = Loph.all\n respond_to do |format|\n format.html\n format.json { render json: @lophs}\n end\n end", "def show\n @laboratory = Laboratory.find(params[:id])\n\n respond_to do |format|\n format.html # sh...
[ "0.6748882", "0.6251404", "0.6214075", "0.6179671", "0.6142768", "0.6142768", "0.61274856", "0.61227304", "0.6122073", "0.60977465", "0.6056294", "0.6056294", "0.6034348", "0.60171336", "0.6012732", "0.59993386", "0.59954023", "0.5993546", "0.5986398", "0.5951177", "0.5917607...
0.0
-1
POST /programming_ls POST /programming_ls.json
def create @programming_l = ProgrammingL.new(programming_l_params) respond_to do |format| if @programming_l.save format.html { redirect_to @programming_l, notice: 'Programming l was successfully created.' } format.json { render :show, status: :created, location: @programming_l } else format.html { render :new } format.json { render json: @programming_l.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @programming_language = ProgrammingLanguage.new(programming_language_params)\n\n respond_to do |format|\n if @programming_language.save\n format.html { redirect_to @programming_language, notice: 'Programming language was successfully created.' }\n format.json { render :show, s...
[ "0.6145574", "0.6137429", "0.5930232", "0.5800555", "0.5724026", "0.5620133", "0.5583557", "0.5492228", "0.5486231", "0.5466694", "0.5447541", "0.5440771", "0.5430231", "0.5385806", "0.5359673", "0.5341033", "0.53097296", "0.5282675", "0.5267561", "0.52498096", "0.5246527", ...
0.69914126
0
PATCH/PUT /programming_ls/1 PATCH/PUT /programming_ls/1.json
def update respond_to do |format| if @programming_l.update(programming_l_params) format.html { redirect_to @programming_l, notice: 'Programming l was successfully updated.' } format.json { render :show, status: :ok, location: @programming_l } else format.html { render :edit } format.json { render json: @programming_l.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'P...
[ "0.65916646", "0.6566062", "0.65142447", "0.6268591", "0.62439615", "0.6195073", "0.6171107", "0.61493707", "0.61359805", "0.610094", "0.606122", "0.6058327", "0.5999651", "0.59584874", "0.5957754", "0.5957754", "0.59522265", "0.59503764", "0.59354913", "0.5925286", "0.591404...
0.6753642
0
DELETE /programming_ls/1 DELETE /programming_ls/1.json
def destroy @programming_l.destroy respond_to do |format| format.html { redirect_to programming_ls_url, notice: 'Programming l was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{...
[ "0.68014616", "0.6796414", "0.6775461", "0.6720121", "0.67179626", "0.6686119", "0.6686119", "0.6686119", "0.6686119", "0.66760236", "0.6671061", "0.6588158", "0.6554517", "0.65532136", "0.6538375", "0.6533994", "0.6524146", "0.6520496", "0.64820236", "0.6475649", "0.64743876...
0.6899628
0
Use callbacks to share common setup or constraints between actions.
def set_programming_l @programming_l = ProgrammingL.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def programming_l_params params.require(:programming_l).permit(:name, :imgLink, :percent_iq) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /expeditions GET /expeditions.json
def index @expeditions = current_user.expedition_instances.map(&:expedition) @userFuelFactor = 1 + (0.1 * current_user.science_instances.find_by(:science_id => Science.find_by(:name => "Triebwerke").id).level) @expeditions.each do |expi| if(expi.arrival_time < (Time.now + 2.hours )) expi.explore expi.expedition_instance.destroy expi.destroy end end @expi_home = Hash.new @expeditions = current_user.expedition_instances.map(&:expedition) @current_progress = Hash.new @expeditions.each do |exp| @current_progress[exp.id] = ((Time.now + 2.hours) - exp.arrival_time + exp.explore_time.hours) @expi_home[exp.id] = Ship.find_by_id(exp.ship_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_editions(params = {})\n get_json(get_editions_url(params))\n end", "def get_editions(ol_keys)\n editions = []\n ol_keys.each do |k|\n link = @api_url + \"/get?key=\" + k\n resp = open(link).read\n editions << JSON.parse(resp)['result']\n end\n return editions\n end", "de...
[ "0.82514954", "0.6343765", "0.6339353", "0.62797946", "0.6223133", "0.6217521", "0.62038374", "0.58009964", "0.57632273", "0.5662384", "0.5527477", "0.5498946", "0.5494939", "0.5477786", "0.5467458", "0.539922", "0.53567326", "0.53567326", "0.5334349", "0.5274883", "0.5274222...
0.55193585
11
GET /expeditions/1 GET /expeditions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_editions(params = {})\n get_json(get_editions_url(params))\n end", "def index\n @digital_editions = DigitalEdition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @digital_editions }\n end\n end", "def show\n @exp = Exp.find(params[:...
[ "0.78081566", "0.6317441", "0.607831", "0.60735905", "0.6063757", "0.60467565", "0.60001045", "0.59841216", "0.5954682", "0.589621", "0.58430356", "0.58047515", "0.58016646", "0.5772475", "0.5730854", "0.5715174", "0.56952393", "0.56952393", "0.56919914", "0.5681525", "0.5681...
0.0
-1
POST /expeditions POST /expeditions.json
def create @expedition = Expedition.new(expedition_params) @userFuelFactor = 1 + (0.1 * current_user.science_instances.find_by(:science_id => Science.find_by(:name => "Triebwerke").id).level) if(params[Unit.find_by_name("Expeditionsschiff").id.to_s].to_i < 1) redirect_to expeditions_url, alert: 'Mindestens 1 Expeditionsschiff wird benötigt.' return end Unit.all.each do |unit| instance = current_user.active_ship.get_unit_instance(unit) if instance.amount < params[unit.id.to_s].to_i redirect_to expeditions_url, alert: 'Nicht genügend Schiffe.' return end end fuelcost = 0 Unit.all.each do |unit| fuelcost += (unit.shell + unit.cargo) * params[unit.id.to_s].to_i end fuelcost = (fuelcost * params[:exp_time].to_i/@userFuelFactor) userShip = current_user.active_ship if(userShip.fuel < fuelcost) string = "Nicht genügend Treibstoff um diese Flotte loszuschicken. Benötigt wird: " + fuelcost.to_i.to_s + " Treibstoff" redirect_to expeditions_url, alert: string return end @expedition.ship_id = userShip.id @expedition.explore_time = params[:exp_time].to_i @expedition.arrival_time = Time.now + 3600 * (2 + @expedition.explore_time) @expedition.fighting_fleet= FightingFleet.create(user: current_user) Unit.all.each do |unit| ship_group = @expedition.fighting_fleet.ship_groups.find_by(:unit_id => unit.id) ship_group.number = params[unit.id.to_s].to_i ship_group.save instance = current_user.active_ship.get_unit_instance(unit) instance.amount -= ship_group.number instance.save end userShip.fuel -= fuelcost userShip.save respond_to do |format| if @expedition.save ExpeditionInstance.create(user: current_user, expedition_id: @expedition.id) format.html { redirect_to @expedition, notice: 'Expedition was successfully created.' } format.json { render :show, status: :created, location: @expedition } else format.html { render :new } format.json { render json: @expedition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_editions(params = {})\n get_json(get_editions_url(params))\n end", "def create\n @expansion = Expansion.new(params[:expansion])\n\n respond_to do |format|\n if @expansion.save\n format.html { redirect_to @expansion, notice: 'Expansion was successfully created.' }\n format.jso...
[ "0.64755315", "0.5545091", "0.5517701", "0.5483492", "0.5378929", "0.53787076", "0.5358821", "0.5345733", "0.5285228", "0.5239357", "0.5205221", "0.5191878", "0.51569194", "0.51225626", "0.512057", "0.5067661", "0.5064584", "0.50600874", "0.5007182", "0.49774903", "0.4970321"...
0.45837873
70
PATCH/PUT /expeditions/1 PATCH/PUT /expeditions/1.json
def update respond_to do |format| if @expedition.update(expedition_params) format.html { redirect_to @expedition, notice: 'Expedition was successfully updated.' } format.json { render :show, status: :ok, location: @expedition } else format.html { render :edit } format.json { render json: @expedition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @expansion = Expansion.find(params[:id])\n\n respond_to do |format|\n if @expansion.update_attributes(params[:expansion])\n format.html { redirect_to @expansion, notice: 'Expansion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html...
[ "0.63346606", "0.62352884", "0.6131727", "0.5991146", "0.59752655", "0.5938095", "0.59366256", "0.59344745", "0.59344745", "0.59344745", "0.59256446", "0.5915982", "0.5915156", "0.5915156", "0.5905168", "0.58960545", "0.58941483", "0.58592623", "0.5859107", "0.5832671", "0.58...
0.62174165
2
DELETE /expeditions/1 DELETE /expeditions/1.json
def destroy @expedition.destroy respond_to do |format| format.html { redirect_to expeditions_url, notice: 'Expedition was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to exps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @addimition = Addimition.find(params[:id])\n @addimition.destroy\n\n respond_to do |format|\n...
[ "0.67970204", "0.6764061", "0.6762501", "0.6625155", "0.655659", "0.64599854", "0.6441162", "0.6417855", "0.6410556", "0.6371428", "0.6359656", "0.6344438", "0.6342356", "0.6301284", "0.6301284", "0.62960637", "0.62960637", "0.62960637", "0.62960637", "0.62957597", "0.6275790...
0.6937732
0
Use callbacks to share common setup or constraints between actions.
def set_expedition @expedition = Expedition.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def expedition_params params[:expedition] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.629117...
0.0
-1
Tells rails to use this uploader for this model.
def image_url if image.present? image else "http://loremflickr.com/320/240/#{CGI.escape name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_uploader\n @uploader = Uploader.find(params[:id])\n end", "def uploader() @uploader ||= Flickr::Uploader.new(self) end", "def uploader_options\n end", "def media_option\n super\n end", "def upload\n do_upload(self.class.upload_class)\n end", "def uploader\n @up...
[ "0.6358246", "0.6318439", "0.61963964", "0.61830914", "0.6159992", "0.6049093", "0.58721536", "0.580967", "0.57922536", "0.57657546", "0.57008475", "0.5697238", "0.5697238", "0.5686164", "0.5683662", "0.5672279", "0.56549704", "0.56549704", "0.56549704", "0.56549704", "0.5654...
0.0
-1
You can assume that the sample data we provide will contain all date and time format variants you will need to handle. All the sample timestamps are in the form "4/1/11 11:00:00 AM" so I'm assuming I can use strptime on this plain parse doesn't work because it parses the above as January 4, not April 1 The requirements have an ambiguity "The Timestamp column should be assumed to be in US/Pacific time" vs. "any times that are missing timezone information are in US/Pacific" Implies that their might be times that are missing but "You can assume that the sample data we provide will contain all date and time format variants you will need to handle" And there's nothing that has a sample timezone, so I'm going to assume Pacific. I brought in ActiveSupport, since they've got the time zone transformations already
def normalize @output ||= begin Time.zone = INPUT_TIME_ZONE date = Time.zone.strptime(input, "%m/%d/%y %l:%M:%S %p") date = date.in_time_zone(OUTPUT_TIME_ZONE).iso8601 @success = true date rescue ArgumentError, TypeError nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_timestamp(time_string, time_zone)\n time_string.slice!(0)\n time_zone.chomp(\"]\")\n Time.strptime(time_string.concat(time_zone), \"%d/%b/%Y:%T%z\")\n end", "def parse(tz_string); end", "def parse_datetime(dt, tz)\n offset = \"+00:00\"\n case tz\n when \"EST\"\n offs...
[ "0.6524168", "0.6487006", "0.6278718", "0.6043763", "0.5995636", "0.5887769", "0.5854936", "0.5779711", "0.5777228", "0.5694809", "0.56812793", "0.56754655", "0.56346846", "0.5622258", "0.5575587", "0.5574799", "0.5572386", "0.556125", "0.5557347", "0.5519892", "0.55129105", ...
0.52925473
31
Because the /kits endpoint just returns a list of kit ids and links, I deemed it simple enough to write a presenter that will take in the parsed response and print the info to the console. Creating a new class to hold a list of kits seems very much like overkill.
def kit_list_to_console(parsed_json) kits = parsed_json['kits'] puts "#{kits.count} kit(s) found:" kits.each_with_index do |kit_info, index| indented_puts "Kit ##{index + 1}:", 1 indented_puts "ID: #{kit_info['id']}", 2 indented_puts "Link: #{kit_info['link']}", 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_kits\n resp = make_request :get, \"kits\"\n check_response_for_field resp, \"kits\"\n end", "def list_kits\n resp = make_request :get, \"kits\"\n check_response_for_field resp, \"kits\"\n end", "def list_and_select_kit\n resp = @api.list_kits\n\n kit_ids = resp['kits'].map { ...
[ "0.7660895", "0.74252856", "0.64611006", "0.6399209", "0.6163092", "0.613508", "0.6026898", "0.6026084", "0.5893207", "0.5806503", "0.57265943", "0.56970817", "0.5587011", "0.55635345", "0.54667234", "0.5462435", "0.54182345", "0.53995186", "0.53943676", "0.53481853", "0.5323...
0.70471835
2
Takes in a Kit, formats the data and prints it to the console.
def kit_to_console(kit, indent_level=0) unless kit.is_a?(Kit) raise ArgumentError.new "Passed a different object into a Kit presenter" end # Print the first 3 fields before families. [:id, :name, :domains].each do |attr| indented_puts "#{attr.to_s}: #{kit.send(attr)}", indent_level end # Families have to be handled specially. indented_puts "families:", indent_level kit.families.each_with_index do |f, index| indented_puts "family ##{index + 1}:", indent_level + 1 font_family_to_console(f, indent_level + 2) end # Print the remaining field. indented_puts "optimize_performance: #{kit.optimize_performance}", indent_level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kit_list_to_console(parsed_json)\n kits = parsed_json['kits']\n\n puts \"#{kits.count} kit(s) found:\"\n kits.each_with_index do |kit_info, index|\n indented_puts \"Kit ##{index + 1}:\", 1\n indented_puts \"ID: #{kit_info['id']}\", 2\n indented_puts \"Link: #{kit_info['link']}\", 2\n ...
[ "0.7050509", "0.588266", "0.58314174", "0.58194685", "0.5810956", "0.57654357", "0.55702406", "0.54759973", "0.5460417", "0.5451907", "0.5402535", "0.5361557", "0.5339604", "0.53306055", "0.5326834", "0.5320704", "0.5285901", "0.5282168", "0.52709687", "0.5264327", "0.5258471...
0.7652478
0
Takes in a FontFamily, formats the data, and prints it to the console.
def font_family_to_console(family, indent_level=0) unless family.is_a?(FontFamily) raise ArgumentError.new "Passed a different object into a FontFamily presenter" end # Go through each field and print. family.instance_variables.each do |attr| attr = attr.to_s.delete('@') indented_puts "#{attr}: #{family.send(attr.to_sym)}", indent_level end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def family\n @family ||= family_options.map do |font_name, font_options|\n name = parse_font_name(font_name)\n\n options = font_options.sort.uniq\n\n options.any? ? \"#{name}:#{options.join(',')}\" : name\n end.join('|')\n end", "def print_example\n for font in $pre...
[ "0.6197491", "0.6149265", "0.60617167", "0.5790848", "0.55542284", "0.549151", "0.54642254", "0.5441432", "0.53678995", "0.5349914", "0.53483295", "0.5342875", "0.5342875", "0.5317594", "0.5265321", "0.5252424", "0.5248847", "0.5229278", "0.5221839", "0.52040255", "0.5201088"...
0.7976272
0
Method to call puts with prefixed indent spacing depening on indent_level.
def indented_puts(string, indent_level) puts "#{INDENT * indent_level}#{string}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def puts_indent(level, text)\n print \" \"*level, text, \"\\n\"\nend", "def pretty_print(io = STDOUT, level = 0, indent = ' ')\n io.puts(indent * level + self.to_s)\n end", "def indent_out\n @indent << \" \"\n end", "def indent_string(level = 0)\n INDENT * level\n end", "def inde...
[ "0.8186388", "0.6787609", "0.6705798", "0.6501691", "0.6496488", "0.6465877", "0.6465877", "0.6465877", "0.6465877", "0.6465877", "0.64531595", "0.6308199", "0.6268558", "0.6229607", "0.6229542", "0.6215291", "0.6213106", "0.6105352", "0.6087043", "0.6056986", "0.6047884", ...
0.7810453
1
A = rock B = paper C = scissors X = rock Y = paper Z = scissors Points: Rock: 1 Paper: 2 Scissors: 3 Lose: 0 Tie: 3 Win: 6
def outcome_score(theirs, mine) return 3 if (theirs == 'A' && mine == 'X') || (theirs == 'B' && mine == 'Y') || (theirs == 'C' && mine == 'Z') # tie return 6 if (theirs == 'A' && mine == 'Y') || (theirs == 'B' && mine == 'Z') || (theirs == 'C' && mine == 'X') # win 0 # lose end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scoreRock m\n\t\t[0,1] \n\tend", "def score\n p_score = player_hand.collect{|x| x.value}.inject(:+)\n c_score = computer_hand.collect{|x| x.value}.inject(:+)\n puts \"You have #{player_hand.collect{|x| \"#{x.face}#{x.suit}\"}.join(\" & \")}, for a total of #{p_score}\"\n puts \"The comput...
[ "0.6342255", "0.62807965", "0.62656915", "0.6218138", "0.6205203", "0.61967736", "0.6182706", "0.6169994", "0.61681724", "0.61593086", "0.6141544", "0.6137698", "0.61125165", "0.6073761", "0.6069268", "0.6035023", "0.60138893", "0.5991898", "0.5976845", "0.5964442", "0.594803...
0.5842131
33
redirect_to :controller => "post", :action => "show", :id => 1
def redirect_to options = {} @has_redirect = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # redirect_to controller: 'post', action: 'new_post'\n end", "def create\n redirect_to :action => 'show', :id => params[:id] \n end", "def show\n redirect_to :action => \"edit\", :id => params[:id]\n end", "def show\n post = Post.find(params[:id])\n redirect_to post.permalink\n ...
[ "0.78046817", "0.753223", "0.72807676", "0.726452", "0.69664574", "0.6954729", "0.68439305", "0.68028635", "0.67987823", "0.6795364", "0.67740214", "0.67512614", "0.67512614", "0.6734154", "0.67333424", "0.6689263", "0.6689263", "0.6689263", "0.6689263", "0.6689263", "0.66892...
0.0
-1
Last called function returns the status code/headers/body of the request
def generate_html_and_build_response! controller = self.class_to_model_name response_body = Poseidon::View.new.render(controller, meth, self) response.merge!(body: response_body) return response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n last_response.status\nend", "def status_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def response_code; end", "def http_status\n self[:status_code]\n end", "def body\n last_response.body\nend", "def execute request_conte...
[ "0.74527127", "0.7231662", "0.694326", "0.694326", "0.694326", "0.694326", "0.67427224", "0.67132986", "0.66968715", "0.6691826", "0.66849697", "0.66648966", "0.66648966", "0.6641327", "0.6636657", "0.6618141", "0.6546282", "0.6501968", "0.6501968", "0.6500974", "0.6483845", ...
0.0
-1
Calcula os Valores dos Items que possuem chaves no hash "Items", com as quantidades definidas no hash "items_qtd"
def calcular_valores_parciais(items, items_quantidade, items_valor, modo_calcular_servico = nil) valor_total_calculado = 0.0 items.each_pair { |id, booleano| puts("Percorrendo Array[id]: "+id+", booleando="+booleano.to_s) if(booleano) then item = obter_item_por_produto_id(id) item_qtd = items_quantidade.fetch(id) puts("Item no Loop: "+item.produto.descricao+", valor_unit="+item.valor_unitario.to_s+", qtd="+item_qtd.to_s) if (!modo_calcular_servico) then items_valor[id] = (item.valor_unitario * item_qtd) valor_total_calculado += items_valor.fetch(id) elsif (item.produto.adiciona_taxa_servico) valor_total_calculado += (item.valor_unitario * item_qtd * 0.1) end end } valor_total_calculado end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quantity_by_item_id(hash)\n hash.each { |item_id, inv_items|\n hash[item_id] = sum(inv_items, :quantity)\n }; return hash\n end", "def total_items\r\n\t\t@items.inject(0) { |sum, i| sum + i.quantity }\r\n\tend", "def items_value_calc(items)\n value = 0\n\n items.each do |item|\n valu...
[ "0.6863127", "0.6808239", "0.6758915", "0.6595589", "0.65919876", "0.6546685", "0.64933616", "0.6483544", "0.6477357", "0.64734125", "0.64734125", "0.6459018", "0.64418924", "0.64418924", "0.64244103", "0.63856566", "0.63826895", "0.6379904", "0.6356681", "0.6325482", "0.6309...
0.67129564
3
todo: support select enviroment
def get_client token = Rails.application.credentials[:production][:square][:square_access_token] client = Square::Client.new( access_token: token, environment: "production", ) return client end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; ...
[ "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "0.7485584", "...
0.0
-1
GET /valores_sistema/1 GET /valores_sistema/1.xml
def show @valor_sistema = ValorSistema.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @valor_sistema } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @valor_sistema = ValorSistema.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @valor_sistema }\n end\n end", "def show\n @nossos_servico = NossosServico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n...
[ "0.654583", "0.6137122", "0.6096311", "0.6091833", "0.6020948", "0.6008599", "0.5970046", "0.5969929", "0.59641474", "0.5961442", "0.5946401", "0.5936965", "0.5925948", "0.5922025", "0.59169257", "0.590244", "0.5889962", "0.58619905", "0.5836944", "0.5836921", "0.5832437", ...
0.7112391
0
GET /valores_sistema/new GET /valores_sistema/new.xml
def new @valor_sistema = ValorSistema.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @valor_sistema } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @nossos_servico = NossosServico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nossos_servico }\n end\n end", "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml ...
[ "0.7379628", "0.72318465", "0.7223668", "0.72104466", "0.7202904", "0.71769273", "0.7165734", "0.7162539", "0.7162361", "0.71608514", "0.7149249", "0.7120871", "0.71128124", "0.71115357", "0.7106396", "0.70981234", "0.70741296", "0.70668995", "0.7060407", "0.7047483", "0.7042...
0.7796672
0
POST /valores_sistema POST /valores_sistema.xml
def create @valor_sistema = ValorSistema.new(params[:valor_sistema]) respond_to do |format| if @valor_sistema.save flash[:notice] = 'ValorSistema was successfully created.' format.html { redirect_to(@valor_sistema) } format.xml { render :xml => @valor_sistema, :status => :created, :location => @valor_sistema } else format.html { render :action => "new" } format.xml { render :xml => @valor_sistema.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @selecciones = Seleccion.where(\"cliente_id = ?\",usuario_actual.id)\n @peso_total = Seleccion.peso_total(usuario_actual.id)\n @precio_total = Seleccion.precio_total(usuario_actual.id)\n @tarjetas = usuario_actual.tdc\n \n #Cobro en el banco\n client = Savon::Client.new(\"http://l...
[ "0.64653015", "0.6296676", "0.61185575", "0.57890457", "0.57324", "0.5699117", "0.56639177", "0.566184", "0.56512934", "0.5618471", "0.56098026", "0.5579067", "0.5563741", "0.5561659", "0.55563176", "0.55379575", "0.55339783", "0.5523063", "0.5514479", "0.5508425", "0.5497977...
0.6823642
0
PUT /valores_sistema/1 PUT /valores_sistema/1.xml
def update @valor_sistema = ValorSistema.find(params[:id]) respond_to do |format| if @valor_sistema.update_attributes(params[:valor_sistema]) flash[:notice] = 'ValorSistema was successfully updated.' format.html { redirect_to(@valor_sistema) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @valor_sistema.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @sistema = Sistema.find(params[:id])\n\n respond_to do |format|\n if @sistema.update_attributes(params[:sistema])\n format.html { redirect_to @sistema, notice: 'Sistema was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render ac...
[ "0.6274304", "0.6177273", "0.61283135", "0.59450084", "0.59393376", "0.5927985", "0.5812516", "0.5806839", "0.5806579", "0.58025444", "0.5788567", "0.578154", "0.5778324", "0.5762536", "0.57408977", "0.5709676", "0.57014835", "0.5690816", "0.5688171", "0.5686145", "0.5683938"...
0.6794067
0
DELETE /valores_sistema/1 DELETE /valores_sistema/1.xml
def destroy @valor_sistema = ValorSistema.find(params[:id]) @valor_sistema.destroy respond_to do |format| format.html { redirect_to(valores_sistema_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(p...
[ "0.6834799", "0.6546247", "0.6389365", "0.63630056", "0.6317028", "0.63120675", "0.6301997", "0.6299643", "0.629903", "0.62988913", "0.62975645", "0.62973726", "0.6284", "0.6272576", "0.62678766", "0.62503296", "0.6249675", "0.6245104", "0.6243904", "0.6232822", "0.6227633", ...
0.71554536
0
rewrite this code to refactor the print loop
def print_board puts "" puts " 1 2 3 4 5 6 7 8" puts " |-------------------------|" print " A ||" print_row 0 puts "|" puts " |-------------------------|" print " B ||" print_row 1 puts "|" puts " |-------------------------|" print " C ||" print_row 2 puts "|" puts " |-------------------------|" print " D ||" print_row 3 puts "|" puts " |-------------------------|" print " E ||" print_row 4 puts "|" puts " |-------------------------|" print " F ||" print_row 5 puts "|" puts " |-------------------------|" print " G ||" print_row 6 puts "|" puts " |-------------------------|" print " H ||" print_row 7 puts "|" puts " |-------------------------|\n\n " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n (1..5).each do |l|\n out = printByLine(l) + \"\\n\"\n STDOUT << (VROW.include?(l) ? out*@size : out )\n end\n end", "def print_out(print_info)\n line_width = 40\n \n puts print_info[0][0].center(line_width) #we print the title first\n \n print_info[1].each_with_index d...
[ "0.6722331", "0.6680698", "0.64208794", "0.6405727", "0.6388259", "0.63674", "0.63674", "0.6364972", "0.6364532", "0.6352899", "0.63433427", "0.63398033", "0.6329712", "0.6307139", "0.6306759", "0.62847704", "0.62836444", "0.62791103", "0.6246739", "0.62419695", "0.62405616",...
0.0
-1
Returns the underscored version of the command if it's a string otherwise just return the unmodified value (probably nil)
def command return @command.underscore if @command.is_a?(String) @command end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_pp\n to_s.gsub(/^_/, \"\").downcase\n end", "def command_name\n @command_name ||= if command = name.to_s.split(\"::\").last\n command.chomp!(\"Command\")\n command.underscore\n end\n end", "def normalize_command_name(meth) #:nodoc:\n return de...
[ "0.65918213", "0.6128218", "0.61057186", "0.6044819", "0.5962921", "0.5884102", "0.5852517", "0.58467627", "0.5830586", "0.5827983", "0.58035654", "0.5739819", "0.5727531", "0.5712383", "0.5710473", "0.56602603", "0.56405467", "0.56313336", "0.5624223", "0.5592037", "0.558843...
0.72333795
0
Sets the "perform_hooks" flag to "true"
def perform_hooks! @perform_hooks = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply!\n @hooks.values.each(&:apply!)\n @applied = true\n end", "def enabled_ad_hoc_hooks(hook_context); end", "def process_hooks(user, actual_targets)\n exec_hooks(Move, :process_hooks, binding)\n return true\n end", "def pre_perform!\n return unless perform_hooks?\n ...
[ "0.7425976", "0.70180106", "0.6700576", "0.66107976", "0.6534071", "0.65179074", "0.65030366", "0.64813787", "0.6454237", "0.63372415", "0.6292135", "0.6247542", "0.6200228", "0.61954796", "0.61708593", "0.6168743", "0.61486423", "0.6082382", "0.60764486", "0.6069502", "0.606...
0.8970734
0
Displays the help screen for the current command
def help command_object.display_usage(cli.command) exit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_help\n display_possible_actions\n end", "def show_help\n system 'clear'\n puts HELP_COMMANDS\n end", "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def cmd_help(*args)\n\t\tprint(shell.help_to_s)\n\tend", "def help(comma...
[ "0.8283105", "0.8246834", "0.8229458", "0.8229458", "0.81364423", "0.8058234", "0.8049408", "0.8037682", "0.80213004", "0.8011326", "0.7936132", "0.79345256", "0.79345256", "0.79236037", "0.79178494", "0.7899997", "0.7897787", "0.7872916", "0.7870185", "0.7858", "0.78531706",...
0.8447894
0
Contains an instance of the command object
def command_object @command_object ||= GitPusshuTen::Command.new(cli, configuration, hooks, environment) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command\n @command ||= Class.new.send(:include, Command)\n end", "def command\n\n h.fields['__command__']\n end", "def initialize command\n @command = command\n end", "def command\n attributes.fetch(:command)\n end", "def command\n attributes.fet...
[ "0.7970519", "0.73349303", "0.71749026", "0.7163551", "0.7163551", "0.7089998", "0.70498323", "0.6964625", "0.6958709", "0.69174486", "0.689695", "0.6888335", "0.6888335", "0.6888335", "0.68818235", "0.68818235", "0.68768", "0.68590564", "0.68507373", "0.6828191", "0.66723907...
0.76471823
1
Wrapper for the configuration object
def c configuration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def configuration; end", "def config\n configuration\n end", "def c\n configuration\n end", "def configuration\n self\n end", "def config\r\n Configuration\r\n end", ...
[ "0.76441544", "0.76441544", "0.76441544", "0.76441544", "0.76441544", "0.7611356", "0.7532092", "0.75193435", "0.75076485", "0.75076485", "0.75076485", "0.75076485", "0.75076485", "0.75076485", "0.7505429", "0.7481662", "0.7481662", "0.74544656", "0.7424252", "0.74202317", "0...
0.75288814
7
Wrapper for the environment object
def e environment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def environment; end", "def env=(environment); end", "def env=(environment); end", "def with_environment(env); end", "def environment(environment); end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def env; end", "def en...
[ "0.82467145", "0.8235583", "0.8235583", "0.8209369", "0.811331", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "0.8084339", "...
0.67040926
82
Wrapper for coloring ANSI/CLI Green
def g(value) value.to_s.color(:green) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\e[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend", "def green(string)\n \"\\033[0;32m#{string}\\033[0m\"\nend", "def green(text)\n colorize text, \"\\033[1;32m\"\n end", ...
[ "0.8468138", "0.8468138", "0.8380333", "0.8380333", "0.7959587", "0.7936504", "0.7845051", "0.7845051", "0.7797479", "0.7797479", "0.7745597", "0.7745597", "0.7745597", "0.7745597", "0.7734779", "0.7708156", "0.76403403", "0.761836", "0.7581086", "0.7545677", "0.74988323", ...
0.0
-1
Wrapper for coloring ANSI/CLI Red
def r(value) value.to_s.color(:red) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend", "def red(string)\n \"\\033[0;31m#{string}\\e[0m\"\nend", "def red(msg)\n \"\\033[31m#{msg}\\033[39m\"\nend", "def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend", "def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend", "def puts_red(str...
[ "0.82397705", "0.82397705", "0.8123045", "0.80829585", "0.80829585", "0.80201894", "0.7933105", "0.7933105", "0.7933105", "0.7933105", "0.7933105", "0.786064", "0.77999616", "0.7795369", "0.7787253", "0.7748903", "0.7748903", "0.77366096", "0.77366096", "0.7623174", "0.761577...
0.0
-1
Wrapper for coloring ANSI/CLI Yellow
def y(value) value.to_s.color(:yellow) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def yellow(string)\n \"\\033[0;33m#{string}\\e[0m\"\nend", "def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend", "d...
[ "0.8240743", "0.8240743", "0.8240743", "0.8240743", "0.7978556", "0.7978556", "0.79655105", "0.79637975", "0.79637975", "0.7962831", "0.7962831", "0.793902", "0.7842125", "0.7842125", "0.7782058", "0.7742205", "0.7605188", "0.7567906", "0.7561664", "0.75264525", "0.75264525",...
0.0
-1
Helper method for prompting the user
def yes? choose do |menu| menu.prompt = '' menu.choice('yes') { true } menu.choice('no') { false } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask\n gets.strip\n end", "def prompt; end", "def prompt; end", "def prompt; end", "def prompt; end", "def prompt\n gets.strip\nend", "def prepare_input(prompt); end", "def prompt_user_song\n puts \"Please enter a song name or number:\"\nend", "def prompt_user\n puts \"Please ...
[ "0.8132607", "0.7822578", "0.7822578", "0.7822578", "0.7822578", "0.7740706", "0.77168894", "0.76753134", "0.76616555", "0.7583275", "0.75601506", "0.75295407", "0.7507765", "0.7488248", "0.7482494", "0.7392311", "0.73737574", "0.7345235", "0.7341207", "0.7325801", "0.7324012...
0.0
-1
Shorthand for creating standard messages
def standard(text) GitPusshuTen::Log.standard(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_template; end", "def message\n t(\".message\")\n end", "def make_message message\n prefix = \"#{@file_name}:\".dup\n\n tk = peek_tk\n prefix << \"#{tk[:line_no]}:#{tk[:char_no]}:\" if tk\n\n \"#{prefix} #{message}\"\n end", "def to_simple_message\n {\n text: self.messag...
[ "0.7421062", "0.70517415", "0.7048561", "0.70094657", "0.6921645", "0.6912165", "0.6912165", "0.6911415", "0.6883808", "0.68829703", "0.6864877", "0.6812289", "0.6802087", "0.6775881", "0.67488307", "0.67488307", "0.67286235", "0.67286235", "0.6704916", "0.66990453", "0.66841...
0.0
-1
Shorthand for creating normal messages
def message(text) GitPusshuTen::Log.message(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def message_template; end", "def to_simple_message\n {\n text: self.message\n }\n end", "def message(message) end", "def message\n t(\".message\")\n end", "def to_s; message; end", "def message=(_); end", "def msg(message)\n end", "def message_template=(_arg0); end", "def mes...
[ "0.7511019", "0.71501154", "0.69729275", "0.69548523", "0.6942626", "0.69335407", "0.6890897", "0.6846802", "0.6823427", "0.6823427", "0.6802955", "0.6802558", "0.6788952", "0.6788952", "0.6771852", "0.67600155", "0.6752227", "0.6717746", "0.6717746", "0.67024815", "0.6698025...
0.0
-1
Shorthand for creating warning messages
def warning(text) GitPusshuTen::Log.warning(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def warn message\n @options.warn make_message message\n end", "def warning(*args); end", "def warn(msg)\n #This is a stub, used for indexing\n end", "def generate_warning_text\n @warnings\n end", "def warning(fmt, *args)\n end", "def bold_warning(*args); end", "def warning(st...
[ "0.79971105", "0.7902892", "0.7782945", "0.77772266", "0.77668333", "0.7710859", "0.76779443", "0.76779443", "0.764504", "0.7633147", "0.7627579", "0.7627579", "0.75719714", "0.753675", "0.753675", "0.7501332", "0.7485265", "0.7485265", "0.74427456", "0.7395584", "0.7395584",...
0.7084055
55
Shorthand for creating error messages
def error(text) GitPusshuTen::Log.error(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error_message; end", "def error_message (errors)\n\tmessage = \"\"\n\terror_array = errors.split\n\n\terror_array.each do |error|\n\t\tcase error\n\t\twhen \"name\"\n\t\t\tmessage += \"Invalid Name \\n\"\n\t\twhen \"email\"\n\t\t\tmessage += \"Invalid Email \\n\"\n\t\twhen \"dup\"\n\t\t\tmessage += \"Duplica...
[ "0.7567345", "0.7543262", "0.7449653", "0.7423284", "0.7257186", "0.72526354", "0.72309774", "0.72309774", "0.72051483", "0.70860034", "0.7083154", "0.70424616", "0.7038658", "0.70320684", "0.7025754", "0.70035595", "0.6997061", "0.6988627", "0.6957513", "0.6956058", "0.69459...
0.0
-1
Shorthand for silently creating logs
def silent(text) GitPusshuTen::Log.silent(text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autoflush_log; end", "def autoflush_log; end", "def autoflush_log=(_arg0); end", "def autoflush_log=(_arg0); end", "def start_log(log)\n File.open(log, 'w')\nend", "def log_without_running\n log\n end", "def touch_when_logging\n touch\n end", "def log!(message)\n log message if ...
[ "0.6815595", "0.6815595", "0.6801515", "0.6801515", "0.675799", "0.6749494", "0.67491114", "0.6656607", "0.6656607", "0.6639947", "0.6622151", "0.65907985", "0.65559494", "0.6511575", "0.65022504", "0.64756805", "0.64640784", "0.64611924", "0.64566416", "0.6453717", "0.641669...
0.0
-1
Initialize a new command
def initialize(cli, configuration, hooks, environment) @cli = cli @configuration = configuration @hooks = hooks @environment = environment @perform_hooks = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(command)\n @command = command\n end", "def initialize command\n @command = command\n end", "def initialize(name, command)\r\n super(name)\r\n @command = command\r\n end", "def initialize_command(message)\n message = Message.new(params)\n @command = ...
[ "0.84812075", "0.84426796", "0.8381616", "0.79583913", "0.77856", "0.7638851", "0.7528661", "0.7482579", "0.72748715", "0.7274332", "0.72561604", "0.71847403", "0.71748334", "0.7169156", "0.71621436", "0.7138395", "0.7114415", "0.7090347", "0.7087095", "0.70660263", "0.705731...
0.0
-1
Performs one of the commands inside a command class
def perform! send("perform_#{command}!") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd(*args) self.class.cmd(*args) end", "def call(*command); end", "def execute(command)\n end", "def perform(command, *args)\n\n #\n # use the given command's attributes to perform the action\n #\n\n raise NotImplementedError\n end", "def execute_command(command)\n en...
[ "0.7577472", "0.7528613", "0.7516762", "0.74870557", "0.7355688", "0.7355688", "0.7321271", "0.7321271", "0.7321271", "0.7321271", "0.7321271", "0.7321271", "0.72766155", "0.7137429", "0.7108383", "0.70850354", "0.7044196", "0.70391643", "0.70340586", "0.7022408", "0.7016667"...
0.70882505
15
Validates if the method that's about to be invoked actually exists
def validate! if not respond_to?("perform_#{command}!") type = self.class.to_s.split("::").last.downcase error "Unknown #{y(type)} command: <#{r(command)}>" error "Run #{y("gitpusshuten help #{type}")} for a list #{y(type)} commands." exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_meth?(fn)\n fn.is_a?(Method)\n end", "def method_defined?(arg0)\n end", "def method_valid?(method_name)\n # validate method, see if we support given method in current tasks\n (current_context_task_names() + ['help']).include?(method_name)\n end", "def check_instance_meth...
[ "0.75106853", "0.75094515", "0.7325415", "0.7318886", "0.73129475", "0.72917926", "0.7164311", "0.70286506", "0.69381195", "0.6937696", "0.6934738", "0.6924289", "0.6876329", "0.68433714", "0.6822825", "0.67803305", "0.6745177", "0.674047", "0.66738504", "0.666403", "0.665167...
0.0
-1
The Preperform command It should be invoked before the perform! command
def pre_perform! return unless perform_hooks? unless hooks.pre_hooks.any? GitPusshuTen::Log.message "No pre deploy hooks to perform." return end ## # Connect to the remote environment and perform the pre deploy hooks hooks.render_commands(hooks.pre_hooks).each do |name, commands| adjusted_name = name.sub(/^\d+\)\s/, '') GitPusshuTen::Log.message("Performing pre deploy hook: #{y(adjusted_name)}") standard environment.execute_as_user("cd '#{e.app_dir}'; #{commands}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pre\n if phase.has_key?('pre')\n execute(\"pre\", phase['pre'])\n end\n end", "def before_perform\n end", "def pre_execute(&block)\n @hooks[:pre_execute] = block\n end", "def pre_task\n end", "def before\n if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :before\n l...
[ "0.7185019", "0.71168447", "0.672362", "0.67106247", "0.6625203", "0.650956", "0.64762455", "0.63780844", "0.6243856", "0.622254", "0.6162287", "0.6088217", "0.60589004", "0.60001177", "0.59935117", "0.59935117", "0.5961615", "0.5948699", "0.5931531", "0.5911894", "0.58910817...
0.66757715
4
The Postperform command It should be invoked after the perform! command
def post_perform! return unless perform_hooks? unless hooks.post_hooks.any? GitPusshuTen::Log.message "No post deploy hooks to perform." return end ## # Connect to the remote environment and perform the post deploy hooks hooks.render_commands(hooks.post_hooks).each do |name, commands| adjusted_name = name.sub(/^\d+\)\s/, '') GitPusshuTen::Log.message("Performing post deploy hook: #{y(adjusted_name)}") standard environment.execute_as_user("cd '#{e.app_dir}'; #{commands}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process\n end", "def perform\n \n end", "def perform; end", "def perform; end", "def post_task\n end", "def post_process; end", "def perform!\n end", "def post_execute(&block)\n @hooks[:post_execute] = block\n end", "def perform!\n send(\"perform_#{command}!...
[ "0.6814118", "0.67820024", "0.6745756", "0.6745756", "0.67110676", "0.66634333", "0.6516777", "0.65059674", "0.6425413", "0.6278394", "0.6220032", "0.617285", "0.617285", "0.6169496", "0.6158315", "0.6158315", "0.6158315", "0.6158315", "0.6156104", "0.61372983", "0.61164063",...
0.63510436
9
Makes the user authenticate itself as root
def prompt_for_root_password! e.execute_as_root('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def auth_user\n if !current_user\n redirect_to root_url\n end\n end", "def root_user\n Mongo::Auth::User.new(\n user: user ...
[ "0.6967902", "0.6967902", "0.6967902", "0.6867502", "0.6825565", "0.6774851", "0.67555237", "0.67534965", "0.67401415", "0.6717491", "0.6717491", "0.6717491", "0.6717491", "0.6633693", "0.6588906", "0.6572149", "0.6545321", "0.6519486", "0.6518959", "0.6503641", "0.6484206", ...
0.6970275
0
Makes the user authenticate itself as a user
def prompt_for_user_password! e.execute_as_user('') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user!\n if current_user.id != @user.id\n redirect_back(fallback_location: root_path)\n end\n end", "def authenticate_user\n if !current_user\n redirect_to login_path\n end\n end", "def authenticate_user\n if !current_user\n redirect_to lo...
[ "0.7545822", "0.7453055", "0.7453055", "0.74458104", "0.74401546", "0.74401546", "0.74401546", "0.74401546", "0.7413923", "0.7391706", "0.735107", "0.73466897", "0.7341365", "0.7336533", "0.73044246", "0.72982895", "0.72841364", "0.72770464", "0.7276997", "0.72747", "0.725987...
0.0
-1
Will check to see if the user exists, if it doesn't then it'll display an error telling the user to set up a user first
def requires_user_existence! if not e.user_exists? error "You have to setup your user before you can perform this action." exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_user\n if User.count == 0\n User.create({:login => \"admin\", :password => \"password\", :password_confirmation => \"password\", :name => 'blog owner', :email => \"none@none\", :time_zone => \"Europe/London\"})\n # Display the newly created users details\n notify \"N...
[ "0.7910478", "0.7597672", "0.75406694", "0.7441463", "0.7237216", "0.7193258", "0.7183215", "0.71628773", "0.7136193", "0.71037143", "0.70940447", "0.70846885", "0.7065222", "0.70349044", "0.69996905", "0.6983316", "0.69580543", "0.6939054", "0.69374067", "0.688566", "0.68820...
0.86896026
0
We can also make method to store the code above (line 112)
def my_guesses gusses || [] #<-- what ever is true first, is going to run. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def custom; end", "def custom; end", "def code_point=(_); end", "def code_of_conduct; end", "def probers; end", "def code_point; end", "def implemen...
[ "0.71392655", "0.70035326", "0.70035326", "0.70035326", "0.70035326", "0.70035326", "0.70035326", "0.70035326", "0.68230027", "0.68230027", "0.678196", "0.67754644", "0.6690488", "0.6511485", "0.64864564", "0.64864564", "0.6467694", "0.6453294", "0.6418364", "0.6357758", "0.6...
0.0
-1
Now, Let's put it in the method. TRANSLATION
def my_guesses(my_name, guesses) #<-- When we call the method, we have to write two parameters like this.... my_guess("Anthony", "friend") if guesses #<-- if there is a guesses, than guess = "Juan" #<-- print the guess's values, which is "Juan" else guess = "Ordaz" #<-- if there is not a guesses, print this guess's value, which is "Ordaz".... We are repeating our-selves again. NOT GOOD!! end guesses #<-- return what ever guesses is (either "Juan" or "Ordaz"), We don't need to write this, I will explain in the bottom lines end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translate()\n\nend", "def translations; end", "def translate(settings); end", "def apply_locale; end", "def...
[ "0.7574546", "0.7574546", "0.7574546", "0.7574546", "0.7574546", "0.7574546", "0.7574546", "0.7574546", "0.75215733", "0.7199792", "0.6975373", "0.6752011", "0.6712596", "0.6660437", "0.660223", "0.65454566", "0.65266865", "0.64744455", "0.6417997", "0.64112985", "0.64040124"...
0.0
-1