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 |
|---|---|---|---|---|---|---|
redefine your position_taken? method here, so that you can use it in the valid_move? method above. | def position_taken?(board, location)
!(board[location].nil? || board[location] == " ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def position_taken?(board, position)\n return false if valid_move?(board, position)\n return true unless valid_move?(board, position)\nend",
"def position_taken?\nend",
"def valid_move?(board, index)\n if index.between?(0, 8)\n # re-define your #position_taken? method here, so that you can use it in the #v... | [
"0.8409533",
"0.8161412",
"0.80915326",
"0.802741",
"0.80150443",
"0.78980684",
"0.7893883",
"0.7886275",
"0.78447807",
"0.7843449",
"0.7831682",
"0.78148174",
"0.7813732",
"0.7810363",
"0.78020334",
"0.7801113",
"0.7800951",
"0.7789361",
"0.7782831",
"0.777421",
"0.7774137",... | 0.0 | -1 |
code your valid_move? method here | def valid_move?(board, position)
position = position.to_i
if !(position_taken?(board, position-1)) && position.between?(1,9)
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_move?(new_x, new_y)\n true\n end",
"def valid_move?(move_index)\r\n #valid if position is NOT taken\r\n valid = !self.position_taken?(move_index)\r\n if valid == true\r\n if move_index.between?(0,8)\r\n valid = true\r\n else\r\n valid = false\r\n end\r\n end... | [
"0.82555014",
"0.8206571",
"0.80988276",
"0.8078809",
"0.8062644",
"0.8059585",
"0.80573076",
"0.79910356",
"0.79760164",
"0.7954171",
"0.79520303",
"0.79362106",
"0.7926097",
"0.7923089",
"0.7916774",
"0.7911268",
"0.79109216",
"0.7906181",
"0.79061437",
"0.7892746",
"0.7857... | 0.0 | -1 |
Define your play method below | def play(board)
until over?(board)
turn(board)
end
if won?(board)
puts "Congratulations #{winner(board)}!"
elsif draw?(board)
puts "Cats Game!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play\n \n end",
"def play; end",
"def play \n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n end",
"def play\n\tend",
"def play\n #calls to all the methods that produce game!\n end",
"def play\n self\n end",
"def get_play(... | [
"0.91277385",
"0.9031555",
"0.90065134",
"0.900332",
"0.900332",
"0.900332",
"0.900332",
"0.8978301",
"0.88647234",
"0.8184945",
"0.80578035",
"0.79240173",
"0.78456163",
"0.7765175",
"0.77345335",
"0.76989305",
"0.7611273",
"0.7611273",
"0.7528091",
"0.74453044",
"0.74384725... | 0.0 | -1 |
Initializes the Pattern by converting the pattern selector into steps Params: +pattern_selector_string+:: the pattern selector to be converted | def initialize(pattern_selector_string)
@steps = pattern_selector_string.split('>').map do |raw_step|
{
up: Pattern.extract_parameter(raw_step, 'U').to_i || 0,
down: Pattern.extract_parameter(raw_step, 'D').to_i || 0,
left: Pattern.extract_parameter(raw_step, 'L').to_i || 0,
right: Pattern.extract_parameter(raw_step, 'R').to_i || 0,
test: Regexp.new("^#{Pattern.extract_parameter(raw_step, '\?')}$"),
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(pattern)\n @pattern = pattern\n end",
"def initialize(original_string, pattern = nil)\n @original_string = original_string # TODO: Validates always an original string?\n @pattern = pattern\n end",
"def initialize\n @single_value_pattern = SingleValuePa... | [
"0.6493829",
"0.60351694",
"0.59577703",
"0.5852797",
"0.5839564",
"0.57387984",
"0.55157",
"0.55051225",
"0.54605645",
"0.54601127",
"0.5395978",
"0.53861946",
"0.5375885",
"0.5360597",
"0.5359533",
"0.5352497",
"0.5324756",
"0.5309253",
"0.52658516",
"0.52572864",
"0.525728... | 0.8501264 | 0 |
GET /offers GET /offers.json | def index
@offers = Offer.where(company_id: params[:company_id])
if params[:search].present?
@q = @company.offers.near(params[:search], 200, :order => 'distance' ).ransack(params[:q])
@offers = @q.result(:distinct => true)
else
@q = @company.offers.ransack(params[:q])
@offers = @q.result(:distinct => true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def get_offers\n unless get_connection_object.headers.has_key?(\"X-Auth-Token\")\n raise \"Please authenticate() to see your offers\"\n end\n get('offer')\n end",
"def index\n @offers = Offer.all\n\n respond... | [
"0.8171875",
"0.7944721",
"0.79157716",
"0.79029083",
"0.7764754",
"0.76819086",
"0.7671478",
"0.7586528",
"0.7481807",
"0.7481807",
"0.7466798",
"0.74593174",
"0.7443136",
"0.73937756",
"0.73937756",
"0.73937756",
"0.73937756",
"0.7368404",
"0.73248607",
"0.7323364",
"0.7278... | 0.0 | -1 |
GET /offers/1 GET /offers/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @offers = Offer.all\n\n render json: @offers\n end",
"def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end",
"def index\n @offers = Offer.all\n respond_to do |format|\n form... | [
"0.7893452",
"0.7734393",
"0.76324385",
"0.7481251",
"0.7394545",
"0.7394545",
"0.73184246",
"0.7309764",
"0.72893107",
"0.72650313",
"0.7260039",
"0.72340804",
"0.7228739",
"0.72237456",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71911067",
"0.71791774",
"0.7166139",
"0.70... | 0.0 | -1 |
POST /offers POST /offers.json | def create
@offer = @company.offers.new(offer_params)
@offer.user = current_user
respond_to do |format|
if @offer.save
format.html { redirect_to @company, notice: 'Review was successfully created.' }
format.json { render :show, status: :created, location: @offer }
else
format.html { render :new }
format.json { render json: @offer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offers \n @host.offers.create(offer_params) if request.post?\n @offers = @host.offers\n end",
"def create\n @offer = Offer.new(offers_params)\n\n respond_to do |format|\n if @offer.save\n format.jsonapi { render jsonapi: @offer, status: :created }\n else\n format.jsona... | [
"0.7786193",
"0.7747863",
"0.7656599",
"0.74715203",
"0.73439634",
"0.724438",
"0.7177923",
"0.7177923",
"0.7133728",
"0.71083695",
"0.71073085",
"0.7089599",
"0.70707047",
"0.7041431",
"0.6944871",
"0.6875765",
"0.68635684",
"0.68152165",
"0.68152165",
"0.68152165",
"0.67948... | 0.6661657 | 28 |
PATCH/PUT /offers/1 PATCH/PUT /offers/1.json | def update
respond_to do |format|
if @offer.update(offer_params)
format.html { redirect_to @offer.user, notice: 'Review was successfully updated.' }
format.json { render :show, status: :ok, location: @offer }
else
format.html { render :edit }
format.json { render json: @offer.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @offer = Offer.f... | [
"0.7433272",
"0.710898",
"0.70783436",
"0.70783436",
"0.6977565",
"0.69454175",
"0.69355863",
"0.69348496",
"0.68548036",
"0.6837437",
"0.68078864",
"0.68078864",
"0.6716537",
"0.66904545",
"0.6614112",
"0.6609227",
"0.6607974",
"0.6596748",
"0.65610605",
"0.65574545",
"0.652... | 0.6450501 | 23 |
DELETE /offers/1 DELETE /offers/1.json | def destroy
@offer.destroy
respond_to do |format|
format.html { redirect_back fallback_location: root_path, notice: 'Review was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end",
"def destroy\n @offer = Offer.find(params[:id])\n checkaccount... | [
"0.78265435",
"0.78265435",
"0.77179426",
"0.7585767",
"0.7585767",
"0.753747",
"0.753747",
"0.7530682",
"0.7455453",
"0.74433076",
"0.74234",
"0.73523116",
"0.73467505",
"0.73374295",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7332255",
"0.7321798",
"0.7311942",
"0.7264411",
... | 0.6826756 | 49 |
Use callbacks to share common setup or constraints between actions. | def set_offer
@offer = Offer.find(params[:id].to_i)
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 offer_params
params.require(:offer).permit(:offer_id, :user_id, :company_id, :position, :employment_type, :responsiveness, :experience, :response_time, :address, :latitude, :longitude, :street_number, :locality, :route, :offer, :administrative_area_level_1, :country, :postal_code)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
Overwrite this method to customize how users are displayed across all pages of the admin dashboard. | def display_resource(user)
user.username
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_layout\n if user_signed_in?\n # If user is admin, set admin flag\n if current_user.admin?\n @admin = true\n end\n # set users fullname for display\n @user_name = current_user.name\n @user = current_user\n end\n \n end",
"def show\n add_breadcrumb t(:'h... | [
"0.6818068",
"0.6510732",
"0.64996594",
"0.6429772",
"0.6332748",
"0.6332748",
"0.6245445",
"0.6230466",
"0.6174989",
"0.6131319",
"0.6102697",
"0.60913754",
"0.6078645",
"0.6039935",
"0.603263",
"0.6021453",
"0.60201263",
"0.60158545",
"0.60089225",
"0.60070634",
"0.5992757"... | 0.0 | -1 |
Returns the list of column names excluding this one | def remaining_columns(column)
self.column_names - [column]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_names_to_skip\n @column_names_to_skip ||= begin\n primary_keys = [ ]\n primary_keys += Array(@low_card_model.primary_keys || [ ]) if @low_card_model.respond_to?(:primary_keys)\n primary_keys += Array(@low_card_model.primary_key || [ ]) if @low_card_model.respond_to?(:pr... | [
"0.7655045",
"0.76137996",
"0.75651205",
"0.7487351",
"0.74562085",
"0.7417128",
"0.73975074",
"0.72279894",
"0.7227328",
"0.7157198",
"0.7081032",
"0.70327085",
"0.7008944",
"0.69776213",
"0.69065064",
"0.6870588",
"0.68697256",
"0.68231446",
"0.6786375",
"0.6776681",
"0.675... | 0.7006969 | 13 |
TODO: Should put ApplicationController and use before_filter to trigger | def authenticate_by_token
token = get_token
if token.nil?
render json: "Missing HTTP_X_NB_AUTHTOKEN HTTP header", status: :bad_request
return false
end
# We verify by two ways:
# 1. if app session id is present, does the app token match the associated app?
# 2. does the current track belongs to the app session which the app token points to?
true_token = Track.find(params[:id]).app_session.app.token
if token != true_token
render json: "Token mismatch", status: :bad_request
return false
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter; end",
"def before_dispatch(env); end",
"def before_dispatch(_env)\n end",
"def on_pre_request( request ); end",
"def on_pre_request( request )\n end",
"def before_request\n end",
"def application_before\n run_event(:application_before)\n end",
"def before_bootstr... | [
"0.68894047",
"0.6869664",
"0.6763648",
"0.65498483",
"0.6549444",
"0.6489585",
"0.6422781",
"0.61801153",
"0.6141026",
"0.60632586",
"0.6050583",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.60231984",
"0.... | 0.0 | -1 |
Initialise occupation instance variables | def initialize(job_name, job_aliases, salary_min, salary_average, salary_high, growing, long_term_growth, job_size, vulnerable_to_automation, personality_suitability)
@job_name = job_name
@job_aliases = job_aliases
@salary_min = salary_min
@salary_average = salary_average
@salary_high = salary_high
@growing = growing
@long_term_growth = long_term_growth
@vulnerable_to_automation = vulnerable_to_automation
@job_size = job_size
@personality_suitability = personality_suitability
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(apt_no, rent, br, baths)\n\t\t@is_occupied = false\n\t\t@apt_no = apt_no\n\t\t# Note that this then redefines what rent is -- it was actually in place from above, and set to nil\n\t\t@rent = rent\n\n\t\t# Let's set these read-only properties\n\t\t@bedrooms = br\n\t\t@baths = baths\n\tend",
"def in... | [
"0.66873395",
"0.6675049",
"0.6654048",
"0.66481",
"0.6602693",
"0.6602693",
"0.65275204",
"0.6514112",
"0.6508578",
"0.64695656",
"0.6460394",
"0.6457085",
"0.64508003",
"0.64508003",
"0.64508003",
"0.64508003",
"0.6431709",
"0.6400998",
"0.6399852",
"0.6391572",
"0.6373554"... | 0.0 | -1 |
Called when an unknown column is requested, through the default proc. If the column requested is valid, and the result set is not completely loaded, then we reload. Otherwise just note the column with add_seen_column. | def new_column_access(name)
if @callsite.columns_hash.has_key?(name)
@result_set.reload! if @result_set && name != @callsite.primary_key
Callsites.add_seen_column(@callsite, name)
end
@monitored_columns[name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_column_information\n @column = find_column(column_name)\n end",
"def get_column_conflict!(column)\n @get_column_conflicts[column.to_sym] = @get_column_conflicts[column.to_s] = column.to_sym\n end",
"def def_bad_column_accessor(column)\n overridable_methods_module.mo... | [
"0.61852115",
"0.6036646",
"0.58101773",
"0.58101773",
"0.57907426",
"0.5666642",
"0.5666642",
"0.55541104",
"0.54686904",
"0.5466782",
"0.5460164",
"0.5421956",
"0.5396008",
"0.5395728",
"0.53786755",
"0.5352191",
"0.5340087",
"0.53284913",
"0.53132015",
"0.52901965",
"0.529... | 0.5610045 | 7 |
Reload if needed before allowing assignment | def []=(name, value)
if has_key?(name)
return super
elsif @result_set && @callsite.columns_hash.has_key?(name)
@result_set.reload!
Callsites.add_seen_column(@callsite, name)
end
@monitored_columns[name] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n... | [
"0.7110478",
"0.7110478",
"0.7110478",
"0.7110478",
"0.6780967",
"0.6697563",
"0.648197",
"0.6473202",
"0.64335907",
"0.63304067",
"0.6238139",
"0.6234668",
"0.6224024",
"0.6224024",
"0.6224024",
"0.6224024",
"0.620592",
"0.61982",
"0.61319524",
"0.61217004",
"0.60914713",
... | 0.0 | -1 |
Returns the column names | def keys
@result_set ? @callsite.columns_hash.keys : super | @monitored_columns.keys
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column_names\n columns.map(&:name)\n end",
"def column_names\n @columns.keys\n end",
"def column_names\n @column_names ||= columns.collect(&:name)\n end",
"def column_names\n @column_names ||= @columns.keys\n end",
"def column_names(table_name)\n columns... | [
"0.9093375",
"0.9028692",
"0.8675462",
"0.86121047",
"0.85053194",
"0.85037684",
"0.8469396",
"0.84294116",
"0.84097254",
"0.8340165",
"0.82937634",
"0.8240265",
"0.8219738",
"0.8152901",
"0.8097549",
"0.8044956",
"0.79885995",
"0.7926295",
"0.7915806",
"0.78683937",
"0.78425... | 0.0 | -1 |
Check for a column name | def has_key?(name)
@result_set ? @callsite.columns_hash.has_key?(name) : super || @monitored_columns.has_key?(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def column?(column_name)\n self.class.column?(column_name.to_sym)\n end",
"def find_column(name)\n columns.detect { |column| column.name.to_sym == name.to_sym }\n end",
"def is_column_exist (row_key, col_family, col_name)\r\n !@table.row(row_key)[col_family+':'+col_name].blank? \r\n end",
... | [
"0.76717603",
"0.74846745",
"0.74089754",
"0.740662",
"0.7374773",
"0.73333925",
"0.73103267",
"0.727675",
"0.72519463",
"0.7090475",
"0.7031987",
"0.703082",
"0.698613",
"0.69750345",
"0.6884943",
"0.6863191",
"0.6858008",
"0.6858008",
"0.68436503",
"0.6789482",
"0.6735033",... | 0.6296025 | 42 |
Called by Hashupdate when reload is called on an ActiveRecord object | def to_hash
@result_set.reload! if @result_set
@monitored_columns.merge(self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n begin\n #TODO not implemented 2007/04/09 by shino\n raise \"not yet implemented!\"\n end\n end",
"def reload!\n... | [
"0.728459",
"0.728459",
"0.728459",
"0.728459",
"0.72404915",
"0.71212614",
"0.7066738",
"0.7055308",
"0.7055308",
"0.7055308",
"0.7055308",
"0.70525056",
"0.701455",
"0.69935095",
"0.69496953",
"0.6904777",
"0.68749046",
"0.6831836",
"0.6825984",
"0.68255824",
"0.68158495",
... | 0.0 | -1 |
Marshal Dump a real hash can't dump a monitored hash due to default proc | def _dump(depth)
Marshal.dump(to_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump_hash(hash, context = CoderContext.new)\n # Symbolizing keys to unlock **intepolation\n ObjectDumper.dump(hash, context).symbolize_keys\n end",
"def marshal_dump; end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"... | [
"0.6370029",
"0.6154525",
"0.6059051",
"0.6059051",
"0.6059051",
"0.6059051",
"0.6059051",
"0.6059051",
"0.6059051",
"0.6001698",
"0.6001698",
"0.59707004",
"0.5769598",
"0.56849545",
"0.56830066",
"0.5676868",
"0.5668782",
"0.5667047",
"0.56204265",
"0.56204265",
"0.56204265... | 0.60115016 | 9 |
Get a file from the distro, unless overridden in the instance. | def distro_file(filename)
if File.exist?(file(filename))
file(filename)
else
@distro.file(filename)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file\n @file ||= find_file\n end",
"def get_file(path)\n raise NotImplemented\n end",
"def get_file(path)\n return File.new(path)\n end",
"def file\n @file ||= find_version_file\n end",
"def file # :nodoc:\n return @file if @file\n\n if defa... | [
"0.63544774",
"0.6078408",
"0.6073801",
"0.6016818",
"0.5999588",
"0.5999588",
"0.5938236",
"0.59366167",
"0.59297574",
"0.59195566",
"0.5856962",
"0.5851127",
"0.5816218",
"0.579216",
"0.5789048",
"0.57597965",
"0.5757374",
"0.5740155",
"0.57345957",
"0.57174236",
"0.5717423... | 0.7448001 | 0 |
In the easy exercises, we worked on a problem where we had to count the number of uppercase and lowercase characters, as well as characters that were neither of those two. Now we want to go one step further. Write a method that takes a string, and then returns a hash that contains 3 entries: one represents the percentage of characters in the string that are lowercase letters, one the percentage of characters that are uppercase letters, and one the percentage of characters that are neither. You may assume that the string will always contain at least one character. Examples | def letter_percentages(string)
case_hash = { lowercase: 0, uppercase: 0, neither: 0 }
string.each_char do |char|
case
when char =~ /[A-Z]/ then case_hash[:uppercase] += 1
when char =~ /[a-z]/ then case_hash[:lowercase] += 1
else case_hash[:neither] += 1
end
end
characters = string.length.to_f
case_hash.keys.each do |key|
case_hash[key] /= characters
case_hash[key] *= 100
end
case_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter_percentages(string)\n total_count = string.size\n character_hash = {}\n\n character_hash[:lowercase] = (string.count(\"a-z\").to_f / total_count) * 100\n character_hash[:uppercase] = (string.count(\"A-Z\").to_f / total_count) * 100\n character_hash[:neither] = (string.count(\"^a-zA-Z\").to_f / tota... | [
"0.86928123",
"0.8495483",
"0.8456352",
"0.8389563",
"0.83798254",
"0.83574146",
"0.83572996",
"0.83397925",
"0.831645",
"0.8313526",
"0.8267387",
"0.8256818",
"0.82461673",
"0.82177204",
"0.8191152",
"0.81734353",
"0.8166561",
"0.81597275",
"0.81410867",
"0.8115333",
"0.8114... | 0.85416883 | 1 |
Performs the ip reverse loopkup and the UA parsing and record the results to the database | def perform(link, ip, ua)
ActiveRecord::Base.connection_pool.with_connection do
viewer_hash = Viewer.md5(ip, ua)
viewer = Viewer.find_by(viewer_digest: viewer_hash)
# Increment the view count if the viewer is the same to save db space
if viewer
viewer.increment!(:view_count)
else
viewer = Viewer.new
viewer.ip = ip
viewer.ua = ua
viewer.viewer_digest = viewer_hash
geo = MaxMind.lookup(ip)
if geo.found?
viewer.city = geo.city.name
viewer.country = geo.country.iso_code
end
user_agent = UserAgent.parse(ua)
viewer.browser = user_agent.browser
viewer.browser_version = user_agent.version
viewer.os = user_agent.platform
viewer.view_count = 1
viewer.link_id = link.id
viewer.save!
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reverselookup(session,iprange,dest)\n\tdest = dest + \"-DNS-reverse-lookup.txt\"\n\tprint_status(\"Performing DNS Reverse Lookup for IP range #{iprange}\")\n\tfilewrt(dest,\"DNS Reverse Lookup for IP range #{iprange}\")\n\tiplst =[]\n\ti, a = 0, []\n\tbegin\n\t\tipadd = Rex::Socket::RangeWalker.new(iprange)\n\... | [
"0.6143405",
"0.5860761",
"0.5695464",
"0.55619025",
"0.5503667",
"0.5478845",
"0.5467304",
"0.53831387",
"0.53575486",
"0.5340883",
"0.5330415",
"0.53175056",
"0.5315762",
"0.5312806",
"0.5279532",
"0.52591646",
"0.52546614",
"0.52539015",
"0.5200653",
"0.5190582",
"0.517952... | 0.0 | -1 |
Perform a GET request === Parameters +path+ The relative path to perform the request to. E.g. /players +id+ The id of the resource to get. E.g 10 or name%20of%20thing will be suffixed to the end of the URL | def get(path, id)
path = "#{API_PATH}#{path}"
return super(path, id, headers: admin_headers(path, '', 'GET', resource_id: id))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(path)\n request 'GET', path\n end",
"def get(path)\n request(:get, path, {})\n end",
"def get(path, params={})\n request(:get, params.merge(:path => path))\n end",
"def get(path, params={})\n request(:get, path, params)\n end",
"def get(path, params={})\n reques... | [
"0.86706555",
"0.8470161",
"0.833475",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81848496",
"0.81820744",
"0.81617576",
"0.81617576",
"0.81393164",
"0.81393164",
"0.80610687",
"0.8013339",
... | 0.0 | -1 |
Perform a POST request === Parameters +path+ The relative path to perform the request to. E.g. /players +body+ A hash representing the body of the request will be converted to JSON | def post(path, body, headers: {})
path = "#{API_PATH}#{path}"
return super(path, body, headers: admin_headers(path, body.to_json, 'POST').merge(headers))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, body = '', headers = {})\n headers = { 'Content-Type' => 'application/json' }.merge(headers)\n request(:post, path, body, merge_default_headers(headers))\n end",
"def post(path, params = {})\n request(:post, path, params)\n end",
"def post(path, params={})\n request... | [
"0.8171774",
"0.8162071",
"0.8135845",
"0.8135845",
"0.8135845",
"0.812355",
"0.812355",
"0.812355",
"0.812355",
"0.812355",
"0.8107398",
"0.807047",
"0.805852",
"0.80521643",
"0.8035097",
"0.8018391",
"0.80029976",
"0.796493",
"0.7952873",
"0.7942277",
"0.79133433",
"0.790... | 0.0 | -1 |
GET /clients GET /clients.json | def index
@clients = Client.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @clients = current_user.clients\n render json: @clients\n end",
"def index\n @clients = Client.all\n render json: @clients\n end",
"def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cli... | [
"0.815332",
"0.8005505",
"0.77875555",
"0.772355",
"0.75659597",
"0.75659597",
"0.755227",
"0.74874014",
"0.74423456",
"0.7392351",
"0.73501134",
"0.7308959",
"0.72913766",
"0.7289062",
"0.7289062",
"0.7289062",
"0.7289062",
"0.7289062",
"0.7289062",
"0.7289062",
"0.727864",
... | 0.7262004 | 28 |
POST /clients POST /clients.json | def create
@client = Client.new(client_params)
respond_to do |format|
if @client.save
format.html { redirect_to @client, notice: 'client was successfully created.' }
format.json { render :show, status: :created, location: @client }
else
format.html { render :new }
format.json { render json: @client.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render... | [
"0.72085994",
"0.71753484",
"0.7120956",
"0.7116921",
"0.710099",
"0.6981326",
"0.6981326",
"0.6981326",
"0.6971666",
"0.6971666",
"0.6971666",
"0.6970004",
"0.69603",
"0.6956069",
"0.69386387",
"0.69206727",
"0.691133",
"0.689539",
"0.6878896",
"0.6864519",
"0.68514645",
"... | 0.6979284 | 8 |
PATCH/PUT /clients/1 PATCH/PUT /clients/1.json | def update
respond_to do |format|
if @client.update(client_params)
format.html { redirect_to @client, notice: 'client was successfully updated.' }
format.json { render :show, status: :ok, location: @client }
else
format.html { render :edit }
format.json { render json: @client.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @client.update(client_params)\n render json: @client\n end",
"def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n ... | [
"0.7246776",
"0.7098947",
"0.7001019",
"0.7001019",
"0.6907153",
"0.6907153",
"0.6898349",
"0.68953735",
"0.68737906",
"0.68383723",
"0.6836901",
"0.6832358",
"0.68251896",
"0.68093616",
"0.6761033",
"0.67596495",
"0.6749836",
"0.6744567",
"0.6742964",
"0.6738345",
"0.6662724... | 0.66230094 | 30 |
DELETE /clients/1 DELETE /clients/1.json | def destroy
client = User.find(params[:id])
if client.can_be_destroyed?
client.destroy!
redirect_to clients_url, notice: "Cliente foi removido com sucesso."
else
redirect_to clients_url, notice: "Cliente #{client.name} NÃO pode ser removido."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n fo... | [
"0.7799133",
"0.7799133",
"0.77840954",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.7773193",
"0.77693796",
"0.7714836",
"0.7636574",
"0.76239145",
"0.75873226",
"0.75829566",
"0.75397116",
"0.75370675",
"0.753706... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_client
@client = Client.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def client_params
params.require(:client).permit(:name, :email, :age, :type, :cpf_cnpj, :price, :phone, :unit_price, :q)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6948149",
"0.68135875",
"0.68015283",
"0.67953765",
"0.6745843",
"0.67416775",
"0.652725",
"0.6521263",
"0.649084",
"0.64307743",
"0.64307743",
"0.64307743",
"0.6398334",
"0.63553715",
"0.6355045",
"0.6346211",
"0.63444513",
"0.6338212",
"0.63267356",
"0.63267356",
"0.6326... | 0.0 | -1 |
Inicializamos las variables con los valores indicados en los test | def initialize (nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal)
@nombre, @saturadas, @monoinsaturadas, @polinsaturadas, @azucares, @polialcoles, @almidon, @fibra, @proteinas, @sal = nombre, saturadas, monoinsaturadas, polinsaturadas, azucares, polialcoles, almidon, fibra, proteinas, sal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prep_variables\n end",
"def initialize(parametros)\n # En cada variable intanciada le asignamos un hash con la variable correspondiente\n @villano = parametros[:villano]\n @frase = parametros[:frase]\n end",
"def build_vars\n\n end",
"def setup\n\n # Save the Global variable's original... | [
"0.66518974",
"0.6431924",
"0.6395413",
"0.6174541",
"0.6092185",
"0.60780436",
"0.60626906",
"0.601923",
"0.6018074",
"0.60154766",
"0.6004109",
"0.5925563",
"0.5908284",
"0.5899269",
"0.5899269",
"0.5864943",
"0.5855662",
"0.5827078",
"0.5819485",
"0.58133143",
"0.57801366"... | 0.55252343 | 54 |
Metodo para calcular las grasas totales | def grasas_totales
@grasas_totales = @saturadas + @monoinsaturadas + @polinsaturadas
return @grasas_totales
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gramos_total\n\t\tsuma = 0\n\t\t\n\t\t@gramos.each do |i|\n\t\t\tsuma += i\n\t\tend\n\n\t\treturn suma.round(2)\n\tend",
"def ir_grasa_total \n\t\t@grasa_ir = grasas_totales\n\t\t@ir_grasa_total = (@grasa_ir/70.to_f) * 100\n\t\t@ir_grasa_total.round(1)\n\tend",
"def total\n self.gross_total\n end",
"... | [
"0.7160873",
"0.71485835",
"0.69543135",
"0.69543135",
"0.69493335",
"0.6946738",
"0.6863127",
"0.6808908",
"0.678805",
"0.67332304",
"0.6647134",
"0.66194075",
"0.66137165",
"0.65810174",
"0.6544308",
"0.6515088",
"0.6507847",
"0.65070707",
"0.6496137",
"0.6430173",
"0.64139... | 0.7475685 | 0 |
Metodo para sumar los hidratos | def hidratos
@hidratos = @azucares + @polialcoles + @almidon
return @hidratos
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def totalHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn hidr.round(2)\n\tend",
"def hidratos_carbono\r\n hc = 0\r\n @lista_alimentos.each do |i|\r\n hc += i.carbohidratos\r\n end\r\n return hc... | [
"0.701757",
"0.6697318",
"0.6628114",
"0.633589",
"0.6300328",
"0.6256057",
"0.6235627",
"0.6121417",
"0.60861176",
"0.60598654",
"0.60550284",
"0.60386693",
"0.597517",
"0.59596515",
"0.5916338",
"0.59016967",
"0.5862756",
"0.5860524",
"0.58415586",
"0.58265567",
"0.58223474... | 0.75653464 | 0 |
Metodo para calcular el valor energetico en kj | def ener_kj
@ener_kj = @saturadas * 37 + @monoinsaturadas * 37 + @polinsaturadas * 37 + @azucares * 17 + @polialcoles * 10 + @almidon * 17 + @fibra * 8 + @proteinas * 17 + @sal * 25
return @ener_kj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end",
"def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + ... | [
"0.7977705",
"0.77765566",
"0.7709041",
"0.7496868",
"0.7494671",
"0.73538005",
"0.7347203",
"0.7329644",
"0.7285674",
"0.72770804",
"0.72706616",
"0.721177",
"0.7161978",
"0.7133994",
"0.70798945",
"0.70559853",
"0.70325184",
"0.67764866",
"0.670814",
"0.6679261",
"0.6678211... | 0.7849189 | 1 |
Metodo para calcular el valor energetico en kcal | def ener_kcal
@ener_kcal = @saturadas * 9 + @monoinsaturadas * 9 + @polinsaturadas * 9 + @azucares * 4 + @polialcoles * 2.4 + @almidon * 4 + @fibra * 2 + @proteinas * 4 + @sal * 6
return @ener_kcal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end",
"def irenergeticoKcal\n vag=(valore... | [
"0.8054328",
"0.7781205",
"0.760394",
"0.7553914",
"0.7464455",
"0.7399564",
"0.7382168",
"0.73652",
"0.7325142",
"0.72236335",
"0.7180768",
"0.71265876",
"0.7110533",
"0.7072896",
"0.7064068",
"0.70418096",
"0.6999248",
"0.6949114",
"0.6942595",
"0.69317025",
"0.6894661",
... | 0.839143 | 0 |
Metodo para devolver el nombre | def devolver_nombre
return @nombre
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_nombre # la convencion de ruby es def nombre\n @nombre # el nombre es implicito\n end",
"def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend",
"def nombre\r\n return @nombre\r\n \r\n end",
"def new_name; end",
"def nombre_completo\n\t\t\"#{nombre... | [
"0.6959307",
"0.6818994",
"0.6752953",
"0.6738123",
"0.67150027",
"0.66608924",
"0.66608924",
"0.6557496",
"0.6557349",
"0.65491015",
"0.65263003",
"0.6523811",
"0.65085536",
"0.64883244",
"0.6486892",
"0.6472047",
"0.64448607",
"0.6442787",
"0.64370185",
"0.64370185",
"0.642... | 0.7149826 | 0 |
Metodo para devolver las grasas saturadas | def devolver_grasas_saturadas
return @saturadas
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def\treduced_form(objets_g, objets_d)\n\tobjets_g.each do |objetg|\n\t\tobjets_d.each do |objetd|\n\t\t\tif objetg.puissance == objetd.puissance\n\t\t\t\tif objetg.signe == '-'\n\t\t\t\t\tobjetg.number = -(objetg.number)\n\t\t\t\tend\n\t\t\t\tif objetd.signe == '-'\n\t\t\t\t\tobjetd.number = -(objetd.number)\n\t\t... | [
"0.5818024",
"0.57107824",
"0.5640331",
"0.55560076",
"0.54341704",
"0.5382599",
"0.5375633",
"0.53148407",
"0.5298562",
"0.5276869",
"0.5264772",
"0.52521235",
"0.52506244",
"0.52298695",
"0.52260864",
"0.5221142",
"0.52089816",
"0.5207861",
"0.5162287",
"0.5154569",
"0.5147... | 0.7301307 | 0 |
Metodo para devolver el azucar | def devolver_azucar
return @azucares
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def asignar_azucares(azucares)\n @azucares=azucares\n end",
"def suivre; end",
"def reset_reincarnate\n #CONTCAR を最後から解釈していく。\n #全てだめだったら POSCAR を解釈する。\n #全部だめだったら例外を投げる。\n\n #CONTCAR を解釈できたディレクトリで INCAR, KPOINTS, POTCAR を取得。\n #geomopt01 という名前でディレクトリを作る。\n contcars = Di... | [
"0.57534486",
"0.5548763",
"0.55241203",
"0.54843396",
"0.54828346",
"0.5478929",
"0.54446596",
"0.54395616",
"0.54312724",
"0.5358371",
"0.53564763",
"0.5337233",
"0.5274564",
"0.5270012",
"0.5260974",
"0.52496123",
"0.52451223",
"0.5240722",
"0.52242684",
"0.52125925",
"0.5... | 0.67256296 | 0 |
Metodo para devolver las proteinas | def devolver_proteinas
return @proteinas
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proteinlist\n\n end",
"def asignar_proteinas(proteinas)\n @proteinas=proteinas\n end",
"def proteinas\n\t\treturn @proteinas*@cantidad\n\tend",
"def porcentaje_proteinas\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n porcentaje_prot = 0\n while(auxNodo... | [
"0.6641599",
"0.65269095",
"0.60074806",
"0.58905804",
"0.58296907",
"0.5733687",
"0.56671935",
"0.5651301",
"0.5586238",
"0.5459697",
"0.5454101",
"0.54339343",
"0.5416301",
"0.5403063",
"0.53954345",
"0.53539234",
"0.5336469",
"0.53334725",
"0.5321199",
"0.5306268",
"0.5254... | 0.75099826 | 0 |
Metodo para devolver la sal | def devolver_sal
return @sal
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def saluda\n\tputs \"Saludando desde la funcion\"\nend",
"def asignar_sal(sal)\n @sal=sal\n end",
"def suivre; end",
"def salvage\n return @salvage\n end",
"def salvage\n r... | [
"0.696277",
"0.69147116",
"0.6354455",
"0.619392",
"0.619392",
"0.6188036",
"0.60734177",
"0.59251374",
"0.5802724",
"0.5802724",
"0.57665783",
"0.5674047",
"0.5583754",
"0.5574152",
"0.5568229",
"0.55669624",
"0.5540754",
"0.5532008",
"0.54430634",
"0.5436238",
"0.5434508",
... | 0.6667117 | 2 |
Metodo para calcular el indice de referencia del valor energetico en kj | def ir_energetico
@ener_ir = ener_kj
@ir_energetico = (@ener_ir/8400.to_f) * 100
@ir_energetico.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def ig_ind\n\t\taibc(@datos[0]).each_with_index.map{ |ind, i| (ind/aibc(@datos[1])[i])*100 }\n\tend",
"def index(p0) end",
"def index(p0) end",
... | [
"0.5925341",
"0.58569604",
"0.5822976",
"0.5822976",
"0.57603276",
"0.5728507",
"0.5717402",
"0.5680167",
"0.56749076",
"0.565416",
"0.5648394",
"0.5571958",
"0.5554681",
"0.555365",
"0.5543478",
"0.5531797",
"0.5527543",
"0.5479607",
"0.54749054",
"0.5448315",
"0.54477036",
... | 0.0 | -1 |
Metodo para calcular el indice de referencia de las grasas totales | def ir_grasa_total
@grasa_ir = grasas_totales
@ir_grasa_total = (@grasa_ir/70.to_f) * 100
@ir_grasa_total.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def geidiario\n auxNodo1 = @lista_alimentos.head\n auxNodo2 = @gramos.head\n geitotal = 0\n while(auxNodo1 != nil && auxNodo2 != nil)\n geitotal += (auxNodo1.value.gei * auxNodo2.value) / 100\n auxNodo1 = auxNodo1.next\n auxNodo2 = auxNodo2.next\n end\n return geitotal.round(1)\n ... | [
"0.59413123",
"0.59043545",
"0.586537",
"0.578815",
"0.5753245",
"0.5736151",
"0.5715902",
"0.56985164",
"0.5665582",
"0.56473607",
"0.55694705",
"0.5566482",
"0.5548005",
"0.5533819",
"0.55297446",
"0.55159247",
"0.55031776",
"0.5501452",
"0.54980415",
"0.5497114",
"0.549567... | 0.5636058 | 10 |
Metodo para calcular el indice de referencia de las grasas saturadas | def ir_grasa_saturada
@ir_grasa_saturada = (@saturadas/20.to_f)*100
@ir_grasa_saturada.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate_index(range_size, step_size, value)\n (value / step_size + range_size / 2).round\n end",
"def relative(n, type = nil)\n case type\n when :location\n ;\n when :aa\n if n = abs2rel(n)\n (n - 1) / 3 + 1\n else\n nil\n end\n else\n abs2rel(... | [
"0.58352727",
"0.56442463",
"0.5639276",
"0.563041",
"0.5580876",
"0.55717826",
"0.55208117",
"0.5460806",
"0.54395366",
"0.5409294",
"0.54031986",
"0.53755605",
"0.5353243",
"0.5331066",
"0.5302636",
"0.5294317",
"0.5288519",
"0.5269053",
"0.524548",
"0.5236054",
"0.5236054"... | 0.0 | -1 |
Metodo para calcular el indice de referencia de los hidratos | def ir_hidratos
@hidratos_ir = hidratos
@ir_hidratos = (@hidratos_ir/260.to_f)*100
@ir_hidratos.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relative index, x, y\n target = index + x + (y * @size)\n if ((target % @size) - (index % @size)).abs > 1\n target = nil\n elsif target < 0 || target > (@size**2) - 1\n target = nil\n end\n target\n end",
"def calcIndice\n\t\t# [true,true,false,true]\t\t\t\t[2,1]\n\t\t# [false,true,... | [
"0.5898733",
"0.58464444",
"0.5804442",
"0.57937735",
"0.57755023",
"0.57001144",
"0.57001144",
"0.5676708",
"0.56446743",
"0.56384766",
"0.56384766",
"0.5633447",
"0.55876166",
"0.5570042",
"0.5570042",
"0.5570042",
"0.5570042",
"0.54706925",
"0.5458837",
"0.54568714",
"0.54... | 0.0 | -1 |
Metodo para calcular el indice de referencia de los azucares | def ir_azucares
@ir_azucares = (@azucares/90.to_f)*100
@ir_azucares.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def refs_at; end",
"def ref_xy(); @ref_xy; end",
"def _lex_index_offsets; end",
"def _lex_index_offsets; end",
"def _lex_index_offsets; end",
... | [
"0.59261435",
"0.5909279",
"0.5785441",
"0.5632569",
"0.5632569",
"0.5632569",
"0.5632569",
"0.55576813",
"0.55576813",
"0.5535988",
"0.5525793",
"0.5517249",
"0.54990405",
"0.5464578",
"0.5421724",
"0.5421724",
"0.5421724",
"0.5421724",
"0.5404562",
"0.54033005",
"0.5397056"... | 0.0 | -1 |
Metodo para calcular el indice de referencia de las proteinas | def ir_proteina
@ir_proteina = (@proteinas/50.to_f)*100
@ir_proteina.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def index(p0) end",
"def index(p0) end",
"def to_i(start = 0, rel_to = nil)\n if rel_to == :self\n 0\n else\n @address - r... | [
"0.62630326",
"0.58543676",
"0.58543676",
"0.57998836",
"0.57489616",
"0.5663662",
"0.5607554",
"0.55892944",
"0.5564525",
"0.55636585",
"0.5544062",
"0.55305314",
"0.5524603",
"0.55214006",
"0.5497485",
"0.5491238",
"0.5461816",
"0.5461816",
"0.5461816",
"0.5461816",
"0.5453... | 0.0 | -1 |
Metodo para calcular el indice de referencia de la sal | def ir_sal
@ir_sal = (@sal/6.to_f)*100
@ir_sal.round(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offset_for (ref)\n @xref[ref.id][ref.gen]\n rescue\n raise InvalidObjectError, \"Object #{ref.id}, Generation #{ref.gen} is invalid\"\n end",
"def to_i(start = 0, rel_to = nil)\n if rel_to == :self\n 0\n else\n @address - rel_to.to_i + (@reloc ? start : 0)\n end u... | [
"0.5629475",
"0.5610031",
"0.5503742",
"0.5468541",
"0.5446083",
"0.53607154",
"0.53506106",
"0.5337683",
"0.53362995",
"0.53123575",
"0.53104055",
"0.53073066",
"0.53073066",
"0.5300041",
"0.52778625",
"0.5269853",
"0.52639097",
"0.5263162",
"0.52492934",
"0.52492934",
"0.52... | 0.54411644 | 5 |
Metodo para el modulo Comparable | def <=> (other)
ener_kj <=> other.ener_kj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comparable? = super && index.comparable?",
"def <=>(_other)\n 1\n end",
"def compare(attr, statable)\r\n a = self.send(attr)\r\n\tb = statable.send(attr)\r\n#\treturn 0 if a.nil? || b.nil?\r\n\t\r\n\torder = StatSummary::STATS[attr][:order]\r\n\tif order == 1\r\n\t return (a || 10000) <=... | [
"0.6719247",
"0.6185566",
"0.6178023",
"0.6159146",
"0.60819304",
"0.6060105",
"0.60527956",
"0.603131",
"0.602213",
"0.60147595",
"0.6007995",
"0.60037243",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
"0.5970705",
... | 0.0 | -1 |
getting all logged users | def index
@users = []
User.all.each do |u|
if u.online?
@users.append({user: u, sign_in_at: u.attributes['current_sign_in_at']})
end
end
render json: @users.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_users()\n User.all\n end",
"def list_all_users\n\n end",
"def list_users\n http_get(:uri=>\"/users\", :fields=>x_cookie)\n end",
"def get_all\n @user_repository.get_all_users\n end",
"def list\n get('users')['users']\n end",
"def getAllUsers()\n puts \"... | [
"0.7919839",
"0.7796412",
"0.7794115",
"0.7788932",
"0.7739656",
"0.77068937",
"0.76787066",
"0.76246256",
"0.7610135",
"0.7601204",
"0.75456446",
"0.752076",
"0.7493004",
"0.7484921",
"0.7463221",
"0.74370253",
"0.74075395",
"0.73912966",
"0.7382473",
"0.73769605",
"0.736940... | 0.0 | -1 |
get current user information | def set_current_user
@current_user = User.find_by_email(params["email"])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def user_info\n auth_hash['user_info']\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def user_inf... | [
"0.81464386",
"0.8120922",
"0.80128956",
"0.79715914",
"0.7964375",
"0.7918694",
"0.78894544",
"0.7881571",
"0.7787845",
"0.7765651",
"0.77585024",
"0.76703745",
"0.766105",
"0.76588845",
"0.76523596",
"0.76286966",
"0.7621908",
"0.762082",
"0.75852394",
"0.75569737",
"0.7550... | 0.0 | -1 |
set expire time in the header for front end | def set_headers(parsed_response)
headers['expire_at'] = parsed_response["exp"].to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expire!\n headers['Age'] = max_age.to_s if fresh?\n end",
"def expire(duration)\n headers['Cache-Control'] = \"max-age=#{duration.to_i}\"\n headers['Expires'] = duration.from_now.httpdate\n end",
"def expires(max_age, opts=OPTS)\n cache_control(Hash[opts].merge!(:max_age=>max_... | [
"0.7984031",
"0.7700418",
"0.7465602",
"0.7387784",
"0.7386567",
"0.7334532",
"0.72945714",
"0.72722733",
"0.7230464",
"0.7220718",
"0.71988815",
"0.7183675",
"0.71565515",
"0.71081793",
"0.70674723",
"0.70556885",
"0.7036875",
"0.70150286",
"0.7011125",
"0.6982384",
"0.69823... | 0.7272304 | 7 |
caracteres, utilizando .select . | def select_largo_may_5(names)
imp= names.select{|nombres|nombres.length >5}
print "los nombres que son más largos de 5#{imp} \n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_chars(&block)\n chars.select(&block)\n end",
"def test_character_classes_give_options_for_a_character\n animals = [\"cat\", \"bat\", \"rat\", \"zat\"]\n assert_equal ['cat', 'bat', 'rat'], animals.select { |a| a[/[cbr]at/] }\n end",
"def test_character_classes_give_options_for_a_chara... | [
"0.7074299",
"0.6338609",
"0.62669224",
"0.6179054",
"0.58777803",
"0.57886565",
"0.5711764",
"0.5689818",
"0.5689818",
"0.56891686",
"0.56265277",
"0.56103563",
"0.55936813",
"0.5554249",
"0.5554249",
"0.5544519",
"0.5525337",
"0.5525337",
"0.55213076",
"0.5476319",
"0.54731... | 0.49641606 | 69 |
Utilizar .select para crear un arreglo con todos los nombres que empiecen con P. | def select_inicia_P(names)
imp= names.select{|nombres|nombres if nombres[0] =='P'}
print "los nombres en que inician con P #{imp} \n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_tiporelacion\n [ \n [\"BENEFICIARIO\",\"BENEFICIARIO\"],\n [\"INTEGRANTE\",\"INTEGRANTE\"],\n [\"PROPIETARIO\",\"PROPIETARIO\"],\n [\"APODERADO\",\"APODERADO\"]\n ] \n end",
"def select_options\n all.map {|e| [e.name, e.to_s] }\n end",
"def select_options\n ... | [
"0.64640945",
"0.6276755",
"0.6276755",
"0.6032161",
"0.5896585",
"0.5786959",
"0.5773675",
"0.57470995",
"0.56293994",
"0.55475724",
"0.55403936",
"0.55390775",
"0.5496897",
"0.5485409",
"0.5457287",
"0.5454141",
"0.5447415",
"0.5421931",
"0.5392216",
"0.5386301",
"0.5370348... | 0.6305254 | 1 |
Utilizando .count , contar los elementos que empiecen con 'A', 'B' o 'C'. | def select_inicia_ABC(names)
imp= names.count{|contar|contar if contar[0] =='A'|| contar[0] =='B'|| contar[0] =='C'}
print "La cantidad de nombres en que inician con A,B o C es #{imp} \n"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contando(arr)\n b = arr.count {|x| x[0] == 'A' || x[0] == 'B' || x[0] == 'C'}\n print \"#{b}\\n\"\nend",
"def nombres_abc(nombres)\n nombres.select{|x| x =~ /A/ || x =~ /B/ || x =~ /C/}.count # 2\nend",
"def one_rv\n count = 0\n for x in 1...@elements.length\n if @elements[x].remaining_val... | [
"0.7444446",
"0.68421763",
"0.59272563",
"0.5828216",
"0.5811692",
"0.57938135",
"0.577429",
"0.57717603",
"0.57507193",
"0.57154775",
"0.5712096",
"0.57081366",
"0.570124",
"0.56736416",
"0.567063",
"0.56269807",
"0.5626243",
"0.5602646",
"0.55980694",
"0.5549712",
"0.554849... | 0.68026257 | 2 |
uncomment when you have Enumerable included | def to_s
pairs = inject([]) do |strs, (k, v)|
strs << "#{k.to_s} => #{v.to_s}"
end
"{\n" + pairs.join(",\n") + "\n}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inclusions; end",
"def through; end",
"def collect; end",
"def refute_includes(collection, obj, msg = T.unsafe(nil)); end",
"def includes\n []\n end",
"def exclude; end",
"def each_identity; end",
"def excluded; end",
"def inclusions=(_arg0); end",
"def includes() return @includes... | [
"0.59435934",
"0.5794355",
"0.5722233",
"0.5718117",
"0.569589",
"0.5684911",
"0.5664752",
"0.566228",
"0.5641536",
"0.5562596",
"0.55595744",
"0.5515245",
"0.5475617",
"0.5450039",
"0.5450039",
"0.54184806",
"0.53960466",
"0.53936493",
"0.53872144",
"0.5383926",
"0.53793705"... | 0.0 | -1 |
USPS: usps tracking codes are validated based on format (one of USS228 or USS39) and a check digit (using either of the USPS's MOD10 or MOD11 algorithms) see USPS Publications: 91 (05/2008) pp. 38 97 (05/2002) pp. 6263 109 (09/2007) pp. 1921 | def valid_usps?(value)
uss228?(value) || uss39?(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validateSL(vat_number)\r\n total = 0\r\n multipliers = [8,7,6,5,4,3,2]\r\n 0.upto(6) do |i|\r\n total += vat_number[i,1].to_i * multipliers[i]\r\n end\r\n # Establish check digit\r\n total = 11 - total % 10\r\n total = 0 if total > 9\r\n return true if total == vat_number[7..8].to_... | [
"0.58628917",
"0.58224183",
"0.57902575",
"0.5748455",
"0.5733736",
"0.5687147",
"0.5614918",
"0.55473465",
"0.55473465",
"0.55399734",
"0.5537894",
"0.5487515",
"0.54865384",
"0.54830104",
"0.5468047",
"0.5440551",
"0.5420918",
"0.5382976",
"0.5365061",
"0.53355366",
"0.5321... | 0.6919532 | 0 |
takes a string containing digits and calculates a checksum using the provided weight array cycles the weight array if it's not long enough | def weighted_sum(value, weights)
digits = value.split('').map { |d| d.to_i }
weights = weights.cycle.take(digits.count) if weights.count < digits.count
digits.zip(weights).inject(0) { |s,p| s + p[0] * p[1] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checksum(digits_array)\n # reverse the array , and iterate through the array.\n total = digits_array.reverse.each_with_index.inject(0) do |sum, (digit, index)|\n # Add digits together, doubling every other (even indexs)\n # Use sum_of_digits to sum the digits for products > 9\n sum + sum_o... | [
"0.6824811",
"0.6461929",
"0.63112813",
"0.6297957",
"0.6162449",
"0.61030143",
"0.60961616",
"0.60908765",
"0.6039434",
"0.6008067",
"0.5999097",
"0.5941758",
"0.5941044",
"0.56357336",
"0.561317",
"0.5585756",
"0.5546723",
"0.5509423",
"0.54980093",
"0.54724133",
"0.5467904... | 0.5807541 | 13 |
Sets the next command in the chain | def next_in_chain=(next_obj)
@_next_in_chain = next_obj
next_obj || self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_command\n @commands_pending.shift\n end",
"def next_in_chain=(next_obj)\n @_next_in_chain = next_obj\n next_obj || self\n end",
"def next\n connection.write(\"next\")\n end",
"def next\n connection.write(\"next\")\n end",
"def next\n @next\n end",
... | [
"0.7046831",
"0.6542206",
"0.63651776",
"0.63651776",
"0.6111222",
"0.61049056",
"0.60622084",
"0.60230416",
"0.60094637",
"0.60008603",
"0.5929891",
"0.5927456",
"0.58798164",
"0.58627075",
"0.5852748",
"0.58511204",
"0.58206195",
"0.579029",
"0.57740533",
"0.5769778",
"0.57... | 0.6650682 | 1 |
Get next command in chain | def next_in_chain
@_next_in_chain ||= nil
@_next_in_chain
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_command\n @commands_pending.shift\n end",
"def next\n instance = nil\n while instance.nil? && !@actions.empty?\n action = actions.shift\n commands.each do |cmd|\n instance = action.attempt(actor, cmd, !@started)\n if instance\n @started = true... | [
"0.7828336",
"0.67822826",
"0.6745663",
"0.6720127",
"0.6675321",
"0.66541904",
"0.6617601",
"0.6617601",
"0.653954",
"0.648927",
"0.648927",
"0.6388557",
"0.6388557",
"0.6388557",
"0.6388557",
"0.6388557",
"0.6388557",
"0.6380579",
"0.6317067",
"0.6279261",
"0.62406707",
"... | 0.6576843 | 8 |
Abort the chain for the current message | def abort_chain
@_abort_chain = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abort_chain\n @_abort_chain = true\n end",
"def cancel\n self.solved(:abort)\n end",
"def cancel!\n # Context is already cleared in action_for_message\n end",
"def abort\n unless @finished\n do_abort\n end\n end",
"def abort!\n throw :abort!, :aborte... | [
"0.78352",
"0.6840753",
"0.6802423",
"0.66582775",
"0.66400623",
"0.6568432",
"0.6558791",
"0.6539048",
"0.63905275",
"0.63804287",
"0.63269764",
"0.6302197",
"0.62243974",
"0.6213502",
"0.6213502",
"0.6213502",
"0.61665374",
"0.61243844",
"0.6109669",
"0.61043096",
"0.609704... | 0.7724644 | 1 |
===== You really shouldn't need to understand anything below this line ===== | def initialize(klass, &block)
@original_block = block
klass.__send__ :define_method, method_name, &block
@instance_method = klass.instance_method method_name
klass.__send__ :remove_method, method_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def terpene; end",
"def who_we_are\r\n end",
"def suivre; end",
"def berlioz; end",
"def jack_handey; end",
"def internal; end",
"def stderrs; end",
... | [
"0.78493816",
"0.7314875",
"0.68873644",
"0.6627924",
"0.6627924",
"0.6627924",
"0.6627924",
"0.6557521",
"0.64137846",
"0.6411344",
"0.64006656",
"0.63990027",
"0.637673",
"0.63513863",
"0.63355505",
"0.63355505",
"0.63255554",
"0.63090897",
"0.62980634",
"0.6289718",
"0.628... | 0.0 | -1 |
Gets details of a project's specific build variable. | def variable(project, key)
get("/projects/#{url_encode project}/variables/#{key}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details\n get(\"project/details\")[\"project\"]\n end",
"def project_setting(key)\n data.config[config[:environment]][key]\n end",
"def build_info\n build_configuration_file = 'server/local/build.yml'\n YAML.load_file(build_configuration_file)\n end",
"def build_number\n ... | [
"0.6255392",
"0.61422825",
"0.59187335",
"0.5901758",
"0.5868571",
"0.58596945",
"0.57862514",
"0.57393235",
"0.57048136",
"0.5667326",
"0.56622756",
"0.5660529",
"0.56403536",
"0.5631434",
"0.5623891",
"0.56167936",
"0.56158173",
"0.55894023",
"0.5579386",
"0.5564622",
"0.55... | 0.6871044 | 0 |
Create a build variable for a project. | def create_variable(project, key, value, **opts)
post("/projects/#{url_encode project}/variables", body: opts.merge(key: key, value: value))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getVariablesToInstantiate\n return {\n :ProjectUnixName => 'myproject'\n }\n end",
"def build_project\n @id ||= @project.at('id').inner_html\n @api_url ||= \"#{CONFIG[:api_location]}/projects/#{@id}\"\n @url ||= ... | [
"0.645703",
"0.6412289",
"0.63707054",
"0.6269043",
"0.59911686",
"0.5959276",
"0.5911554",
"0.5838533",
"0.5815975",
"0.5781917",
"0.5762497",
"0.5741636",
"0.57020634",
"0.5694706",
"0.56629956",
"0.56498444",
"0.56441957",
"0.56263906",
"0.5618402",
"0.5610102",
"0.5557422... | 0.70917594 | 0 |
Update a project's build variable. | def update_variable(project, key, value, **opts)
put("/projects/#{url_encode project}/variables/#{key}", body: opts.merge(value: value))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(rubyOF_project=nil)\n\t\t# If you invoke with no arguments, provide useful help,\n\t\t# rather than the standard error message.\n\t\tif rubyOF_project.nil?\n\t\t\traise ArgumentError, \"<1 argument>: Need to specify project name, or relative path (relative to [GEM_ROOT]/bin/projects), or absolute path t... | [
"0.6501291",
"0.6394826",
"0.63282675",
"0.6309271",
"0.6206503",
"0.6199474",
"0.61586267",
"0.61203516",
"0.6113333",
"0.61066264",
"0.6053867",
"0.5994081",
"0.5971904",
"0.5907589",
"0.59056884",
"0.5875211",
"0.5844671",
"0.58197385",
"0.58197385",
"0.5815191",
"0.580783... | 0.63532025 | 2 |
Remove a project's build variable. | def remove_variable(project, key, **opts)
delete("/projects/#{url_encode project}/variables/#{key}", query: opts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_var(key)\n put :remove_var, {:key => key}\n if Bushido::Command.last_command_successful?\n ENV[key.upcase] = nil\n end\n end",
"def clear_project\n @project = nil\n end",
"def remove_env_var(gear, key)\n args = build_base_gear_args(gear)\n args['--wit... | [
"0.66647416",
"0.63639313",
"0.6287522",
"0.6272652",
"0.623563",
"0.6201405",
"0.6119622",
"0.60351443",
"0.59251326",
"0.58191895",
"0.5816778",
"0.5809977",
"0.5791219",
"0.5776133",
"0.5764332",
"0.57118833",
"0.5677514",
"0.56569445",
"0.5650078",
"0.5620925",
"0.5588313... | 0.74771416 | 0 |
Gets a list of the group's build variables | def group_variables(group)
get("/groups/#{url_encode group}/variables")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_vars\n\n end",
"def get_variables\n result = @assigns.each_value.reduce([]) do |ar,tree|\n ar.concat(tree.get_variables)\n end\n result.uniq!.sort!\n return result\n end",
"def get_group_vals(group)\n\t\treturn Group.get_value(group... | [
"0.6439648",
"0.6239561",
"0.6202716",
"0.6135492",
"0.60376614",
"0.60376614",
"0.6014045",
"0.6011216",
"0.5914948",
"0.587618",
"0.5800413",
"0.57648516",
"0.569928",
"0.56766516",
"0.5669747",
"0.563581",
"0.5584457",
"0.5578186",
"0.55329335",
"0.5514876",
"0.54523605",
... | 0.6461572 | 0 |
Gets details of a group's specific build variable. | def group_variable(group, key)
get("/groups/#{url_encode group}/variables/#{key}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_variables(group)\n get(\"/groups/#{url_encode group}/variables\")\n end",
"def get_context_var(group, key, context = @context)\n context[\"#{group}::#{key}\"]\n end",
"def variable(project, key)\n get(\"/projects/#{url_encode project}/variables/#{key}\")\n end",
"def get... | [
"0.6597192",
"0.6038828",
"0.57796437",
"0.56682956",
"0.56631327",
"0.56071323",
"0.55946213",
"0.5572783",
"0.5570603",
"0.5516396",
"0.54949105",
"0.54552656",
"0.5438738",
"0.5406865",
"0.5397436",
"0.53870356",
"0.53717947",
"0.53717947",
"0.53571963",
"0.5331902",
"0.53... | 0.6871888 | 0 |
Create a build variable for a group. | def create_group_variable(group, key, value, **opts)
post("/groups/#{url_encode group}/variables", body: opts.merge(key: key, value: value))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def group_variable(group, key)\n get(\"/groups/#{url_encode group}/variables/#{key}\")\n end",
"def build_vars\n\n end",
"def update_group_variable(group, key, value, **opts)\n put(\"/groups/#{url_encode group}/variables/#{key}\", body: opts.merge(value: value))\n end",
"def create_variabl... | [
"0.6149153",
"0.59097266",
"0.5891283",
"0.58765596",
"0.578219",
"0.56682295",
"0.5660355",
"0.5636935",
"0.56083107",
"0.5576171",
"0.5565591",
"0.5563703",
"0.5546956",
"0.5546956",
"0.5529247",
"0.5523382",
"0.5523382",
"0.54549205",
"0.54347056",
"0.5432235",
"0.53937644... | 0.75253004 | 0 |
Update a group's build variable. | def update_group_variable(group, key, value, **opts)
put("/groups/#{url_encode group}/variables/#{key}", body: opts.merge(value: value))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bumpBuild()\n\t\t\t\t@build += 1\n\t\t\tend",
"def update!(**args)\n @group_name = args[:group_name] if args.key?(:group_name)\n end",
"def update!(**args)\n @group_name = args[:group_name] if args.key?(:group_name)\n end",
"def update!(**args)\n @group_name = arg... | [
"0.6458464",
"0.62560314",
"0.62560314",
"0.62560314",
"0.62560314",
"0.6235564",
"0.61998475",
"0.61998475",
"0.6142777",
"0.6109179",
"0.60222596",
"0.57871866",
"0.5762904",
"0.5716863",
"0.56912947",
"0.5681526",
"0.5651882",
"0.5610634",
"0.56075424",
"0.5605912",
"0.558... | 0.6865825 | 0 |
Remove a group's build variable. | def remove_group_variable(group, key)
delete("/groups/#{url_encode group}/variables/#{key}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_variable(project, key, **opts)\n delete(\"/projects/#{url_encode project}/variables/#{key}\", query: opts)\n end",
"def remove_group!( group )\n save if remove_group( group )\n end",
"def remove_var(key)\n put :remove_var, {:key => key}\n if Bushido::Command.last_comman... | [
"0.690043",
"0.63359743",
"0.63222146",
"0.6293913",
"0.62334776",
"0.62021905",
"0.6165085",
"0.61175185",
"0.6054855",
"0.6048716",
"0.5776644",
"0.5768582",
"0.5751917",
"0.574258",
"0.57425153",
"0.5712337",
"0.5674341",
"0.5654737",
"0.56434",
"0.5622822",
"0.55674833",
... | 0.78724295 | 0 |
next_duration input : RAS output : la duration suivante de la liste | def next_duration
@durations.empty? ? rand(20) : @durations.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def duration; end",
"def duration; end",
"def duration; end",
"def duration; end",
"def duration; end",
"def get_duration(actual_duration, increment)\n ((actual_duration.to_f/increment.to_f).ceil) * increment\nend",
"def duration\n 30\n end",
"def get_video_duration\n # duration = Time.strptime... | [
"0.6079597",
"0.6079597",
"0.6079597",
"0.6079597",
"0.6079597",
"0.60480714",
"0.59482455",
"0.59301776",
"0.5831853",
"0.5817171",
"0.57899755",
"0.5763632",
"0.5710039",
"0.571",
"0.56883997",
"0.56604856",
"0.5649777",
"0.56365687",
"0.56243205",
"0.56230205",
"0.562036",... | 0.6906576 | 0 |
GET /stocks GET /stocks.json | def index
@stocks = Stock.all
@stocks.each do |x|
x.price = StockQuote::Stock.quote(x.ticker).last_trade_price_only
x.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def index\n @product = Product.find(params[:product_id])\n @product_stocks = @product.product_stocks\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @product_stocks }\n... | [
"0.7824659",
"0.7670839",
"0.7539089",
"0.74832356",
"0.74832356",
"0.74832356",
"0.74832356",
"0.73043793",
"0.73043793",
"0.73043793",
"0.73043793",
"0.72803205",
"0.7269461",
"0.7264634",
"0.72195923",
"0.7194476",
"0.7182504",
"0.7172102",
"0.7107622",
"0.7096752",
"0.707... | 0.0 | -1 |
GET /stocks/1 GET /stocks/1.json | def show
@net_investment = 0
@stock = Stock.find(params[:id])
@investments = Investment.where(stock_id: @stock.id).limit(10)
@my_investments = Investment.where(stock_id: @stock.id, member_id: current_member.id)
@my_investments.each do |investment|
@net_investment += investment.share_change
end
@stock.price = StockQuote::Stock.quote(@stock.ticker).last_trade_price_only
@stock.save
require 'net/http'
begin
@url = 'http://chart.finance.yahoo.com/z?s=%{ticker}' % {ticker: @stock.ticker}
@resp = Net::HTTP.get_response(URI.parse(@url)) # get_response takes an URI object
rescue
print "Connection error."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n ... | [
"0.8133552",
"0.782858",
"0.782858",
"0.782858",
"0.782858",
"0.761385",
"0.75144047",
"0.74571216",
"0.74219114",
"0.7386134",
"0.7381532",
"0.73366547",
"0.7298271",
"0.72734106",
"0.7138701",
"0.713756",
"0.71152925",
"0.71152925",
"0.71152925",
"0.71152925",
"0.710465",
... | 0.0 | -1 |
POST /stocks POST /stocks.json | def create
if member_signed_in?
@stock = Stock.new(stock_params)
@stock.ticker = @stock.ticker.upcase
@stock.save
@testStockTicker = StockQuote::Stock.quote(@stock.ticker)
if @testStockTicker.failure?
@stock.destroy
respond_to do |format|
format.html { redirect_to new_stock_path, notice: 'Invalid ticker. Please try again.' }
end
else
response = Net::HTTP.get_response("d.yimg.com", "/autoc.finance.yahoo.com/autoc?query=" + @stock.ticker + "&callback=YAHOO.Finance.SymbolSuggest.ssCallback")
stockHash = response.body[39...-1]
Rails.logger.debug("debug:: STOCKHASH : " + stockHash)
parsed = JSON.parse(stockHash)
@stock.name = parsed["ResultSet"]["Result"][0]["name"]
respond_to do |format|
if @stock.save
format.html { redirect_to @stock, notice: 'Stock was successfully added.' }
else
format.html { render action: 'new' }
format.json { render json: @stock.errors, status: :unprocessable_entity }
end
end
end
else
redirect_to new_member_session_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { rende... | [
"0.7304764",
"0.7258611",
"0.7258611",
"0.7258611",
"0.7258611",
"0.7221076",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.71179634",
"0.7115472",
"0.70998645",
"0.7012972",
"0.69397414",
"0.6908692",
"0.679796",
"0.67754006",
"0.67698586",... | 0.6236606 | 61 |
PATCH/PUT /stocks/1 PATCH/PUT /stocks/1.json | def update
respond_to do |format|
if @stock.update(stock_params)
format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @stock.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json... | [
"0.74339914",
"0.72977054",
"0.72977054",
"0.72977054",
"0.72953606",
"0.7252088",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.7222041",
"0.70605403",
"0.69198126",
"0.69051874",
"0.68895... | 0.72489965 | 7 |
DELETE /stocks/1 DELETE /stocks/1.json | def destroy
redirect_to delete_stock_investments_path(@stock.id)
@stock.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n f... | [
"0.78614694",
"0.78614694",
"0.78614694",
"0.78614694",
"0.78614694",
"0.78614694",
"0.7832703",
"0.7832703",
"0.7695678",
"0.7682167",
"0.7662131",
"0.76254094",
"0.7605413",
"0.7605413",
"0.7603258",
"0.7586261",
"0.7575065",
"0.7575065",
"0.7569704",
"0.7569704",
"0.756970... | 0.6992511 | 69 |
Use callbacks to share common setup or constraints between actions. | def set_stock
@stock = Stock.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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def stock_params
params.fetch(:stock,{}).permit(:ticker, :name, :price)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
Standard stuff make sure this method accepts a hash argument, which is passed from OptionParser | def initialize(options={})
# test db connection
Todo.count rescue migrate
puts "try 'help'".yellow
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relevant_options_digest(options); end",
"def hash=(_arg0); end",
"def hash_in_argument_hash\n argument_hash = {} if argument_hash.nil?\n return true\n end",
"def verify_options_hook=(_arg0); end",
"def check(hash)\n # not implemented\n end",
"def ensure_hash(ambiguous_param)\n ... | [
"0.6582284",
"0.6431261",
"0.6328557",
"0.62411684",
"0.6234436",
"0.6098602",
"0.60817003",
"0.6069097",
"0.6048575",
"0.6048575",
"0.6048575",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
"0.6028403",
... | 0.0 | -1 |
GET /doctor_deseases/1 GET /doctor_deseases/1.json | def show
@doctor_desease = DoctorDesease.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @doctor_desease }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @deseases = Desease.order(:id)\n\n render json: @deseases\n end",
"def destroy\n @doctor_desease = DoctorDesease.find(params[:id])\n @doctor_desease.destroy\n\n respond_to do |format|\n format.html { redirect_to doctor_deseases_url }\n format.json { head :ok }\n end\n en... | [
"0.71200246",
"0.66852534",
"0.6587588",
"0.65459615",
"0.64791447",
"0.6300649",
"0.6282385",
"0.6213223",
"0.6136304",
"0.61219275",
"0.6111482",
"0.6103007",
"0.6009086",
"0.6004681",
"0.5980378",
"0.5956927",
"0.5949408",
"0.59034663",
"0.58889616",
"0.58889616",
"0.58790... | 0.7187616 | 0 |
GET /doctor_deseases/new GET /doctor_deseases/new.json | def new
@doctor_desease = DoctorDesease.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @doctor_desease }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @doctor_desease = DoctorDesease.new(params[:doctor_desease])\n\n respond_to do |format|\n if @doctor_desease.save\n format.html { redirect_to doctor_deseases_path, notice: I18n.t(:record_created) }\n format.json { render json: @doctor_desease, status: :created, location: @doct... | [
"0.7496431",
"0.74318945",
"0.7244164",
"0.7237747",
"0.7237747",
"0.71584755",
"0.7144257",
"0.7117955",
"0.69986373",
"0.6988786",
"0.6985298",
"0.6958632",
"0.6849564",
"0.68412805",
"0.68288654",
"0.6801798",
"0.67473847",
"0.67151916",
"0.67089516",
"0.6707758",
"0.66932... | 0.77397776 | 0 |
POST /doctor_deseases POST /doctor_deseases.json | def create
@doctor_desease = DoctorDesease.new(params[:doctor_desease])
respond_to do |format|
if @doctor_desease.save
format.html { redirect_to doctor_deseases_path, notice: I18n.t(:record_created) }
format.json { render json: @doctor_desease, status: :created, location: @doctor_desease }
else
format.html { render action: "new" }
format.json { render json: @doctor_desease.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @desease = Desease.new(desease_params)\n\n if @desease.save\n render json: @desease, status: :ok\n else\n render json: @desease.errors, status: :unprocessable_entity\n end\n end",
"def create\n @deed = Deed.create(deed_params)\n\n if @deed.save\n render json: @deed,... | [
"0.68961096",
"0.66736025",
"0.6565085",
"0.6261761",
"0.61254853",
"0.60481906",
"0.6045957",
"0.60040665",
"0.5986257",
"0.59671706",
"0.594848",
"0.59379244",
"0.5923735",
"0.5922135",
"0.59060025",
"0.5863241",
"0.5862739",
"0.58290535",
"0.5784752",
"0.57754946",
"0.5775... | 0.70627683 | 0 |
PUT /doctor_deseases/1 PUT /doctor_deseases/1.json | def update
@doctor_desease = DoctorDesease.find(params[:id])
respond_to do |format|
if @doctor_desease.update_attributes(params[:doctor_desease])
format.html { redirect_to doctor_deseases_path, notice: I18n.t(:record_updated)}
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { render json: @doctor_desease.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @doctor = Doctor.find(params[:id])\n if @doctor.update!(update_params)\n render json: {doctor: @doctor}, status: 200\n else\n render json: { errors: @doctor.errors }, status: 422\n end\n end",
"def destroy\n @doctor_desease = DoctorDesease.find(params[:id])\n ... | [
"0.65918714",
"0.652636",
"0.63839406",
"0.62829053",
"0.62781507",
"0.6225409",
"0.6213592",
"0.61595505",
"0.6120271",
"0.61111414",
"0.6091138",
"0.60854053",
"0.6071192",
"0.60257083",
"0.59882915",
"0.5896923",
"0.5896923",
"0.5896923",
"0.5896923",
"0.5896923",
"0.58969... | 0.6888022 | 0 |
DELETE /doctor_deseases/1 DELETE /doctor_deseases/1.json | def destroy
@doctor_desease = DoctorDesease.find(params[:id])
@doctor_desease.destroy
respond_to do |format|
format.html { redirect_to doctor_deseases_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @vet_doctor.destroy\n respond_to do |format|\n format.html { redirect_to vet_doctors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doctor_cliente = DoctorCliente.find(params[:id])\n @doctor_cliente.destroy\n\n respond_to do |format|\n forma... | [
"0.7258261",
"0.7229183",
"0.72238904",
"0.72101814",
"0.72101814",
"0.7099799",
"0.70400363",
"0.7035982",
"0.70334965",
"0.696674",
"0.6960531",
"0.69253755",
"0.68625844",
"0.68550056",
"0.68384695",
"0.6823051",
"0.6808676",
"0.6803868",
"0.6786627",
"0.6783414",
"0.67829... | 0.7512959 | 0 |
decode the data at a zookeeper endpoint | def deserialize_service_instance(data)
log.info "synapse: deserializing process data"
decoded = JSON.parse(data)
host = decoded['serviceEndpoint']['host'] || (raise ValueError, 'instance json data does not have host key')
port = decoded['serviceEndpoint']['port'] || (raise ValueError, 'instance json data does not have port key')
name = decoded['name'] || nil
return host, port, name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode; end",
"def decode; end",
"def decompress(data); end",
"def unpack(data); end",
"def decode\n transform :decode\n end",
"def decode(binary); ::BSON.deserialize(binary); end",
"def decode_data(body)\n if body.respond_to?(:to_str) &&\n body.length >= MIN_BODY_LENGTH &&\n ... | [
"0.5847515",
"0.5847515",
"0.5819298",
"0.5818274",
"0.55123854",
"0.55060977",
"0.54449165",
"0.5386585",
"0.53483427",
"0.5337526",
"0.5330093",
"0.53187317",
"0.53167796",
"0.5287803",
"0.52845573",
"0.5247339",
"0.5229606",
"0.52184737",
"0.51910096",
"0.5185627",
"0.5157... | 0.0 | -1 |
Authenticate for NodebasedRequest: User: Mac of wlan module Password: Mac of first wired nic (eg eth0) | def authenticate_mac
authenticate_or_request_with_http_basic do |username, password|
logger.info "Node login: #{username} #{password}"
# Node-ids consist of 12 hexadecimal chars (mac-address of node)
# In order to prevent shell-code injection, all submitted data is checked by a regular expression
session[:wlan_mac] = username
session[:bat0_mac] = password
username.match(/^[0-9a-f]{12}$/i) && password.match(/^[0-9a-f]{12}$/i)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login(host)\n # Set the timeout to 15 minutes\n @session_timeout = (Time.new.to_i + 900)\n\n login_headers = { 'referer' => \"https://#{@uri.host}/ipa/ui/index.html\", 'Accept' => 'application/json' }\n\n if @method == :keberose\n login_method = 'login_kerberos'\n gssapi = GSSAPI::Simple.... | [
"0.6519424",
"0.6442374",
"0.6435208",
"0.63172996",
"0.6301965",
"0.6196969",
"0.6119928",
"0.60989165",
"0.6073685",
"0.60687554",
"0.6052747",
"0.6043392",
"0.602386",
"0.60098237",
"0.6001303",
"0.59850836",
"0.5971463",
"0.59671754",
"0.5965009",
"0.59582597",
"0.5943094... | 0.7650318 | 0 |
construct a new filename from the count and baseFilname | def makeNewFilename
# note use of hard coded 6 digit counter width - is this enough files?
pad = "0" * (6 - @count.to_s.length) + count.to_s
newbase = @baseFilename.sub(/(\.\w*)$/, pad + '\1')
@filename = File.join(File.dirname(@filename), newbase)
Logger.log_internal {"File #{@filename} created"}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename(count = 0)\n \"_paypal_#{count.to_s.rjust(4, '0')}.iif\"\nend",
"def make_filename(file_index)\n return SAVE_PATH + SAVE_FILE_NAME.gsub(/\\{ID\\}/i) { (file_index + 1).to_s }\n end",
"def generate_filename \n last_file = Dir[@path + '/*.ind'].sort.last\n if last_file.nil?\n f... | [
"0.71867985",
"0.7107003",
"0.70236224",
"0.69479966",
"0.6919402",
"0.6902896",
"0.68629825",
"0.67225504",
"0.6633573",
"0.6588943",
"0.6575196",
"0.65490985",
"0.65475595",
"0.6474859",
"0.6467717",
"0.6464829",
"0.64452785",
"0.6396914",
"0.6383629",
"0.637218",
"0.635706... | 0.8485198 | 0 |
does the file require a roll? | def requiresRoll
if !@maxsize.nil? && @datasize > @maxsize
@datasize = 0
return true
end
if !@maxtime.nil? && (Time.now - @startTime) > @maxtime
@startTime = Time.now
return true
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll_file?\n raise NotImplementedError\n end",
"def roll_required?\n return false if ::File.exist?(@fn_copy) and (Time.now - ::File.mtime(@fn_copy)) < 180\n\n # check if max size has been exceeded\n s = @size ? ::File.size(@fn) > @size : false\n\n # check if max age has been e... | [
"0.7534634",
"0.68037504",
"0.66245174",
"0.6551973",
"0.64352435",
"0.5932168",
"0.5931487",
"0.5674",
"0.56736743",
"0.56595623",
"0.5614916",
"0.5585995",
"0.55824316",
"0.55789006",
"0.5571775",
"0.5552296",
"0.55256927",
"0.5518321",
"0.5510507",
"0.5504431",
"0.55038434... | 0.5823228 | 7 |
def cards [] end def self.cards | def choose_card
@cards.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cards\n @cards\n end",
"def initialize\n @cards = []\n end",
"def initialize()\n @cards = []\n end",
"def cards\n\t\t@cards.each do |card|\n\t\t\tputs card.card\n\t\tend\n\tend",
"def getCardArray()\n\t\treturn @cards\n\tend",
"def cards\n @cards ||= Hand.new\n end",
"def re... | [
"0.8476114",
"0.83319545",
"0.82006955",
"0.81048065",
"0.8045072",
"0.79053485",
"0.77821785",
"0.77090144",
"0.7622042",
"0.7622042",
"0.7622042",
"0.7592547",
"0.75563633",
"0.75114095",
"0.74931216",
"0.73559445",
"0.7344",
"0.73291343",
"0.7279586",
"0.72502077",
"0.7247... | 0.66844356 | 78 |
Restarg and kwrestarg are special cases because they may have no name def m(, ); end | def on_restarg(node)
name, _ = *node
if name
node = node.updated(nil, [fix_var_name(name)], meta: { arg_name: name })
end
node
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meth(\n **\n ); end",
"def **(arg0)\n end",
"def **(arg0)\n end",
"def in_kwarg=(_arg0); end",
"def m(foo: 1, **opts)\n [foo, opts]\nend",
"def a(b:, **c)\nend",
"def meth(\n arg1,\n arg2 , arg3 = 7 , *rest,\n\n\n last,\n required:,\n not_required: 7, **optio... | [
"0.7180707",
"0.7120083",
"0.7120083",
"0.7022846",
"0.6958054",
"0.6943042",
"0.6821737",
"0.68199867",
"0.66911",
"0.66778433",
"0.6665297",
"0.66315967",
"0.6615485",
"0.661472",
"0.66132677",
"0.65608245",
"0.65517956",
"0.651005",
"0.6507344",
"0.6488008",
"0.648037",
... | 0.0 | -1 |
def user_sports_params params.require(:user_sport).permit(:user_sport_id, :user) end | def session_params
params.require(:user_sport).permit(:sport, :user_sport_id, :user)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sport_params\n params.require(:sport).permit(:name, :season_id, :gender)\n end",
"def sports_interest_params\n params.require(:sports_interest).permit(:user_id, :sport_id)\n end",
"def sport_params\n params.require(:sport).permit(:name)\n end",
"def sport_params\n params.requir... | [
"0.84803975",
"0.8478112",
"0.84033185",
"0.8278604",
"0.81367",
"0.79768807",
"0.7941996",
"0.7828688",
"0.7823119",
"0.78168815",
"0.78116",
"0.77965784",
"0.7727059",
"0.7691126",
"0.76810455",
"0.7643897",
"0.75640655",
"0.7541776",
"0.7470313",
"0.7460623",
"0.74100846",... | 0.90905803 | 0 |
Shortened url requests come here | def get
url = Url.find_by!(shortened_url: params[:code])
url.count += 1
url.save!
redirect_to url.original_url
rescue StandardError
flash[:error] = "That's not right. Did you mistype the url?"
redirect_to root_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_url\n @short_url ||= client.shorten(long_url: url).link\n rescue => e\n Rails.logger.warn(\"Could not shorten bit.ly url #{e.message}\")\n url\n end",
"def retrieve_short_url_to_long_url\n if params[:short_url]==\"\"\n flash[:Error] = \"Please Enter all Details\"\n redirect_to u... | [
"0.73699874",
"0.72690666",
"0.7244011",
"0.7211378",
"0.72001505",
"0.7157583",
"0.70919156",
"0.7084237",
"0.70568913",
"0.704969",
"0.7028324",
"0.7005421",
"0.6989767",
"0.6986327",
"0.6978297",
"0.69466656",
"0.6900255",
"0.68481094",
"0.68203145",
"0.6801672",
"0.679125... | 0.0 | -1 |
detailed page of the shortened url | def show
url = Url.find(params[:id].to_i)
@stats = {
shortened_url: "#{request.base_url}/#{url.shortened_url}",
original_url: url.original_url,
usage_count: url.count,
created_at: url.created_at,
most_recent_use: url.updated_at
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def short_link\n UrlShort::IsGd.shorten @link\n end",
"def long_url\n @client.redirect_ok = false\n page = @client.get @short #Get the Long URL\n long = page.header['location']\n puts \"#{@short} => #{long}\"\n long\n end",
"def short_url\n @short_url ||= client.shorten(long_url: ... | [
"0.7496356",
"0.7432964",
"0.73681146",
"0.7166991",
"0.71091014",
"0.70111763",
"0.7005333",
"0.69958997",
"0.6991613",
"0.6991613",
"0.6978329",
"0.6910994",
"0.6842506",
"0.68280846",
"0.6795353",
"0.678868",
"0.67847764",
"0.6755545",
"0.67090935",
"0.6690916",
"0.668576"... | 0.66899 | 20 |
generate random 4charcterlong string | def random_code
existing_codes = Url.select(:shortened_url).map(&:shortened_url)
new_code = [*('A'..'Z'),*('0'..'9')].shuffle[0,4].join
while existing_codes.include?(new_code)
new_code = [*('A'..'Z'), *('0'..'9')].shuffle[0,4].join
end
new_code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def randstr\n\trand(36 ** 8).to_s(36)\nend",
"def rand_string(length = 10)\r\n rand(36**length).to_s(36)\r\n end",
"def rand_string(length = 10)\n\t\trand(36**length).to_s(36)\n\tend",
"def random_string size \n (0..size).map { ('a'..'z').to_a[rand(26)] }.join\n end",
"def rand_string(length = 10)\... | [
"0.7674053",
"0.7631057",
"0.76202166",
"0.7602675",
"0.7575624",
"0.75743854",
"0.75367445",
"0.75349647",
"0.7532578",
"0.75085586",
"0.74667615",
"0.7466229",
"0.74641836",
"0.74521226",
"0.7436616",
"0.7422036",
"0.74149215",
"0.74033767",
"0.74021894",
"0.7402023",
"0.73... | 0.0 | -1 |
Delivers a new HTML email template for the given parameters | def company_new(company, company_phone)
@company = company
@company_phone = company_phone
@trial_duration = Company::TrialLimits::DURATION
@play_store = ENV['PLAY_STORE_URL']
@app_store = ENV['APP_STORE_URL']
mail(
to: company_phone.extensions.admin.first.email,
subject: '¡Bienvenido a GurúComm!'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem... | [
"0.67770433",
"0.66957134",
"0.6587878",
"0.6558606",
"0.64843655",
"0.6415694",
"0.6407799",
"0.6277284",
"0.6237926",
"0.62356037",
"0.61948043",
"0.61871976",
"0.61804605",
"0.6140911",
"0.60619575",
"0.60419685",
"0.6034594",
"0.6010198",
"0.6008101",
"0.6008101",
"0.5977... | 0.0 | -1 |
Delivers a new HTML email template for the given parameters | def extension_delete(extension)
@extension = extension
@company = @extension.company_phone.company
mail(
to: extension.email,
subject: "#{@company.name} ha eliminado un conmutador."
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem... | [
"0.67770433",
"0.66957134",
"0.6587878",
"0.6558606",
"0.64843655",
"0.6415694",
"0.6407799",
"0.6277284",
"0.6237926",
"0.62356037",
"0.61948043",
"0.61871976",
"0.61804605",
"0.6140911",
"0.60619575",
"0.60419685",
"0.6034594",
"0.6010198",
"0.6008101",
"0.6008101",
"0.5977... | 0.0 | -1 |
Delivers a new HTML email template for the given parameters | def extension_new_or_updated(extension)
@extension = extension
@company_phone = @extension.company_phone
@company = @company_phone.company
mail(
to: extension.email,
subject: "#{@company.name} tiene una nuevo conmutador."
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem... | [
"0.6778288",
"0.6695501",
"0.6587717",
"0.6559556",
"0.648509",
"0.6417009",
"0.6407714",
"0.6276688",
"0.6239319",
"0.62355417",
"0.61955315",
"0.6187832",
"0.61812514",
"0.61393625",
"0.6062192",
"0.604328",
"0.6034051",
"0.60109484",
"0.6006722",
"0.6006722",
"0.5978661",
... | 0.0 | -1 |
Delivers a new HTML email template for the given parameters | def payment_new(payment, payable, company_phone)
@payment = payment
@payable = payable
@company_phone = company_phone
@company = Company.find_by!(
id: company_phone[:company_id]
)
emails = company_phone.extensions.admin
mail(
to: emails.map(&:email),
subject: '¡En GurúComm hemos recibido tu pago!'
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_html_template(passed, failed, env, view_build_link, view_allure_link)\n file = File.read('features/data/email_template.html')\n email_template = Nokogiri::HTML.fragment(file)\n email_template.at_css('#passed').content += passed.to_s\n email_template.at_css('#failed').content += failed.to_s\n email_tem... | [
"0.6778288",
"0.6695501",
"0.6587717",
"0.6559556",
"0.648509",
"0.6417009",
"0.6407714",
"0.6276688",
"0.6239319",
"0.62355417",
"0.61955315",
"0.6187832",
"0.61812514",
"0.61393625",
"0.6062192",
"0.604328",
"0.6034051",
"0.60109484",
"0.6006722",
"0.6006722",
"0.5978661",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.