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 |
|---|---|---|---|---|---|---|
GET /dish_mixtures GET /dish_mixtures.json | def index
@dish_mixtures = DishMixture.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mixtures = Mixture.all\n end",
"def set_dish_mixture\n @dish_mixture = DishMixture.find(params[:id])\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_url }\n format.json { head :no_content }\n end\n end"... | [
"0.72837067",
"0.6430173",
"0.6224451",
"0.5856895",
"0.5854505",
"0.57353157",
"0.5705546",
"0.5664163",
"0.5645673",
"0.56102765",
"0.5583955",
"0.55726916",
"0.555048",
"0.55318475",
"0.5484593",
"0.54332656",
"0.5332339",
"0.5318477",
"0.5315112",
"0.53141725",
"0.5307832... | 0.76857376 | 0 |
GET /dish_mixtures/1 GET /dish_mixtures/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dish_mixtures = DishMixture.all\n end",
"def index\n @mixtures = Mixture.all\n end",
"def set_dish_mixture\n @dish_mixture = DishMixture.find(params[:id])\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_ur... | [
"0.7533517",
"0.71456695",
"0.66037697",
"0.629032",
"0.60956323",
"0.6090569",
"0.5832628",
"0.56968695",
"0.56577456",
"0.55886334",
"0.55477846",
"0.5540687",
"0.5535894",
"0.5528366",
"0.5523885",
"0.5519036",
"0.549145",
"0.54621965",
"0.5458713",
"0.5431474",
"0.5391049... | 0.0 | -1 |
POST /dish_mixtures POST /dish_mixtures.json | def create
@dish_mixture = DishMixture.new(dish_mixture_params)
respond_to do |format|
if @dish_mixture.save
format.html { redirect_to @dish_mixture, notice: 'Dish mixture was successfully created.' }
format.json { render action: 'show', status: :created, location: @dish_mixture }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @dish_mixtures = DishMixture.all\n end",
"def index\n @mixtures = Mixture.all\n end",
"def set_dish_mixture\n @dish_mixture = DishMixture.find(params[:id])\n end",
"def destroy\n @dish_mixture.destroy\n respond_to do |format|\n format.html { redirect_to dish_mixtures_ur... | [
"0.6962468",
"0.6436742",
"0.64265823",
"0.61699736",
"0.6117526",
"0.60693306",
"0.58426374",
"0.57519156",
"0.56094515",
"0.5586664",
"0.557714",
"0.545863",
"0.5412241",
"0.5398092",
"0.53913754",
"0.5309089",
"0.52092105",
"0.51978946",
"0.5165789",
"0.51259035",
"0.50756... | 0.65185267 | 1 |
PATCH/PUT /dish_mixtures/1 PATCH/PUT /dish_mixtures/1.json | def update
respond_to do |format|
if @dish_mixture.update(dish_mixture_params)
format.html { redirect_to @dish_mixture, notice: 'Dish mixture was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_dish_mixture\n @dish_mixture = DishMixture.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @mixture.update(mixture_params)\n format.html { redirect_to @mixture, notice: \"Mixture was successfully updated.\" }\n format.json { render :show, status: :ok, loc... | [
"0.6346985",
"0.6129509",
"0.60746676",
"0.5797212",
"0.5735226",
"0.571295",
"0.5678358",
"0.56715894",
"0.551847",
"0.5493687",
"0.54003555",
"0.53798056",
"0.53274834",
"0.53250676",
"0.5320782",
"0.53124607",
"0.5307039",
"0.5291407",
"0.52889466",
"0.52799624",
"0.527477... | 0.64523095 | 0 |
DELETE /dish_mixtures/1 DELETE /dish_mixtures/1.json | def destroy
@dish_mixture.destroy
respond_to do |format|
format.html { redirect_to dish_mixtures_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mixture.destroy\n respond_to do |format|\n format.html { redirect_to mixtures_url, notice: \"Mixture was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to d... | [
"0.7185216",
"0.66411996",
"0.6577155",
"0.6577155",
"0.6404048",
"0.6393783",
"0.6393783",
"0.63919",
"0.6335199",
"0.63182914",
"0.6313997",
"0.62901795",
"0.62901795",
"0.6271102",
"0.6260767",
"0.6258933",
"0.62077874",
"0.62077874",
"0.61847544",
"0.61768013",
"0.6173458... | 0.78768927 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_dish_mixture
@dish_mixture = DishMixture.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def dish_mixture_params
params[:dish_mixture]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
lst list def series_up (n) list = [] i decicded to redo my code entirely list_saved = [] n.times do |i| list = [(list_saved), (list), i + 1] list_saved = list end return list end | def series_up (n)
length = n*(n + 1)/2 # this is the mathematical equation for the length of a series
time = 1 # this variable counts how many times the loop runs but it needs to be reset after it is run three times so that it starts over at 1 again
reset = 3 # this counts the number of resets
list = [1... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seriesup(n)\n list = [] \n (n+1).times do |b| # added the +1 because this code needs to run 1 more time than the input\n b.times do |a|\n list.push(a+1) #changed the variable from b to a because it doesn't need to use the first variable, you have to use the second one to make it repeat ... | [
"0.8306689",
"0.8267675",
"0.8226158",
"0.8213604",
"0.81461966",
"0.8144163",
"0.81210035",
"0.79850334",
"0.7974023",
"0.7719254",
"0.7206325",
"0.7095894",
"0.68543106",
"0.6706697",
"0.6706697",
"0.6706697",
"0.6619517",
"0.6533931",
"0.64433914",
"0.64424765",
"0.6434103... | 0.76287365 | 10 |
Gives Reference Dictionary instance object for word | def dictionary
@dictionary ||= Dictionary.new(@word)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_definitions\n Dictionary.find_by_word(word_id)\n end",
"def get_word\n dictionary.get_word\n end",
"def dictionary()\n return @data[:words]\n end",
"def dictionary\n\t#recieve word not sentence. already split\n\t#find word from dictionary\n dictionary = {\n \"hello\" => \"hi\",... | [
"0.7092189",
"0.6869961",
"0.67101365",
"0.65921545",
"0.6524754",
"0.6419747",
"0.6388327",
"0.62542355",
"0.6208831",
"0.6170489",
"0.6109227",
"0.60913104",
"0.6054656",
"0.6037365",
"0.5970412",
"0.59690684",
"0.59409404",
"0.59382963",
"0.5894906",
"0.58559245",
"0.58383... | 0.81234574 | 0 |
Gives Urban Dictionary instance object for word | def urban
@urban ||= Urban.new(@word)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dictionary\n @dictionary ||= Dictionary.new(@word)\n end",
"def get_word\n dictionary.get_word\n end",
"def look_up(term)\n # First, let's convert our user input to lowercase.\n term = term.downcase\n # If the word doesn't exist in my hash, let the user know.\n if !@words[term] ... | [
"0.75790805",
"0.6480464",
"0.6333029",
"0.63164145",
"0.62522304",
"0.6239094",
"0.61725235",
"0.6152252",
"0.61437476",
"0.6010124",
"0.6006034",
"0.5980302",
"0.5958679",
"0.5891113",
"0.5871645",
"0.5865578",
"0.58091086",
"0.5754052",
"0.5713041",
"0.5697771",
"0.5695551... | 0.66878206 | 1 |
This is similar to the process_stylesheet_assets utilized by bootstrapsass except it is specific to flatui | def process_flat_ui_stylesheet_assets!
log_status 'Processing stylesheets...'
files = read_files('less', flat_ui_less_files)
log_status ' Converting LESS files to Scss:'
files.each do |name, file|
log_processing name
# apply common conversions
# icon-font bombs on this... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stylesheets\n render_asset( \n asset_path_for(params[:asset], 'stylesheets', params[:theme]),\n defaulft_asset_path_for(params[:asset], 'stylesheets'),\n app_asset_path_for(params[:asset], 'stylesheets'), mime_type_from(params[:asset])\n )\n end",
"def assets\n ... | [
"0.66467947",
"0.661324",
"0.64724636",
"0.6387634",
"0.63686514",
"0.6348711",
"0.6322451",
"0.62332666",
"0.6204831",
"0.61778486",
"0.6169027",
"0.6166081",
"0.61538833",
"0.6153589",
"0.6131663",
"0.6131663",
"0.6131663",
"0.6116754",
"0.6116348",
"0.6077161",
"0.6075768"... | 0.7033716 | 0 |
Set load_shared to read from mixins.less again since bootstrap converted to modular mixins. | def load_shared
@shared_mixins ||= begin
log_status ' Reading shared mixins from mixins.less'
read_mixins read_files('less', ['mixins.less'])['mixins.less'], nested: NESTED_MIXINS
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_shared_mixins!(mixins_file)\n log_status \" Reading shared mixins from mixins.less\"\n @shared_mixins = get_mixin_names(mixins_file, silent: true)\n NESTED_MIXINS.each do |selector, prefix|\n # we use replace_rules without replacing anything just to use the parsing algorithm\n replace_... | [
"0.6994561",
"0.55280054",
"0.54981565",
"0.5474727",
"0.5402976",
"0.5376988",
"0.5372204",
"0.5273216",
"0.5270139",
"0.52457786",
"0.5177224",
"0.51655036",
"0.5150382",
"0.5056197",
"0.5042925",
"0.5037305",
"0.5026229",
"0.50073665",
"0.49950832",
"0.4984066",
"0.4977971... | 0.8572566 | 0 |
TODO this method is on the brittle side look into make it more robust | def fix_variable_declaration_order(file)
# Spinner needs to be moved after Buttons
# since it depends on $btn-default-bg
#
# also spinner-btn-hover-bg needs to be
# before spinner-up-btn-border
if file.include? 'Spinner'
lines = file.split "\n"
spinner_start = lines.i... | {
"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 identify; end",
"def formation; end",
"def anchored; end",
"def offences_by; end",
"def suivre; end",
"def refutal()\n end",
"def original_result... | [
"0.6652192",
"0.5707093",
"0.57009274",
"0.56277955",
"0.56277955",
"0.56277955",
"0.56277955",
"0.54490894",
"0.54439574",
"0.5324083",
"0.5306735",
"0.53064144",
"0.5162336",
"0.5097151",
"0.50406057",
"0.5032072",
"0.49907377",
"0.4979539",
"0.4970282",
"0.49584532",
"0.49... | 0.0 | -1 |
Based on the original convert_less_ampersand but modified for flat_ui_sass | def convert_arbitrary_less_ampersand(less, selector)
return less unless less.include?(selector)
styles = less.dup
tmp = "\n"
less.scan(/^(\s*&)(-[\w\[\]-]+\s*\{.+?})/m) do |ampersand, css|
tmp << "#{selector}#{unindent(css)}\n"
styles.gsub! "#{ampersand}#{css}", ""
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def replace_less_extend(less)\n less.gsub(/\\#(\\w+) \\> \\.([\\w-]*)(\\(.*\\));?/, '@include \\1-\\2\\3;')\n end",
"def style_conversion; end",
"def sassify(input); end",
"def ampersand!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 12 )\n\n type... | [
"0.5861481",
"0.5542298",
"0.5525046",
"0.5482577",
"0.54418254",
"0.5440812",
"0.5372767",
"0.52783686",
"0.52717274",
"0.52577204",
"0.51800114",
"0.51642466",
"0.50777876",
"0.5052749",
"0.5048206",
"0.5022634",
"0.49677786",
"0.4958399",
"0.4958399",
"0.49367374",
"0.4933... | 0.65885407 | 0 |
Methods overridden from the bootstrapsass converter | def replace_asset_url(rule, type)
replace_all rule, /url\((.*?)\)/, "url(if($flat-ui-sass-asset-helper, flat-ui-#{type}-path(\\1), \\1))"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def syntax\n\t\t\t\t:sass\n\t\t\tend",
"def sass_file?; end",
"def sass_file?; end",
"def syntax\n :sass\n end",
"def css_to_scss\n Proc.new {|task| task.sub(/^#{CSS_DIR}/, SASS_DIR).\n sub(/\\.css$/, '.scss')}\nend",
"def sass_page; end",
"def sass_file_url; end... | [
"0.6710136",
"0.6541474",
"0.6541474",
"0.65297127",
"0.63827235",
"0.6374881",
"0.6191772",
"0.61351323",
"0.60978615",
"0.6070675",
"0.6066943",
"0.6040328",
"0.60204697",
"0.60075283",
"0.59609187",
"0.59245527",
"0.5885613",
"0.5880164",
"0.5874737",
"0.5821297",
"0.58072... | 0.0 | -1 |
Regex will match things like spinnerinputwidth by default. Fix the first lookaround to be a positive lookaround and also check for word chars after the word 'spin' | def replace_spin(less)
less.gsub(/(?<![\-$@.])spin(?![\-\w])/, 'adjust-hue')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_scan(s, pattern); end",
"def check_scan(s, pattern); end",
"def starts_with_consonant?(s)\n return /(?=^[^aiueo_\\d])(?=\\w)/i.match(s) ? true : false \nend",
"def is_valid_start(word)\n is_alpha(word[0]) || is_digit(word[0])\n end",
"def start_word_pattern; end",
"def matching_exactly_one... | [
"0.58014524",
"0.58014524",
"0.52649206",
"0.5231382",
"0.52224404",
"0.5137723",
"0.5085595",
"0.5083112",
"0.50815094",
"0.5070342",
"0.50458926",
"0.50276196",
"0.50166094",
"0.50047684",
"0.49893123",
"0.49672437",
"0.49589118",
"0.49288365",
"0.49215764",
"0.49205288",
"... | 0.54496926 | 2 |
Checks whether the recipe has any photo | def has_any_photo
recipe_photos.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_image\n return self.food_images.size>0\n end",
"def has_photos?\n photos.length > 0\n end",
"def any_pix?\r\n pictures.detect { |x| x && !x.photo_file_name.nil? }\r\n end",
"def any_pix?\n pictures.detect { |x| x && !x.photo_file_name.nil? }\n end",
"def photo_exists?(event)\n... | [
"0.7664568",
"0.7361138",
"0.7308491",
"0.7273977",
"0.712975",
"0.71149445",
"0.71149445",
"0.71149445",
"0.7054949",
"0.69431597",
"0.6867639",
"0.68436134",
"0.6839189",
"0.66905135",
"0.66796213",
"0.66765326",
"0.6641269",
"0.66252583",
"0.66235214",
"0.65790576",
"0.655... | 0.85333794 | 0 |
Retrieves (if any) the main photo for the recipe. For now, the main photo comes from the first recipe with photo availiable. | def main_photo
recipe_photos.first.try(:photo)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_photo\n photos.main_photos.first\n end",
"def main_photo cut\n return self.photos.first.image.url(cut) unless self.photos.empty?\n \n ConfigValue.default_image_for_model(:room_types, cut)\n end",
"def main_picture\n @main_picture ||= object.pictures.first\n end",
"def main_imag... | [
"0.75606906",
"0.74213785",
"0.716972",
"0.71153057",
"0.7000716",
"0.68755966",
"0.6698074",
"0.6666924",
"0.66238695",
"0.657155",
"0.6551578",
"0.64213556",
"0.63795555",
"0.6356892",
"0.6347965",
"0.6338038",
"0.6335058",
"0.6313895",
"0.63079214",
"0.6299677",
"0.6269645... | 0.8350806 | 0 |
If the recipe hasn't got any photo, it is created. Otherwise it is updated. | def create_or_update_photo! file
if recipe_photos.any?
photo = recipe_photos.first
photo.update!(photo: file)
photo
else
recipe_photos.create(photo: file)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_recipe_photo\n @recipe_photo = RecipePhoto.find(params[:id])\n end",
"def process_recipe\n unless picture_remote_url.blank? || Rails.env.test?\n self.picture = OpenURI::open_uri(picture_remote_url) \n extname = File.extname(picture_remote_url)\n basename = File.basename(picture_... | [
"0.6768204",
"0.634433",
"0.61961013",
"0.6178399",
"0.61668515",
"0.6141285",
"0.60440755",
"0.6008064",
"0.59679127",
"0.5967333",
"0.5951116",
"0.5925499",
"0.5912971",
"0.5892131",
"0.5870449",
"0.5831525",
"0.5831055",
"0.5828586",
"0.5819839",
"0.58083326",
"0.579926",
... | 0.81973773 | 0 |
Gets the categories property value. The categories associated with the item | def categories
return @categories
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories_for(item)\n return [] unless @items[item]\n\n @items[item].categories\n end",
"def categories\n return @categories\n end",
"def categories\n return @categories\n end",
"def categories\n return @categories\n ... | [
"0.786721",
"0.73937243",
"0.73937243",
"0.73937243",
"0.72487605",
"0.7236941",
"0.6909218",
"0.6831548",
"0.6822044",
"0.6803445",
"0.6803445",
"0.6803445",
"0.6803445",
"0.6803445",
"0.6803445",
"0.680104",
"0.67781496",
"0.6749274",
"0.6698471",
"0.6686191",
"0.6671548",
... | 0.7292847 | 4 |
Gets the changeKey property value. Identifies the version of the item. Every time the item is changed, changeKey changes as well. This allows Exchange to apply changes to the correct version of the object. Readonly. | def change_key
return @change_key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_key\n return @change_key\n end",
"def change_key=(value)\n @change_key = value\n end",
"def change_key=(changeKey)\n @change_key = changeKey\n end",
"def key\n return @key\n end",
"def key\n ... | [
"0.7316222",
"0.62603045",
"0.61186516",
"0.5791899",
"0.5791899",
"0.56566966",
"0.56566966",
"0.5645244",
"0.5645244",
"0.5645244",
"0.5633277",
"0.5539644",
"0.5531858",
"0.5519481",
"0.5499832",
"0.54750264",
"0.54549044",
"0.54476476",
"0.5424881",
"0.5424881",
"0.540725... | 0.73530304 | 0 |
Gets the createdDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def created_date_time
return @created_date_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created_date_time\n end",
"def created_date_time\n return @created... | [
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957",
"0.76635957"... | 0.7629361 | 28 |
Gets the lastModifiedDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def last_modified_date_time
return @last_modified_date_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_modified\n @metadata[:last_modified] || Time.now.utc\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\n return @last_modified_date_time\n end",
"def last_modified_date_time\... | [
"0.71741456",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.713002",
"0.7012479",
"0.6853738",
"0.6843824",
"0.6838517",
"0.68383044",
"0.68383044",
"0.68383044"... | 0.7103082 | 15 |
The deserialization information for the current model | def get_field_deserializers()
return super.merge({
"categories" => lambda {|o, n| o.categories = n.get_collection_of_primitive_values(String) },
"changeKey" => lambda {|o, n| o.change_key = n.get_string_value() },
"createdDateTime" => lambda {|o, n| o.created... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def deserialized\n @deserialized ||= @serializer.deserialize @serialized_object\n end",
"def get_field_deserializers()\n return super.merge({\n \"detectionStatus\" => lambda {|n| @detection_status = n.get_enum_value(MicrosoftGraph::Models::SecurityDetectionStatus) },... | [
"0.6510734",
"0.63224316",
"0.6322254",
"0.63094735",
"0.62954384",
"0.6238735",
"0.6232461",
"0.62155676",
"0.6200175",
"0.6199403",
"0.6173917",
"0.61733985",
"0.61705345",
"0.61631054",
"0.61620396",
"0.6158031",
"0.6156071",
"0.6142402",
"0.613998",
"0.6138061",
"0.612005... | 0.0 | -1 |
Serializes information the current object | def serialize(writer)
super
writer.write_collection_of_primitive_values("categories", @categories)
writer.write_string_value("changeKey", @change_key)
writer.write_date_value("createdDateTime", @created_date_time)
writer.write_date_value("lastModifiedDateTime... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n end",
"def serialize(object) end",
"def serialize; end",
"def serialize; end",
"def serialize\n \n end",
"def serialize\n raise NotImplementedError\n end",
"def serialize\n raise NotImplementedError\n end",
"def dump\r\n super + to_s\r\n end",
... | [
"0.7951338",
"0.7646634",
"0.75803244",
"0.75803244",
"0.74409217",
"0.7208843",
"0.7208843",
"0.7206441",
"0.7016598",
"0.7001667",
"0.6992817",
"0.6982478",
"0.6971731",
"0.6967704",
"0.6967704",
"0.69423115",
"0.69419813",
"0.69351715",
"0.6914051",
"0.6890698",
"0.6879724... | 0.6413878 | 100 |
Sets the categories property value. The categories associated with the item | def categories=(categories)
@categories = categories
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories=(value)\n @categories = value\n end",
"def categories=(value)\n @categories = value\n end",
"def categories=(value)\n @categories = value\n end",
"def categories=(value)\n @categories = value\n end",
"def... | [
"0.7892739",
"0.7892739",
"0.7892739",
"0.7798968",
"0.76897913",
"0.76897913",
"0.76897913",
"0.7175595",
"0.6959415",
"0.6874069",
"0.6666304",
"0.6666304",
"0.6666304",
"0.6666304",
"0.6666304",
"0.6666304",
"0.6657643",
"0.659335",
"0.654791",
"0.6442666",
"0.64133394",
... | 0.72163063 | 7 |
Sets the changeKey property value. Identifies the version of the item. Every time the item is changed, changeKey changes as well. This allows Exchange to apply changes to the correct version of the object. Readonly. | def change_key=(changeKey)
@change_key = changeKey
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def change_key=(value)\n @change_key = value\n end",
"def change_key\n return @change_key\n end",
"def change_key\n return @change_key\n end",
"def key=(new_key)\n @key = new_key\n end",
"def updateKey; @key = getKey; self end",... | [
"0.7620834",
"0.65105504",
"0.6428745",
"0.62861794",
"0.5757471",
"0.57266986",
"0.57266986",
"0.55268615",
"0.54369843",
"0.54369843",
"0.54369843",
"0.54187524",
"0.53987056",
"0.5395416",
"0.5383996",
"0.5383996",
"0.53593034",
"0.5224157",
"0.51821375",
"0.5157318",
"0.5... | 0.7582322 | 1 |
Sets the createdDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def created_date_time=(createdDateTime)
@created_date_time = createdDateTime
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(value)\n @created_date_time = value\n end",
"def created_date_time=(valu... | [
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"0.7732742",
"... | 0.7829751 | 0 |
Sets the lastModifiedDateTime property value. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC time. For example, midnight UTC on Jan 1, 2014 is 20140101T00:00:00Z | def last_modified_date_time=(lastModifiedDateTime)
@last_modified_date_time = lastModifiedDateTime
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_LastModifiedTime(value)\n set_input(\"LastModifiedTime\", value)\n end",
"def set_LastModifiedTime(value)\n set_input(\"LastModifiedTime\", value)\n end",
"def last_modified_date_time=(value)\n @last_modified_date_time = value\n end",
"def las... | [
"0.7450692",
"0.7450692",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7309294",
"0.7061208",
"0.7061208",
"0.7061208",
"0.6762423",
"0.6695566",
"... | 0.7372892 | 2 |
Each staff has 4 rows Row0 staff_id 0 Row1, Row2, Row 3: working days day 1 from index 3 | def shift_tracking_file(standard_day_off)
path = File.join("public/system/dailyrosters/#{active_date.to_formatted_s(:number)}", self.dailyroster_file_name)
Spreadsheet.open(path, 'r') do |book|
sheet = book.worksheet "MonthReport"
(11..sheet.row_count).step(4) do |i|
rows = [sheet.row(i),sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def work_day_employees\n all_week_employees = self.current_columns.each_slice(2).to_a\n\n return all_week_employees[Date.today.wday]\n end",
"def get_work_days\n puts \"Getting work days...\"\n work_days = []\n biweek = get_biweek\n week_1 = @schedule[biweek[0]].compact.uniq\n week_2 = @schedule[biwe... | [
"0.624295",
"0.5665046",
"0.5600714",
"0.550461",
"0.54978406",
"0.54968464",
"0.5404188",
"0.53492844",
"0.5333107",
"0.53226644",
"0.5309851",
"0.5293877",
"0.52762383",
"0.5260942",
"0.52412754",
"0.5221223",
"0.5202832",
"0.5200548",
"0.5180852",
"0.5176126",
"0.51756775"... | 0.50476784 | 33 |
177 0 AT7231 1 K6809 2 SGNREP 3 Time STD 4 Time ATD 5 | def dailyroster_file
active_date = self.active_date.to_date
path = File.join("public/system/dailyrosters/#{active_date.to_formatted_s(:number)}", self.dailyroster_file_name)
flight_date = active_date
DataFile.load_codeshare_flights(flight_date)
Spreadsheet.open(path, 'r') do |book|
sheet = boo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def processing_times\n total = ab_output.match(/Total:\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)\\s+([0-9.]+)/)\n ninety = ab_output.match(/ 90%\\s+([0-9.]+)/)\n ninetyfive = ab_output.match(/ 95%\\s+([0-9.]+)/)\n [total[1], total[2], total[4], ninety[1], ninetyfive[1], total[5]]\n end",
... | [
"0.6269615",
"0.55136484",
"0.54357165",
"0.5400959",
"0.5366609",
"0.5365488",
"0.53598166",
"0.53479713",
"0.5285021",
"0.528325",
"0.52783155",
"0.5263518",
"0.52607775",
"0.5250276",
"0.5240502",
"0.5226168",
"0.5224115",
"0.5223668",
"0.5220509",
"0.52149075",
"0.5211505... | 0.0 | -1 |
Start from 1 because split creates empty string | def read_arrival(upload)
active_date = self.active_date.to_date
ArrivalFlight.arrival_codeshare(active_date)
ArrivalFlight.arrival_codeshare(active_date.tomorrow)
path = File.join("public/system/dailyrosters/#{active_date.to_formatted_s(:number)}", upload)
File.open(path, 'r') {|f|
lines = f.r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split; end",
"def split_at(idx)\n [self[0...idx] || \"\", self[idx..-1] || \"\"] \n end",
"def split(parts); end",
"def split\n p @rev_name\n @split_name = @rev_name.split('')\n p @split_name\nend",
"def split_input(input)\n array = input.split('')\n array << array[0]\nend",
"def split(posit... | [
"0.72109634",
"0.70385146",
"0.6967013",
"0.6933943",
"0.65868694",
"0.6467749",
"0.6467749",
"0.6462501",
"0.64619654",
"0.6274897",
"0.6228103",
"0.621817",
"0.62167394",
"0.62109613",
"0.61801296",
"0.61797225",
"0.6149847",
"0.6149847",
"0.61046624",
"0.60838354",
"0.6069... | 0.0 | -1 |
POST /people or /people.json if block will work csv file upload and else will work for creating person if there is any validation error in any record after uploading csv file. | def create
if params['csv_file'].present?
require 'csv'
params[:people] = []
csv_text = File.read(params['csv_file'].path)
csv = CSV.parse(csv_text, :headers => true)
csv.each do |row|
params[:people] << row.to_hash
end
people = Person.create(people_params[:peo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contacts_upload\n #checking for csv file or not\n if params[:file].content_type == \"text/csv\"\n\n #read contents from csv file\n contacts = []\n\n CSV.foreach(params[:file].tempfile) { |row|\n row = row.first.split(\",\") if row.count == 1\n \n contact_data = {... | [
"0.67073625",
"0.6581108",
"0.64280236",
"0.6315821",
"0.6315821",
"0.6252179",
"0.61847836",
"0.61512315",
"0.61144656",
"0.6112842",
"0.6061414",
"0.6041112",
"0.60390395",
"0.5995761",
"0.5934091",
"0.59152555",
"0.5895647",
"0.58915806",
"0.587948",
"0.5879323",
"0.581657... | 0.77377933 | 0 |
Only allow a list of trusted parameters through for person. | def person_params
params.require(:person).permit(:first_name, :last_name, :email, :phone)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def allowed_params\n ALLOWED_PARA... | [
"0.6965802",
"0.6644837",
"0.66403466",
"0.6544712",
"0.649948",
"0.6429454",
"0.63923913",
"0.6392344",
"0.6386443",
"0.6366374",
"0.63510215",
"0.634972",
"0.63493824",
"0.63377726",
"0.63116735",
"0.62982506",
"0.62931645",
"0.62467635",
"0.62108517",
"0.62096757",
"0.6197... | 0.0 | -1 |
Only allow a list of trusted parameters through for people. | def people_params
params.permit(people: [:first_name, :last_name, :email, :phone])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n ... | [
"0.6967615",
"0.68726987",
"0.68048334",
"0.677269",
"0.6687651",
"0.6674128",
"0.6616594",
"0.65989274",
"0.65398455",
"0.6515347",
"0.6492821",
"0.6483149",
"0.64639425",
"0.6458655",
"0.6380827",
"0.6377621",
"0.6349862",
"0.6341851",
"0.6329684",
"0.6319461",
"0.6317682",... | 0.0 | -1 |
number of companies that have a relationship answer for this answer | def company_count
return 0 unless answer_id
Relationship.where(answer_id: answer_id).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relationship_answer_count\n return 0 unless id #\n\n ::Relationship.where(metric_card.answer_lookup_field => id).count\nend",
"def relationship_answer_count\n return 0 unless id #\n\n ::Relationship.where(metric_card.answer_lookup_field => id).count\nend",
"def question_count \n @by_question.count... | [
"0.71698886",
"0.71698886",
"0.69746596",
"0.68428236",
"0.68236434",
"0.673104",
"0.6713086",
"0.6695539",
"0.6695226",
"0.6672857",
"0.6672825",
"0.66461253",
"0.6619837",
"0.65294397",
"0.6523692",
"0.6453235",
"0.6444234",
"0.64346415",
"0.64022124",
"0.6385306",
"0.63420... | 0.85871345 | 0 |
Part II Shuffle Your Playlist Implement a shuffle! method that randomizes the order of your playlist | def shuffle!
@playlist.shuffle!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random\n @playlist = @db.shuffle\n end",
"def music_shuffle(songs)\n # your code here\n songs = songs.sort\n len = songs.length\n\n 2.times do\n l_idx = 0 \n r_idx = len/2 \n shuf = []\n\n while shuf.length < len \n if shuf.length%2 == 0\n shuf.push(songs[r_idx])\n r_id... | [
"0.80022675",
"0.79676044",
"0.79421127",
"0.7718723",
"0.76551825",
"0.76140434",
"0.76113176",
"0.7547825",
"0.7513588",
"0.74732965",
"0.74732965",
"0.7469314",
"0.7459613",
"0.7451224",
"0.7425872",
"0.74182236",
"0.7408068",
"0.7404814",
"0.740069",
"0.7382343",
"0.73777... | 0.87252593 | 0 |
Part III Make Sweet Music Implement a play! instance method that takes the first song on the list and removes it from the playlist permanently. The playing song should be returned. | def play!
@playlist.shift
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def im_done(playlist)\n #Stop the playlist\n Process.kill @music_pid\n #Grab and play the next playist, if there is one\n @current_playlist = @queue.shift and play @current_playlist \n end",
"def deleteFirst\n @songs.shift\n self\n end",
"def play_song(sender)\n clicked_pos = self.songs_... | [
"0.6838219",
"0.6715548",
"0.66392344",
"0.6631612",
"0.65903205",
"0.6554661",
"0.64612985",
"0.6460824",
"0.63950264",
"0.63528913",
"0.63392466",
"0.63055766",
"0.6206642",
"0.61894846",
"0.6163649",
"0.6153004",
"0.6151847",
"0.6151847",
"0.6151847",
"0.6151847",
"0.61518... | 0.75519145 | 0 |
Part IV Add to Your Playlist Implement an add_track instance method that requires one argument, the name of the track. If the song is in list of available songs, your software should add the song the the end of the playlist and return true. If the song is not found on the list, it should just return false. | def add_track(new_song)
if AVAILABLE_SONGS.include?(new_song)
@playlist << new_song
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song_to_playlist(song)\n if @playlist.include? song\n return #exit out of function if already exits\n end\n @playlist << song #else add song to playlist array\n end",
"def addToPlaylist(playlist,tracks)\n method = 'addToPlaylist'\n type = true\n args = {:playlist=>playlist, ... | [
"0.7419295",
"0.7067671",
"0.70482373",
"0.7010193",
"0.69580656",
"0.685828",
"0.6844901",
"0.6844901",
"0.6834917",
"0.6804106",
"0.67742676",
"0.6754198",
"0.67509216",
"0.671005",
"0.6688806",
"0.66371787",
"0.66177446",
"0.6604252",
"0.6565049",
"0.6540791",
"0.654047",
... | 0.8451063 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_journey_booking
@journey_booking = JourneyBooking.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def journey_booking_params
params[:journey_booking].permit(:driver_journey_id, :passenger_journey_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981537",
"0.67835593",
"0.6748275",
"0.67436063",
"0.6736311",
"0.65937173",
"0.6503359",
"0.6498499",
"0.6482832",
"0.6478776",
"0.645703",
"0.6439998",
"0.63802195",
"0.6377008",
"0.6366287",
"0.632018",
"0.63016284",
"0.63011277",
"0.62932974",
"0.62919617",
"0.6290564... | 0.0 | -1 |
Write an HTML file to the output package and add its metadata to the contents | def write_html(html, section)
filename = "section-#{section.to_s.rjust(3, '0')}.html"
@contents_sections << %Q{<documentation relative-path="#{filename}"/>}
html = html[0, html.length - 2]
html = erb(@data_dir + '/section.html.erb', { title: filename, content: html })
File.write(@doc_dir ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_html_file(name, type, html)\n if ENV['WRITE_HTML_FILE'] != 'false'\n file_name = \"#{File.dirname(__FILE__)}/results/#{name.gsub('.xml', '')}-#{Time.now.strftime(\"%d%b\")}_#{type}.html\"\n file = File.open(file_name, 'w+')\n file.puts html\n file.close\n end\nend",
"def write_output... | [
"0.73139685",
"0.72499317",
"0.7118652",
"0.71020156",
"0.7090762",
"0.7063432",
"0.70149773",
"0.69408685",
"0.6807213",
"0.67385536",
"0.66423",
"0.65661377",
"0.6529183",
"0.65042377",
"0.6484643",
"0.64584893",
"0.63803095",
"0.6374228",
"0.6374228",
"0.6353675",
"0.63453... | 0.6246438 | 22 |
Write a Swift file to the output package and add its metadata to the contents | def write_swift(swift, section)
filename = "section-#{section.to_s.rjust(3, '0')}.swift"
@contents_sections << %Q{<code source-file-name="#{filename}"/>}
File.write(@output + "/#{filename}", swift)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_as_ruby(file)\n if File.exist?(file)\n text = File.read(file)\n save_as_ruby_sub!(text, :version, 'VERSION')\n save_as_ruby_sub!(text, :released, 'RELEASED', 'DATE')\n save_as_ruby_sub!(text, :codename, 'CODENAME')\n else\n t = []\n t << %[module #{coden... | [
"0.63352144",
"0.62867147",
"0.61982495",
"0.61561924",
"0.6063269",
"0.600934",
"0.60075945",
"0.60075945",
"0.5969163",
"0.5958941",
"0.59069765",
"0.5868933",
"0.583856",
"0.5835997",
"0.5823868",
"0.5793994",
"0.57107097",
"0.56565547",
"0.5655418",
"0.5654972",
"0.560869... | 0.68181956 | 0 |
Render an ERB template | def erb(template_path, vars)
template = File.read(template_path)
ERB.new(template).result(OpenStruct.new(vars).instance_eval { binding })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_erb\n require 'erb'\n\n renderer = ERB.new(template_content, trim_mode: '-')\n renderer.filename = @template_file\n renderer.result(binding)\n end",
"def erb(template) render template end",
"def render\n ERB.new(@template, nil, '-').result(bind... | [
"0.85360825",
"0.8418272",
"0.8256945",
"0.82213247",
"0.810612",
"0.8051365",
"0.79889786",
"0.77775884",
"0.76792675",
"0.76075673",
"0.7587626",
"0.7587626",
"0.754935",
"0.751517",
"0.7503942",
"0.7487318",
"0.74470514",
"0.7430214",
"0.7424185",
"0.7354805",
"0.7339451",... | 0.7061747 | 37 |
Creates a new comment for an issue | def create
load_issue
@comment = @issue.comments.build(params[:comment]) do |c|
c.user = current_user
end
@comment.save
respond_with(@comment) do |format|
format.pjax { render @comment }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_issue_comment(repo, issue_number, body, options = {})\n opts = options.dup\n opts[:body] = body\n post \"#{Repository.path repo}/issues/#{issue_number}/comments\", opts\n end",
"def create_issue_comment(user_name, repo_name, issue_id, params={})\n _update_user_repo_par... | [
"0.8156158",
"0.80330545",
"0.78411627",
"0.75678504",
"0.74512327",
"0.72139704",
"0.7146036",
"0.71401805",
"0.71085566",
"0.70786136",
"0.7068999",
"0.70265114",
"0.702381",
"0.70197195",
"0.6995761",
"0.69370955",
"0.6902137",
"0.6837904",
"0.6739408",
"0.67159486",
"0.67... | 0.7235431 | 5 |
Note: .split is the same as .split(' ') Problem 6 | def reverse_words(string)
string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def split_into_array(word)\n word.split(\"\")\nend",
"def split; end",
"def break_words(stuff)\r\n words = stuff.split(' ')\r\n return words\r\nend",
"def break_words(stuff)\n words = stuff.split(' ')\nend",
"def words(s)\n s.split\nend",
"def splitter(input)\n array = input.downcase.split('... | [
"0.74892443",
"0.7404338",
"0.7396091",
"0.7300469",
"0.72810453",
"0.7179825",
"0.7125063",
"0.7073113",
"0.7017563",
"0.69842005",
"0.6943874",
"0.692245",
"0.68192536",
"0.6803561",
"0.6796383",
"0.67768794",
"0.6770575",
"0.6755603",
"0.6749658",
"0.67219865",
"0.67095083... | 0.0 | -1 |
== 40 Problem 9 | def sum(int)
int.digits.sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution\n (1..40).inject(:*) / (1..20).inject(:*)**2\nend",
"def solve\n return ((1..40).inject(:*) / ((1..20).inject(:*) ** 2))\nend",
"def pe50v2()\n\ta = sieveOfErathosthenes(3990)\n\tprim,total,count = [], 0, 0\n\ta.each_with_index do |x, index|\n\t\tif x \n\t\t\ttotal += index\n\t\t\tcount += 1... | [
"0.6549701",
"0.6440336",
"0.634713",
"0.6340776",
"0.6322283",
"0.6320735",
"0.6282941",
"0.6241419",
"0.62057775",
"0.62029666",
"0.61903924",
"0.61857796",
"0.6185011",
"0.61513007",
"0.60889304",
"0.6083457",
"0.6072062",
"0.60638946",
"0.60557383",
"0.6051237",
"0.603742... | 0.0 | -1 |
Instead of writing that piece of code over and over, there's a feature in most programming languages called a procedure, which allows you to extract the common code to one place. syntax: | def name_of_method
# method body goes here
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def procasaurus( p1, p2, p3 )\n\tputs p1.call\n\tputs p2.call\n\tputs p3.call\nend",
"def do_something(par1, par2, par3)\nend",
"def do_something(par1, par2, par3)\nend",
"def greeting(proc_1, proc_2, proc_3)\n puts proc_1.call('good morning')\n puts proc_2.call('hello')\n puts proc_3.call('good eve... | [
"0.6607109",
"0.6542159",
"0.6542159",
"0.6483909",
"0.64818907",
"0.6463967",
"0.63821906",
"0.63753265",
"0.6338786",
"0.633637",
"0.63032424",
"0.6299405",
"0.62530994",
"0.62486506",
"0.6234688",
"0.62162894",
"0.62056065",
"0.61752224",
"0.6127449",
"0.61046183",
"0.6102... | 0.0 | -1 |
Method to the rescue! | def say(words) # (words) is the parameter
puts words
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def continued_exception; end",
"def catch_exceptions; end",
"def fail\n\t\t# throw up this code and feed plezi your own lines :)\n\t\traise \"Plezi raising hell!\"\n\tend",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exception; end",
"def exceptions;... | [
"0.7325544",
"0.729802",
"0.7289462",
"0.72469294",
"0.72469294",
"0.72469294",
"0.72469294",
"0.72469294",
"0.72059214",
"0.6942677",
"0.6873092",
"0.6827",
"0.6827",
"0.6713608",
"0.6664264",
"0.66004276",
"0.65802145",
"0.64602435",
"0.64602435",
"0.6432452",
"0.6431941",
... | 0.0 | -1 |
the logic is extracted to the method, so our code can be flexible Parameter are used when you have data outside of a method's scope, but you need access to it within the method's scope. Arguments are pieces of information that are sent to a method to be modified or used to return a specific result.We "pass" arguments t... | def method_name(parameter_name)
# do something
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say(words)\n # question: why do I need the (words) part here?\n # Oh! That's a parameter. These are used when you have data outside of a method's scope, but need access to it within the method's scope. Huh?\n # Arguments are pieces of info passed to the method to be modified or to return a specific result (... | [
"0.8351564",
"0.77608365",
"0.7462716",
"0.7429138",
"0.7332417",
"0.7235347",
"0.72076327",
"0.7205795",
"0.7192787",
"0.7183056",
"0.71722823",
"0.71431184",
"0.7137722",
"0.7129372",
"0.7129372",
"0.7012893",
"0.6962062",
"0.69546634",
"0.6949776",
"0.6949583",
"0.6925476"... | 0.0 | -1 |
Default Parameters When you're defining methods you may want to structure your method so that it always works, whether given parameters or not. | def say(words = "hello") # "hello" is the default parameter unless changed when called
put words + "."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def foo(param = \"no\") #this is default param\n \"yes\"\nend",
"def a_method(arg1, arg2='default value')\n do_stuff\n end",
"def method (number, default1 = 1, default2 = 2)\nend",
"def foo(param = \"no\")\r\n \"yes\"\r\nend",
"def hello(name=\"World\") # Default parameter\n puts \"Hello #{ name }\"... | [
"0.78715605",
"0.76616585",
"0.76074445",
"0.7509881",
"0.74736726",
"0.74665856",
"0.74665856",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.744718",
"0.7288891",
"0.7225841",
"0.7221236",
"0.720... | 0.0 | -1 |
Optional Parentheses Many Rubyists will leave off parentheses when using methods as a style choice. For example, say() could be rewritten as just say. With arguments, instead of say("hi"), it could just be say "hi". This leads to more fluid reading of code, but sometimes it can be confusing. Keep that in mind when you'... | def some_method(number)
number = 7 # this is implicitly returned by the method
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_call(method_name, args, parens = false)\n code = if parens\n method_name.dup.tap do |ruby|\n ruby << \"(#{args})\" if args.present?\n end\n else\n [method_name, args].map(&:presence).compact.join(\" \")\n end\n\n strip_trailing_whitespace(code)\n end",
"def method_wi... | [
"0.62990284",
"0.5999584",
"0.59302396",
"0.59007174",
"0.58672893",
"0.58672893",
"0.55828404",
"0.5536416",
"0.55162466",
"0.5391022",
"0.5320094",
"0.5302694",
"0.525047",
"0.52501273",
"0.52426594",
"0.5240516",
"0.5193179",
"0.5191983",
"0.5139082",
"0.51008093",
"0.5097... | 0.0 | -1 |
outputs 5 Exception: The exception is when we perform some action on the argument that mutates the caller, we can in fact permanently alter variables outside the method's scope. puts vs return: The Sequel return.rb | def add_three(number)
number + 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def error!\n throw :return, -1\n end",
"def exMethod\r\n # explicitly the last line will be the return\r\n\t# return var is also allowed but this also works\r\n $var\r\nend",
"def returns; end",
"def a_method_interrupted(a,b)\n puts \"I got #{a}\"\n puts \"I got #{b}\"\n return a+b... | [
"0.6099546",
"0.60146075",
"0.59682435",
"0.57293487",
"0.567074",
"0.5657307",
"0.56501365",
"0.5629284",
"0.5612285",
"0.55441797",
"0.5497562",
"0.5497562",
"0.5497562",
"0.5497562",
"0.5497562",
"0.5474763",
"0.54670686",
"0.5461483",
"0.54430115",
"0.543479",
"0.543232",... | 0.0 | -1 |
Ruby methods ALWAYS return the evaluated result of the last line of the expression unless an explicit return comes before it. What happens when this code is ran? | def add_three(number)
return number + 3
number + 4
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def be_truthful\n 42\n true # The last expression is always the one that gets returned\nend",
"def a\n puts \"a was evaluated!\"\n return false\nend",
"def method_with_explicit_return\n :a_non_return_value\n return :return_value\n :another_non_return_value\n end",
"def demonstrate_early_retu... | [
"0.6847594",
"0.65675306",
"0.65622467",
"0.6542172",
"0.6539918",
"0.6539918",
"0.6539918",
"0.6467478",
"0.6437559",
"0.64330995",
"0.64140713",
"0.6392938",
"0.6309738",
"0.630253",
"0.62708",
"0.6263496",
"0.6261706",
"0.6242692",
"0.6232028",
"0.61834764",
"0.6161477",
... | 0.553504 | 95 |
The return value is still 7, because we explicitly that we should return "number + 3" Chaining Methods Because we know for certain that every method returns something, we can chain methods together, which gives us the ability to write extremely expressive and succinct code. | def add_three(n)
n + 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_three(number)\n number + 3\n return number + 4\nend",
"def add_three(number)\n return number + 7\n number + 12\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n number + 4\nend",
"def add_three(number)\n return number + 3\n... | [
"0.7223921",
"0.721539",
"0.72009003",
"0.72009003",
"0.72009003",
"0.72009003",
"0.7120962",
"0.7120962",
"0.7120962",
"0.7120962",
"0.6844006",
"0.6790547",
"0.67867255",
"0.67867255",
"0.67867255",
"0.64572394",
"0.6432346",
"0.639524",
"0.6304119",
"0.62996286",
"0.629534... | 0.6526809 | 15 |
puts out 8 statements and returns an 8, thus we could chain more using puts now instead of nothing | def add_three(n)
puts n + 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll_six\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def pTimes2(statement,num)\n num.times do\n puts statement\n end\nend",
"def say_hello_world_five_times\n puts \"Hello World!\"\n puts \"Hello World!\"\n puts \"H... | [
"0.6110433",
"0.60961",
"0.6010135",
"0.59393007",
"0.59343356",
"0.5934166",
"0.593295",
"0.59293413",
"0.5919645",
"0.5897645",
"0.5892002",
"0.5890902",
"0.5876756",
"0.58721",
"0.58516157",
"0.58288896",
"0.57974815",
"0.5771076",
"0.574602",
"0.573181",
"0.57242227",
"... | 0.0 | -1 |
We've defined two methods add and subtract that take parameters a and b. We assume both are integer values. Recall that Ruby implicitly returns the last line of a method, however since both methods contain just one line each we're letting Ruby do its magic by using implicit return. Note that we could have also used exp... | def multiply(num1, num2)
num1 * num2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtract (a,b)\n return a-b\nend",
"def subtract(a, b)\n\treturn a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract(a, b)\n a - b\nend",
"def subtract a, b\n\ta - b\nend",
"def subtract(a, b)\n difference = a -... | [
"0.8249243",
"0.8145673",
"0.81046486",
"0.81046486",
"0.81046486",
"0.81046486",
"0.79783636",
"0.7917243",
"0.7774731",
"0.7759868",
"0.7749282",
"0.7688113",
"0.76785916",
"0.76388437",
"0.7612394",
"0.760785",
"0.7606993",
"0.7606993",
"0.76062804",
"0.7554201",
"0.746426... | 0.0 | -1 |
methods to compute progress on learning paths | def completed_path_sources(lp)
# lp == learning_path
sources = lp.sources
complete = self.sources
# return the intersection
complete & sources
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def progress; end",
"def progress; end",
"def progress; end",
"def progress; end",
"def progress; end",
"def progress\n total_steps_count = self.steps.count\n\n if total_steps_count.zero?\n 0.0\n else\n approved_steps_count = self.steps.where(state: 'approved').count\n (approved_s... | [
"0.63177085",
"0.63177085",
"0.63177085",
"0.63177085",
"0.63177085",
"0.62375915",
"0.6006567",
"0.59596944",
"0.58523506",
"0.5823499",
"0.5730934",
"0.57219267",
"0.5697957",
"0.5691287",
"0.56904936",
"0.5642415",
"0.5629964",
"0.5604164",
"0.55942035",
"0.55942035",
"0.5... | 0.0 | -1 |
AWT Draw a rectangle | def rect(x, y, width, height, rgb, fill=true)
rect_rounded(x, y, width, height, rgb, 0, 0, fill)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drawRectangle(x,y,w,h,fillp=false,color=\"black\")\n @device.drawRectangle(x,y,w,h,fillp,color) ;\n end",
"def draw_rect(x,y,w,h,c)\n self.draw_quad(x,y,c,x+w,y,c,x,y+h,c,x+w,y+h,c)\n end",
"def draw_rect x, y, w, h, c\n @screen.fill_rect x, y, w, h, c\n @screen.fill_rect x + 1, y + 1, w ... | [
"0.8198042",
"0.79971606",
"0.7984452",
"0.78207254",
"0.7783088",
"0.775792",
"0.7615558",
"0.75595695",
"0.75434804",
"0.74316776",
"0.7402496",
"0.73999393",
"0.72206837",
"0.7176627",
"0.7167617",
"0.71274644",
"0.7085991",
"0.6994094",
"0.6875292",
"0.6850384",
"0.676341... | 0.69584966 | 18 |
AWT Draw a rounded square | def square_rounded(x, y, dim, rgb, arc_width=0, fill=true)
rect_rounded(x,y, dim, dim, rgb, arc_width, arc_width, fill)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)\n primitive 'roundrectangle ' + sprintf(\n '%g,%g,%g,%g,%g,%g',\n center_x, center_y, width, height, corner_width, corner_height\n )\n end",
"def rect_rounded(x, y, width, height, rgb, arc_width=0, arc_h... | [
"0.6665473",
"0.6616507",
"0.6405787",
"0.63525707",
"0.6337028",
"0.63321733",
"0.63105565",
"0.6271938",
"0.6271938",
"0.6268595",
"0.62246615",
"0.62109077",
"0.6207705",
"0.6188381",
"0.6178455",
"0.615014",
"0.6112998",
"0.61084247",
"0.60765016",
"0.6069287",
"0.6066843... | 0.7236349 | 0 |
AWT Draw a rounded rectangle | def rect_rounded(x, y, width, height, rgb, arc_width=0, arc_height=0, fill=true)
as_color(ImageVoodoo.hex_to_color(rgb)) do |g|
if fill
g.fill_round_rect x, y, width, height, arc_width, arc_height
else
g.draw_round_rect x, y, width, height, arc_width, arc_height
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roundrectangle(center_x, center_y, width, height, corner_width, corner_height)\n primitive 'roundrectangle ' + sprintf(\n '%g,%g,%g,%g,%g,%g',\n center_x, center_y, width, height, corner_width, corner_height\n )\n end",
"def square_rounded(x, y, dim, rgb, arc_width=0, fill=true)\n ... | [
"0.7202321",
"0.6961413",
"0.6756104",
"0.6677828",
"0.6649799",
"0.66390795",
"0.6631956",
"0.6615545",
"0.6606357",
"0.66033554",
"0.6597614",
"0.65290606",
"0.6476841",
"0.6453944",
"0.6445827",
"0.6353001",
"0.63523257",
"0.6340647",
"0.62940025",
"0.61992514",
"0.6149961... | 0.72461367 | 0 |
input is first and last name separated by space in a string output is a string with last name comma first name algo is to split the initial string, then return a new string with the proper formatting | def swap_name(string)
"#{string.split[1]}, #{string.split[0]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rearrange(string)\n match = /(\\w+), (\\w+) (\\w+)/.match(string) #(1)\n last_name = match[1]\n first_name = match[2]\n middle_name = match[3]\n \"#{first_name} #{middle_name[0,1]}. #{last_name}\" #(2)\nend",
"def format_name(first, last)\nif first.length<1 || last.length<1\n\tnil\nelse\n first = firs... | [
"0.7694486",
"0.76373434",
"0.7599175",
"0.75780725",
"0.75705606",
"0.7562204",
"0.7557898",
"0.75371236",
"0.75318927",
"0.7355767",
"0.7350946",
"0.7330345",
"0.7330345",
"0.72972786",
"0.72967136",
"0.7265463",
"0.72306716",
"0.7206042",
"0.71960205",
"0.7153759",
"0.7148... | 0.69893306 | 34 |
fixity_mode can be :fedora, :ingestion or an array containing both | def initialize(params={})
self.fixity_mode = Array.wrap(params.fetch(:fixity_mode, [:fedora, :ingestion]))
self.max_fail_count = params.fetch(:max_fail_count, 10)
self.file_limit = params.fetch(:file_limit, 50)
self.time_limit = params.fetch(:time_limit, 30)
super(params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve_fixity\n alg = replication.fixity_algorithm.to_sym\n replication.fixity_value = bagit.fixity(alg)\n end",
"def allow_fixation? \n @fixation\n end",
"def fixity_check?\n event_type == FIXITY_CHECK\n end",
"def equip_type_fixed?(etype_id)\r\n features_se... | [
"0.6575261",
"0.553033",
"0.52385074",
"0.5193241",
"0.5018133",
"0.49311292",
"0.49075985",
"0.48683798",
"0.4739647",
"0.4732334",
"0.47044566",
"0.4686049",
"0.467212",
"0.4590655",
"0.4584555",
"0.45740646",
"0.4562779",
"0.4541359",
"0.45006484",
"0.44544467",
"0.4444160... | 0.45842844 | 15 |
check if there is an existing tomcat instance running return pid if there is. false if not | def tomcat?
system "ps aux| grep tomcat | grep catalina"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running?\n pid = `ps x -o pid,command|grep [K]EWatcher|awk '{print $1}'`.to_i\n pid == 0 ? false : pid\n end",
"def server_running?\n if File.exist? pid_path\n pid = read_pid\n begin\n Process.kill(0, pid)\n rescue Errno::ESRCH\n return false\n en... | [
"0.7319313",
"0.7214389",
"0.7214389",
"0.7099641",
"0.70605993",
"0.7039717",
"0.7029058",
"0.6996198",
"0.69549227",
"0.6943214",
"0.6918064",
"0.6889554",
"0.687245",
"0.6864184",
"0.6858164",
"0.6857586",
"0.6832552",
"0.6832552",
"0.6820366",
"0.68189514",
"0.6806947",
... | 0.77898264 | 0 |
Method should only be called on unformatted numbers during Lead creation | def format_phone_number
area_code = self.phone_number.slice!(0,3)
area_code = '(' + area_code + ') '
return area_code + self.phone_number.insert(3, '-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_number_strings(cleaned_multiline_digits)\n cleaned_multiline_digits.map do |multiline_digit|\n convert_to_numbers(multiline_digit)\n end\nend",
"def prepare_numbers(number_list)\n number_list.normalized_numbers.map { |n| Phony.formatted(n, format: :international_relative, spaces: '') }.joi... | [
"0.6079497",
"0.60309094",
"0.5849994",
"0.5832191",
"0.58320534",
"0.58188224",
"0.57720053",
"0.5754598",
"0.5745359",
"0.5733308",
"0.5717121",
"0.57170653",
"0.566951",
"0.5643133",
"0.5625395",
"0.55643487",
"0.55631185",
"0.556257",
"0.5549839",
"0.55251396",
"0.5518452... | 0.0 | -1 |
search words in the clock: search beginning by replace to find Cinq berfore Cinquante and cheat for ET | def Text2Words(txt, len, where, offset)
txt.each do |words|
print " { { "
words.each do |word|
if word=="ET" then
pos = where.index("TERTAUQ")
else
pos = where.index(word.reverse) || where.index(word)
end
print " { %3d, %2d ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_replacement_translations(locale, variant_words, translations)\n pp \"Processing #{locale} strings\"\n unchanged = []\n to_be_replaced = []\n variant_words.each do |dict|\n current = dict[:source]\n origin = dict[:origin]\n replacement = dict[:target]\n # keeping a t... | [
"0.6453134",
"0.6093321",
"0.6003707",
"0.59678924",
"0.5925737",
"0.58965266",
"0.5836072",
"0.5822642",
"0.5781072",
"0.5769109",
"0.57342947",
"0.57183015",
"0.56098545",
"0.55919594",
"0.55853105",
"0.55842656",
"0.5579311",
"0.5559982",
"0.5536407",
"0.5527537",
"0.55203... | 0.6026405 | 2 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
return invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833",
"0.717024... | 0.0 | -1 |
Check to see if the all the properties in the model are valid | def valid?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.78992486",
"0.78992486",
"0.70971805",
"0.70782334",
"0.7032205",
"0.7031276",
"0.69510347",
"0.6869891",
"0.6858077",
"0.6858077",
"0.68287027",
"0.6823878",
"0.6820306",
"0.68144894",
"0.6794656",
"0.6752167",
"0.66843414",
"0.6676546",
"0.6667755",
"0.66296124",
"0.6618... | 0.0 | -1 |
Custom attribute writer method checking allowed values (enum). | def tipo_pagamento=(tipo_pagamento)
allowed_values = ["CENTRALIZADO", "PV"]
if tipo_pagamento && !allowed_values.include?(tipo_pagamento)
fail ArgumentError, "invalid value for 'tipo_pagamento', must be one of #{allowed_values}."
end
@tipo_pagamento = tipo_pagamento
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end",
"def attr_enum(name, enum, options={}, &block)\n raise ArgumentError, 'enum' unless enum && enum.respond_to?(:values)\n\n options = {\n :enum => enum,\n ... | [
"0.70886594",
"0.648213",
"0.6430716",
"0.6227263",
"0.6143604",
"0.5810928",
"0.5750707",
"0.5744161",
"0.5737486",
"0.5709104",
"0.57005036",
"0.567771",
"0.56021994",
"0.5595522",
"0.55476993",
"0.553686",
"0.5533662",
"0.5527995",
"0.54355603",
"0.54287076",
"0.5419429",
... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
id == o.id &&
numero_estabelecimento == o.numero_estabelecimento &&
flag_matriz == o.flag_matriz &&
id_grupo_economico == o.id_grupo_economico &&
numero_receita_federal == o.numero_receita_fede... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.72932124",
"0.7189842",
"0.70406866",
"0.7007727",
"0.68881786",
"0.68621296",
"0.67085785",
"0.66622394",
"0.661674",
"0.6586541",
"0.65844727",
"0.65818226",
"0.65561724",
"0.6545535",
"0.6508076",
"0.64813215",
"0.64577025",
"0.64179385",
"0.6414028",
"0.6414028",
"0.64... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[id, numero_estabelecimento, flag_matriz, id_grupo_economico, numero_receita_federal, nome, descricao, nome_fantasia, cep, nome_logradouro, numero_endereco, bairro, cidade, complemento, uf, cep2, nome_logradouro2, numero_endereco2, bairro2, cidade2, complemento2, uf2, obs, contato, email, flag_arquivo_se... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /^Array<(.*)>/i
# check to ensure the input is an array given that the the attribute
# is documented as an array but the input is not
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /^(true|t|yes|... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7331687",
"0.727466",
"0.72510564",
"0.7246295",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
"0.72299516",
... | 0.7179591 | 40 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.9010481",
"0.8950689",
"0.84703803",
"0.8340893",
"0.83363867",
"0.83363867",
"0.8331558",
"0.82545733",
"0.81452745",
"0.814375",
"0.8135387",
"0.8126432",
"0.80925727",
"0.8086306",
"0.80725205",
"0.803857",
"0.8030969",
"0.80052185",
"0.80052185",
"0.80052185",
"0.80052... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map{ |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6721729",
"0.6721729",
"0.6670509",
"0.66586363",
"0.65893847",
"0.64539677",
"0.641838",
"0.641838",
"0.6383302",
"0.63453764",
"0.63036317",
"0.6224793",
"0.6154382",
"0.6103922",
"0.60805297",
"0.60805297",
"0.60734206",
"0.60371464",
"0.6021932",
"0.59395087",
"0.59055... | 0.0 | -1 |
No need to rewind, as parsing is done in initialize | def rewind; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rewind\n create_parser\n end",
"def rewind() end",
"def rewind() end",
"def rewind() end",
"def rewind() end",
"def rewind\n @pos = @startpos\n @eof = false\n end",
"def rewind()\n #This is a stub, used for indexing\n end",
"def rewind()\n #This is a ... | [
"0.77912194",
"0.7388732",
"0.7388732",
"0.7388732",
"0.7388732",
"0.7274008",
"0.7196735",
"0.7178767",
"0.7140442",
"0.6997965",
"0.6997965",
"0.6997965",
"0.6997965",
"0.69952786",
"0.69858336",
"0.69310695",
"0.6882209",
"0.6882209",
"0.6855647",
"0.6813648",
"0.6742348",... | 0.7252986 | 8 |
Document closed when read in initialize | def close; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_document; end",
"def end_document; end",
"def start_document\n @doc = Nokogiri::XML::Document.new\n end",
"def on_end_document\n end",
"def Open()\n\t\t#Begin document\n\t\t@state = 1\n\tend",
"def initialize(document)\n @document = document\n end",
"def new_doc\n @doc_con... | [
"0.6766474",
"0.6766474",
"0.6617623",
"0.65621924",
"0.6517651",
"0.6395478",
"0.63936454",
"0.6365975",
"0.6347936",
"0.6310702",
"0.6309872",
"0.62245375",
"0.61854845",
"0.6151777",
"0.61390436",
"0.61390436",
"0.6133861",
"0.61261755",
"0.6116323",
"0.60957974",
"0.60835... | 0.0 | -1 |
Iterates the given block for each RDF statement in the input. | def each_statement(&block)
@callback = block
parser = N3GrammerParser.new
document = parser.parse(@doc)
unless document
puts parser.inspect if $DEBUG
reason = parser.failure_reason
raise RDF::ReaderError, reason
end
process_statements(document)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_statement(&block)\n if block_given?\n @input.rewind\n sample = @input.read(1000)\n if sample.match(%r(<html)i)\n # If it's HTML, parse it to improve detection\n @input.rewind\n sample = @input = ::Nokogiri::HTML.parse(@input)\n ... | [
"0.7874337",
"0.7745248",
"0.7401649",
"0.70043796",
"0.6744585",
"0.6723237",
"0.6597529",
"0.6595113",
"0.65183496",
"0.6395486",
"0.6313664",
"0.63120097",
"0.63120097",
"0.6246836",
"0.6219058",
"0.6177154",
"0.6173131",
"0.61606044",
"0.6157566",
"0.60891443",
"0.6083982... | 0.75432074 | 2 |
Iterates the given block for each RDF triple in the input. | def each_triple(&block)
each_statement do |statement|
block.call(*statement.to_triple)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n block.call(statement.to_triple)\n end\n end\n enum_for(:each_triple)\n end",
"def each_triple(&block)\n if block_given?\n each_statement do |statement|\n b... | [
"0.6841667",
"0.6786044",
"0.67672765",
"0.6618114",
"0.66071594",
"0.64427656",
"0.6345166",
"0.6289564",
"0.62719536",
"0.61632097",
"0.6153937",
"0.6140776",
"0.60441107",
"0.6029061",
"0.6019323",
"0.5979971",
"0.5979971",
"0.59671867",
"0.59670955",
"0.5950652",
"0.59312... | 0.68209296 | 2 |
Keep track of allocated BNodes | def bnode(value = nil)
@bnode_cache ||= {}
@bnode_cache[value.to_s] ||= RDF::Node.new(value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bnodes\n @graphs.inject([]) {|memo, g| memo += g.bnodes}\n end",
"def bnodes(context = nil)\n bn = {}\n triples(Triple.new(nil, nil, nil), context) do |t, ctx|\n if t.subject.is_a?(BNode)\n bn[t.subject] ||= 0\n bn[t.subject] += 1\n end\n if t.predicat... | [
"0.6731117",
"0.60472554",
"0.5972121",
"0.59240466",
"0.5905887",
"0.58678365",
"0.58619314",
"0.586118",
"0.586118",
"0.5818881",
"0.5811363",
"0.5811363",
"0.580633",
"0.5794787",
"0.5780229",
"0.5776284",
"0.57187665",
"0.57112134",
"0.5708695",
"0.57028484",
"0.5688235",... | 0.0 | -1 |
Add debug event to debug array, if specified | def add_debug(node, message)
puts "#{node}: #{message}" if $DEBUG
@debug << "#{node}: #{message}" if @debug.is_a?(Array)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_debug(node, message)\n puts \"[#{@lineno},#{@pos}]#{' ' * @productions.length}#{node}: #{message}\" if ::RDF::N3::debug?\n @options[:debug] << \"[#{@lineno},#{@pos}]#{' ' * @productions.length}#{node}: #{message}\" if @options[:debug].is_a?(Array)\n end",
"def debug(*args, &block)\n add_w... | [
"0.65822303",
"0.645552",
"0.6411019",
"0.6411019",
"0.62128204",
"0.618385",
"0.61739963",
"0.6074417",
"0.60701877",
"0.6011214",
"0.60037583",
"0.59449667",
"0.5931995",
"0.5906532",
"0.59034663",
"0.5901879",
"0.5892876",
"0.5889195",
"0.5889195",
"0.5889195",
"0.5885619"... | 0.71468365 | 0 |
Process a path, such as: :a.:b means [is :b of :a] :a!:b means [is :b of :a] :a^:b means [:b :a] Elements may be strug together, with the last element the verb applied to the previous expression: :a.:b.:c means [is :c of [ is :b of :a]] :a!:b^:c meands [:c [ is :b of :a]] | def process_path(path)
add_debug(*path.info("process_path"))
object = process_expression(path.pathitem)
# Create a list of direction/predicate pairs
path_list = process_path_list(path.expression, path.respond_to?(:reverse))
#puts path_list.inspect
# Now we should have the fol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_path(expression)\n add_debug(\"process_path\", expression.inspect)\n\n pathitem = expression[:pathitem]\n pathtail = expression[:pathtail]\n \n direction_list = [expression[:direction], expression[:directiontail]].flatten.compact\n\n pathtail.each do |pred|\n direct... | [
"0.6332462",
"0.6038956",
"0.58878756",
"0.58628047",
"0.58496106",
"0.5833417",
"0.5719658",
"0.56806284",
"0.56759113",
"0.56759113",
"0.56662285",
"0.56201947",
"0.55800235",
"0.5556582",
"0.55303013",
"0.5480789",
"0.5401462",
"0.54000854",
"0.54000854",
"0.5397171",
"0.5... | 0.6701448 | 0 |
Returns array of [:forward/:reverse, element] pairs | def process_path_list(path, reverse)
add_debug(*path.info("process_path_list(#{reverse})"))
if path.respond_to?(:pathitem)
[[reverse, process_expression(path.pathitem)]] + process_path_list(path.expression, path.respond_to?(:reverse))
else
[[reverse, process_expression(path)]]
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs\n seq = to_a\n seq.zip([*seq[1..-1], unit.advance(to)])\n end",
"def pairs(ring)\n ring.each_cons(2).to_a << [ring.last, ring.first]\nend",
"def to_a\n [left, top, right]\n end",
"def to_a\n [left, top, right]\n end",
"def to_p... | [
"0.6275539",
"0.5966919",
"0.5783025",
"0.5783025",
"0.5710056",
"0.563335",
"0.563335",
"0.56139535",
"0.5596979",
"0.5552129",
"0.55462563",
"0.5539162",
"0.55251837",
"0.5504949",
"0.5503821",
"0.55031765",
"0.55031765",
"0.55031765",
"0.54837716",
"0.5480774",
"0.54771614... | 0.0 | -1 |
Is this an allowable keyword? | def keyword_check(kw)
unless (@keywords || %w(a is of has)).include?(kw)
raise RDF::ReaderError, "unqualified keyword '#{kw}' used without @keyword directive" if @strict
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed?; true end",
"def allowed?(mthd)\n return true if self.class.allowed_keywords.include?(mthd)\n false\n end",
"def allowed?(*_)\n true\n end",
"def allowed?() raise NotImplementedError end",
"def allowed?\n true\n end",
"def allowed?\n true\n end",
"d... | [
"0.74348336",
"0.7182828",
"0.70418906",
"0.67938304",
"0.6695928",
"0.6695928",
"0.6647959",
"0.6585169",
"0.65178394",
"0.64867604",
"0.64041287",
"0.6397945",
"0.6322781",
"0.6304707",
"0.62154716",
"0.62154716",
"0.6190584",
"0.61482084",
"0.6139552",
"0.60561794",
"0.604... | 0.6236079 | 14 |
This method needs information about stored message, such as putting queue's name, message, options, as aruments. And those values stucked queue_info hash and following keys are necessary. :queue_name :queue_message :queue_headers As :queue_headers, some options are supported. See the reliablemsg docuememt for more deta... | def __ap4r_forward_by_queue_info(stored_message_id, queue_info, options)
__ap4r_queue_put(queue_info[:queue_name], queue_info[:queue_message], queue_info[:queue_headers])
StoredMessage.destroy_if_exists(stored_message_id, options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_message_queue(options = {})\n QueuedMessage.create!(:message => self, :server_id => @database.server_id, :batch_key => self.batch_key, :domain => self.recipient_domain, :route_id => self.route_id, :manual => options[:manual]).id\n end",
"def get_message(options = {})\n @queue_handle =... | [
"0.60811037",
"0.59469295",
"0.59219676",
"0.58177835",
"0.57313055",
"0.5708917",
"0.5670832",
"0.56081736",
"0.55653936",
"0.5559183",
"0.5536811",
"0.5509805",
"0.54320353",
"0.5335955",
"0.53109264",
"0.5277643",
"0.52679497",
"0.52381855",
"0.52089214",
"0.5198192",
"0.5... | 0.63574666 | 0 |
This method does't need information about stored message. All that is required is stored_message_id. Find target record by stored_message_id, make queue information, such as queue name, message, options, for putting into queue. Now under implementation. And this method's options is now :delete_mode only. See the StoreM... | def __ap4r_forward_by_stored_message_id(stored_message_id, options)
raise "not implemented"
# TODO: Find record and make queue info , 2006/10/13 kato-k
queue_name = nil
queue_message = nil
queue_headers = nil
__ap4r_forward_by_queue_info(queue_name, queue_message, queue_headers... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def __ap4r_forward_by_queue_info(stored_message_id, queue_info, options)\r\n __ap4r_queue_put(queue_info[:queue_name], queue_info[:queue_message], queue_info[:queue_headers])\r\n StoredMessage.destroy_if_exists(stored_message_id, options)\r\n end",
"def add_to_message_queue(options = {})\n Qu... | [
"0.6400887",
"0.6314936",
"0.5898369",
"0.5493938",
"0.54919124",
"0.5452581",
"0.53991306",
"0.5343902",
"0.5323809",
"0.5298179",
"0.5289672",
"0.5268158",
"0.5217503",
"0.51828796",
"0.51589715",
"0.5121179",
"0.50704193",
"0.5067834",
"0.5057109",
"0.5026329",
"0.49955547... | 0.6754523 | 0 |
Puts a message into queue. As queue_headers, some options are supported. See the reliablemsg docuememt for more details. | def __ap4r_queue_put(queue_name, queue_message, queue_headers)
q = ReliableMsg::Queue.new(queue_name, :drb_uri => @@drb_uri || DRUBY_URI)
q.put(queue_message, queue_headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_to_message_queue(options = {})\n QueuedMessage.create!(:message => self, :server_id => @database.server_id, :batch_key => self.batch_key, :domain => self.recipient_domain, :route_id => self.route_id, :manual => options[:manual]).id\n end",
"def put(body, headers = { })\n body, headers = ... | [
"0.6780271",
"0.67774916",
"0.67217785",
"0.66819155",
"0.6652968",
"0.65698427",
"0.6435122",
"0.64259815",
"0.6407106",
"0.64010274",
"0.63886726",
"0.6296989",
"0.6217735",
"0.62073624",
"0.6196564",
"0.6143411",
"0.61123675",
"0.60425496",
"0.6016092",
"0.6013231",
"0.600... | 0.74203527 | 0 |
test method for check node work | def tmp_get_msg
while TRUE do
puts '='*20 + "\n" + 'Enter the message please: '
@pc_message_queue << gets.chomp
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check(node); end",
"def test_for_node\n raise \"Failing test #{@name} for #{@node}\" if Node.fail_for.key?(@name) && Node.fail_for[@name].include?(@node)\n\n sleep_time = Node.sleeps.dig(@name, @node)\n sleep sleep_time unless sleep_time.nil?\n Node.runs << [@name, @node]\n e... | [
"0.7709585",
"0.68449205",
"0.6818609",
"0.6783926",
"0.67699814",
"0.67365307",
"0.6701851",
"0.6701851",
"0.66841805",
"0.6655567",
"0.6650953",
"0.6617561",
"0.6481308",
"0.64254594",
"0.6391782",
"0.6347116",
"0.63382334",
"0.63108194",
"0.62872934",
"0.62822175",
"0.6279... | 0.0 | -1 |
the base method for get/send msg form previous/next node | def start
while sleep(1)
prev_node_message = @next_node.gets.chomp
next if prev_node_message.empty?
state, n_to, pc_to, data, n_from = parse_marker(prev_node_message)
puts "Get marker from #{n_from} node (to #{n_to} node) ".yellow + "Data: #{data}".green
if state == NOT_BUSY
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_message; end",
"def next_message; end",
"def prev\n connection.write(\"prev\")\n end",
"def prev_follow\n end",
"def previous\n connection.write(\"prev\")\n end",
"def get_next\n\t\t\n\tend",
"def prev\n\t\t@prev\n\tend",
"def next_follow\n end",
"def previous\n ... | [
"0.665367",
"0.665367",
"0.6336428",
"0.6154574",
"0.6145767",
"0.6075902",
"0.5913838",
"0.5768733",
"0.5768166",
"0.5768166",
"0.5667669",
"0.5632701",
"0.5580878",
"0.5556387",
"0.55248076",
"0.55248076",
"0.55128586",
"0.5511101",
"0.5503145",
"0.54911554",
"0.54911554",
... | 0.0 | -1 |
Create our test table (assumes it doesn't already exist) | def createUserTable
@conn.exec("CREATEE users (id serial NOT NULL, name character varying(255), CONSTRAINT users_pkey PRIMARY KEY (id)) WITH (OIDS=FALSE);");
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new_test(test_name)\n\tdb.execute(\"CREATE TABLE IF NOT EXISTS #{test_name} (id INTEGER PRIMARY KEY,\n student_first VARCHAR(255),\n student_last VARCHAR(255),\n grade INT\n );\")\nend",
"def create_table\n unless table_exists?\n key_options = connection.internal_string_options_for_... | [
"0.77338153",
"0.72844446",
"0.7278346",
"0.72583646",
"0.71702355",
"0.71639544",
"0.7115298",
"0.71143854",
"0.7096973",
"0.707904",
"0.70723253",
"0.70546395",
"0.70406485",
"0.70358187",
"0.7023215",
"0.7000921",
"0.6991063",
"0.69613963",
"0.6952091",
"0.6948661",
"0.694... | 0.6636248 | 50 |
When we're done, we're going to drop our test table. | def dropUserTable
@conn.exec("DROPE users")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown_test_db\n ActiveRecord::Base.connection.tables.each do |t|\n ActiveRecord::Base.connection.drop_table(t)\n end\nend",
"def drop_table\n db.drop_table(table_name)\n end",
"def drop(db)\n\tif $table_exists\n\t\tdb.execute(\"DROP TABLE items;\")\n\t\t$table_exists = false\n\t\tpu... | [
"0.7804017",
"0.74657077",
"0.73985523",
"0.7264491",
"0.7219821",
"0.70996314",
"0.7053829",
"0.70486754",
"0.7014189",
"0.6988505",
"0.698177",
"0.6964014",
"0.6922223",
"0.68625647",
"0.68534017",
"0.6849686",
"0.68454725",
"0.68429077",
"0.68204606",
"0.6809502",
"0.67763... | 0.6711887 | 26 |
Prepared statements prevent SQL injection attacks. However, for the connection, the prepared statements live and apparently cannot be removed, at least not very easily. There is apparently a significant performance improvement using prepared statements. | def prepareInsertUserStatement
@conn.prepare("insert_user", "insert into users (id, name) values ($1, $2)")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allow_preparing_prepared_statements?\n false\n end",
"def statements_prepared(conn)\n @statement_mutex.synchronize do\n @statements_prepared ||= {}\n @statements_prepared[conn] ||= {}\n end\n end",
"def _execute_prepared_statement(conn, ps_name, args, opts... | [
"0.69680655",
"0.6812178",
"0.6775718",
"0.66736174",
"0.6592991",
"0.6558691",
"0.65532964",
"0.6544166",
"0.6489599",
"0.6445156",
"0.63902503",
"0.637759",
"0.6320613",
"0.63169146",
"0.6307152",
"0.6273061",
"0.626633",
"0.62080425",
"0.6198451",
"0.6159459",
"0.6096583",... | 0.5714584 | 41 |
Add a user with the prepared statement. | def addUser(id, username)
@conn.exec_prepared("insert_user", [id, username])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addUser(stat,typ,email,pwhash)\n @conn.exec_prepared(\"add_user\",[stat,typ,email,pwhash])\n end",
"def prepAddUser\n sql = %{\n INSERT INTO users\n (status,type,email,password_hash)\n VALUES\n ($1,$2,$3,$4)\n }\n @conn.prepare(\"add_... | [
"0.76378924",
"0.73527014",
"0.7112658",
"0.70664454",
"0.6945509",
"0.67263556",
"0.67205256",
"0.6589601",
"0.65289116",
"0.65277916",
"0.6524351",
"0.6471087",
"0.6434685",
"0.6375153",
"0.62525654",
"0.6249801",
"0.62329006",
"0.6227249",
"0.62168527",
"0.61566347",
"0.61... | 0.80695665 | 0 |
Get our data back | def queryUserTable
@conn.exec( "SELECT * FROM users" ) do |result|
result.each do |row|
yield row if block_given?
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\n @data\n end",
"def data\r\n @data... | [
"0.7865469",
"0.77454877",
"0.77454877",
"0.77454877",
"0.77210313",
"0.7712519",
"0.7712519",
"0.7712519",
"0.76901114",
"0.7680547",
"0.7582902",
"0.7567605",
"0.7564725",
"0.74818075",
"0.74187887",
"0.7379257",
"0.73511827",
"0.72945577",
"0.72945577",
"0.72873694",
"0.72... | 0.0 | -1 |
Disconnect the backend connection. | def disconnect
@conn.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disconnect\r\n @connection.close_connection\r\n @connection = nil\r\n end",
"def disconnect\n @connection.logout\n end",
"def disconnect\n @connection.close if connected?\n @connection = nil\n end",
"def disconnect\n @conn.close\n end",
"def disconnect\n ... | [
"0.7760993",
"0.7676537",
"0.7600808",
"0.75934005",
"0.75934005",
"0.75934005",
"0.75934005",
"0.75093544",
"0.74793315",
"0.7469491",
"0.74429977",
"0.73797524",
"0.7353087",
"0.73338026",
"0.7328744",
"0.7321485",
"0.7260894",
"0.7257134",
"0.7227625",
"0.7224655",
"0.7186... | 0.7024142 | 27 |
GET /tecnicas_de_impresion GET /tecnicas_de_impresion.json | def index
@tecnicas_de_impresion = TecnicaDeImpresion.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @impuesto = Impuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @impuesto }\n end\n end",
"def mostrar_impedimentos\n @impedimentos = Paciente.find(params[:id]).cuestionario_impedimentos\n end",
"def index\n @in... | [
"0.6586493",
"0.65710264",
"0.65427804",
"0.6445074",
"0.6335881",
"0.6224762",
"0.62060183",
"0.61344373",
"0.61219585",
"0.6114369",
"0.60404736",
"0.6033719",
"0.6009496",
"0.5991646",
"0.5986875",
"0.59701186",
"0.595658",
"0.59521806",
"0.59511566",
"0.59368646",
"0.5920... | 0.6972644 | 0 |
GET /tecnicas_de_impresion/1 GET /tecnicas_de_impresion/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tecnicas_de_impresion = TecnicaDeImpresion.all\n end",
"def show\n @impuesto = Impuesto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @impuesto }\n end\n end",
"def set_tecnica_de_impresion\n @tecnica_de_impres... | [
"0.6845017",
"0.66493756",
"0.66004425",
"0.65470356",
"0.6438295",
"0.6246212",
"0.6111115",
"0.60508597",
"0.60422814",
"0.603421",
"0.60192055",
"0.60121995",
"0.6006351",
"0.5975722",
"0.5959953",
"0.59304595",
"0.5927308",
"0.59075254",
"0.5902102",
"0.5888011",
"0.58592... | 0.0 | -1 |
POST /tecnicas_de_impresion POST /tecnicas_de_impresion.json | def create
@tecnica_de_impresion = TecnicaDeImpresion.new(tecnica_de_impresion_params)
respond_to do |format|
if @tecnica_de_impresion.save
format.html { redirect_to @tecnica_de_impresion, notice: 'Tecnica de impresion was successfully created.' }
format.json { render :show, status: :crea... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tecnica_de_impresion_params\n params.require(:tecnica_de_impresion).permit(:tecnica, :descripcion, :estado)\n end",
"def create\n @impuesto = Impuesto.new(params[:impuesto])\n\n respond_to do |format|\n if @impuesto.save\n format.html { redirect_to @impuesto, :notice => 'Impuesto wa... | [
"0.7008086",
"0.6666152",
"0.64560527",
"0.6358613",
"0.6215836",
"0.6095615",
"0.60222757",
"0.59931535",
"0.59895056",
"0.5986611",
"0.5927444",
"0.58796656",
"0.5879345",
"0.5878797",
"0.58695734",
"0.5867512",
"0.58529675",
"0.58409333",
"0.5778849",
"0.5772605",
"0.57654... | 0.70196205 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.