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 |
|---|---|---|---|---|---|---|
The directory where the project skeleton is located. | def skeleton_dir
options[:skeleton_dir]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_dir\n config.project_dir\n end",
"def project_root\n File.expand_path(\"#{__dir__}/..\")\n end",
"def base_directory\n File.expand_path(File.join(File.dirname(__FILE__), '..'))\n end",
"def __dir__\n File.expand_path('..', __FILE__)\n end",
"def dir\n ... | [
"0.74789023",
"0.73021334",
"0.7279017",
"0.7266219",
"0.7235598",
"0.7231845",
"0.72299385",
"0.71980625",
"0.71980625",
"0.71863186",
"0.7167508",
"0.71238047",
"0.71216035",
"0.71106553",
"0.7100029",
"0.7100029",
"0.7100029",
"0.7100029",
"0.7100029",
"0.7100029",
"0.7100... | 0.7604059 | 0 |
The project name from the command line. | def name
options[:name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def project_name\n if arguments[1]\n arguments[1]\n else\n File.basename(repo.root)\n end\n end",
"def project_name\n \"$PROJECT_NAME v.$PROJECT_VERSION\"\n end",
"def name\n project.name\n end",
"def name\n project.name\n end",
"def project_name\n ret... | [
"0.8354814",
"0.78756726",
"0.7684177",
"0.7684177",
"0.74898726",
"0.74698937",
"0.7275594",
"0.7160909",
"0.7119808",
"0.70117515",
"0.6990758",
"0.696625",
"0.692899",
"0.69169664",
"0.6902265",
"0.6856842",
"0.6803519",
"0.6787602",
"0.6767172",
"0.675411",
"0.6722484",
... | 0.0 | -1 |
A git or svn repository URL from the command line. | def repository
return options[:repository] if options.has_key? :repository
return IO.read(skeleton_dir).strip if skeleton_dir and test(?f, skeleton_dir)
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repo_url\n svn('info', '--xml')[/<url>(.*?)<\\/url>/, 1].strip\n end",
"def giturl(project_name, repo_name) ; end",
"def repo_url(path = \"\")\n if @repo.url\n url = URI::parse(@repo.url)\n url.path = (url.path + \"/\" + path).gsub(%r'//+', '/')\n url.to_s\n else\n ... | [
"0.7619067",
"0.7086858",
"0.7016158",
"0.6975914",
"0.69257474",
"0.6842642",
"0.680891",
"0.6751448",
"0.67285836",
"0.66526544",
"0.6611685",
"0.6597143",
"0.6572684",
"0.6537",
"0.6485946",
"0.64751494",
"0.6438687",
"0.6425123",
"0.63082385",
"0.6307794",
"0.6274436",
... | 0.0 | -1 |
Returns +true+ if we are going to copy the Docbones tasks into the destination directory. Normally this will return +false+. | def with_tasks?
options[:with_tasks]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_copied?(tsks=self.tasks)\n return true unless copy_media?\n if tsks.any?{|t| t.type == 'Tasks::CopyTask'}\n return tsks.any?{|t| t.type == 'Tasks::CopyTask' && t.status == Task::COMPLETE }\n else\n return false\n end\n end",
"def preform_copy_directory\n @destination_director... | [
"0.74167025",
"0.6818292",
"0.6711182",
"0.6475046",
"0.6457042",
"0.6164591",
"0.61613417",
"0.6160089",
"0.6122405",
"0.59870523",
"0.5954542",
"0.59356534",
"0.59193605",
"0.585792",
"0.5804529",
"0.57703125",
"0.5744833",
"0.57423943",
"0.57308114",
"0.57242197",
"0.57150... | 0.0 | -1 |
Returns +true+ if the user has requested verbose messages. | def verbose?
options[:verbose]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbose?\n @verbose ||= !!options[:verbose]\n end",
"def verbose?\n @verbose\n end",
"def verbose?\n @options[:verbose]\n end",
"def verbose?\n verbose = ENV['VERBOSE']\n verbose && verbose =~ /^true$/i ? true : false\n end",
"def verbose?\n @verbose_... | [
"0.8060586",
"0.80576175",
"0.8056282",
"0.8055303",
"0.7993786",
"0.7977742",
"0.79599684",
"0.79599684",
"0.79582983",
"0.79514444",
"0.79161847",
"0.7914623",
"0.7889099",
"0.78673106",
"0.7806589",
"0.76900095",
"0.76895773",
"0.7605243",
"0.7580548",
"0.75280774",
"0.720... | 0.78369707 | 14 |
Returns the .docbones resource directory in the user's home directory. | def mrbones_dir
return @mrbones_dir if defined? @mrbones_dir
path = File.join(::Docbones::HOME, '.mrdocbones')
@mrbones_dir = File.expand_path(path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_documents_dir\n base_dir = app_sandbox_dir\n if base_dir.nil?\n nil\n else\n File.join(base_dir, 'Documents')\n end\n end",
"def docdir\n return $docdir if $docdir\n dir = get_config('doc-dir')+'/'\n dir.sub!(/\\A$prefix/, get_config('prefix'))\n $docdir... | [
"0.69536954",
"0.6930361",
"0.6930361",
"0.6741077",
"0.6613771",
"0.6512126",
"0.64991516",
"0.64885706",
"0.6485737",
"0.6356487",
"0.6352073",
"0.63449645",
"0.6311603",
"0.63085175",
"0.6247727",
"0.6235872",
"0.6235329",
"0.6230839",
"0.61904055",
"0.618231",
"0.61777306... | 0.69892466 | 0 |
the update action expects the port object's id and a status flag to be passed as parameters. The status flag is either 1 (enable) or 2 (disable), and indicates the ports new Admin status. | def toggle
@port = Port.find params[:id]
@status = params[:new_status].to_i
# byebug
case @status
when 1 # cuerently disabled
# Look for an event for the port (switch IP, ifName) that doesn't have
# the WhenEnabled and WhoEnabled fields filled.
@events = Event.where("port... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @dev_port.update(dev_port_params)\n format.html { redirect_to @dev_port, notice: 'Dev port was successfully updated.' }\n format.json { render :show, status: :ok, location: @dev_port }\n else\n format.html { render :edit }\n format.j... | [
"0.67584884",
"0.6583838",
"0.6481207",
"0.6481207",
"0.6481207",
"0.6481207",
"0.6481207",
"0.6481207",
"0.6312305",
"0.6276764",
"0.62287545",
"0.619889",
"0.61782616",
"0.6139786",
"0.6032149",
"0.60175204",
"0.6007331",
"0.6006593",
"0.5965191",
"0.5958405",
"0.59527636",... | 0.64736795 | 8 |
Muestra el numero de cuenta con el balance actual | def number_with_current_balance
"#{number} -- (#{current_balance.to_currency()})"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actualizar_balance\n @cuenta_general = Sistema::Usuario.find_by(\n numero_cuenta: Finanzas::Transaccion::CUENTA_GENERAL\n )\n @cuenta_general.update_attribute :balance, @cuenta_general.balance.to_f + @deposito.comision\n @usuario.update_attribute :balance, @usuario.balance.to_f + @deposito.mon... | [
"0.74888587",
"0.709207",
"0.70421064",
"0.69884723",
"0.6936323",
"0.6908804",
"0.6880329",
"0.68345356",
"0.6818733",
"0.6759454",
"0.6720649",
"0.6720414",
"0.6717355",
"0.67110634",
"0.6700997",
"0.668292",
"0.66811204",
"0.66710407",
"0.6656316",
"0.664805",
"0.66345525"... | 0.6652796 | 19 |
Muestra stodas las chuqeras inline | def checkbooks_inline
cash_bank_checkbooks.map(&:full_name).join("<br/>")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def converte\n # estados\n estados = ['q']\n 1.upto(@estados.length) do |i|\n @estados.keys.combination(i).to_a.collect { |c| c.sort.join }.each do |a|\n estados << 'q' + a\n end\n end\n\n # alfabeto\n alfabeto = @alfabeto\n\n # função de transição\n transicao = []\n est... | [
"0.6144421",
"0.59742707",
"0.593615",
"0.57582265",
"0.5723685",
"0.5723685",
"0.5684192",
"0.5663492",
"0.55937296",
"0.5572431",
"0.55687094",
"0.5544026",
"0.5529273",
"0.55027723",
"0.5500884",
"0.54773146",
"0.5439188",
"0.5427195",
"0.5426317",
"0.5410813",
"0.540848",... | 0.0 | -1 |
Bsuca los moviemientos del periodo establcido | def all_movement_by_period(period)
month,year = period.split("/")
period = "#{year}-#{month}"
cash_bank_bank_movements.all(:conditions => ["SUBSTRING(date,1,7) = '#{period}'"])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bc_movimiento\r\n\t\t\tself.fecha = Time.now\r\n\t\t\tif self.monto_cheque == 0 \r\n\t\t\t\tmonto_cheque = 0\r\n\t\t\t\tself.cheque_recibidos.each do |cheque|\r\n\t\t\t\t\tmonto_cheque = monto_cheque + cheque.monto\r\n\t\t\t\tend\r\n\t\t\t\tself.monto_cheque = monto_cheque \r\n\t\t\tend\r\n\t\tend",
"def rec... | [
"0.6684721",
"0.64145535",
"0.6360379",
"0.631674",
"0.61751664",
"0.6175082",
"0.61692613",
"0.6163557",
"0.60882896",
"0.6085854",
"0.60365313",
"0.6028892",
"0.602304",
"0.6005905",
"0.6005905",
"0.6005905",
"0.59735775",
"0.58609694",
"0.5857008",
"0.5848851",
"0.5828317"... | 0.57484543 | 24 |
GET /channels GET /channels.json | def index
@channels = Channel.where(:user_id => current_user.id).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels_list\n get \"channels\"\n end",
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def index\n \t@channels = Channel.all\n\t\t render json: @channels\n end",
"def index\n @channels = Channel.all\n\n respond_to do |format|\n format.html # i... | [
"0.840216",
"0.8221569",
"0.7721451",
"0.7716579",
"0.76949835",
"0.7573315",
"0.7553435",
"0.75201637",
"0.74954647",
"0.74847597",
"0.74847597",
"0.7463422",
"0.74545854",
"0.7411474",
"0.73368484",
"0.7278094",
"0.7206351",
"0.71910304",
"0.7190039",
"0.71870553",
"0.71814... | 0.7048188 | 24 |
GET /channels/1 GET /channels/1.json | def show
@articles = @channel.articles.order("pub_date DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels(params = {page:1})\n http.get('/channels', params)\n end",
"def show\n channel = Channel.find(params[:id])\n json_response(channel)\n end",
"def channels_list\n get \"channels\"\n end",
"def index\n @channels = Channel.all\n\n respond_to do |format|\n ... | [
"0.77891827",
"0.7744396",
"0.7721695",
"0.75476134",
"0.7422232",
"0.7360235",
"0.7266247",
"0.7181726",
"0.7181726",
"0.7171254",
"0.71664613",
"0.71635157",
"0.7127192",
"0.708928",
"0.704912",
"0.69591177",
"0.6936039",
"0.69209534",
"0.6906611",
"0.68693507",
"0.68493986... | 0.0 | -1 |
POST /channels POST /channels.json | def create
@channel = Channel.new(channel_params)
respond_to do |format|
if @channel.save
format.html { redirect_to @channel, notice: 'Channel was successfully created.' }
format.json { render action: 'show', status: :created, location: @channel }
else
format.html { render a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @channel = Channel.new(channel_params)\n respond_to do |format|\n if @channel.save\n format.json { render :show, status: :created, location: @channel}\n else\n format.json { render json: @channel.errors, status: :unprocessable_entity}\n end\n end\n end",
"def c... | [
"0.72349757",
"0.7108459",
"0.7106823",
"0.71050256",
"0.7094225",
"0.6976248",
"0.6929276",
"0.66940284",
"0.66851574",
"0.6637304",
"0.6481542",
"0.64805424",
"0.6477746",
"0.64751023",
"0.64558595",
"0.6455357",
"0.64192915",
"0.6415729",
"0.6391763",
"0.6384885",
"0.63846... | 0.7032134 | 6 |
PATCH/PUT /channels/1 PATCH/PUT /channels/1.json | def update
respond_to do |format|
if @channel.update(channel_params)
format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @channel.errors, s... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @channel = Channel.find(params[:id])\n\n respond_to do |format|\n if @channel.update_attributes(params[:channel])\n format.html { redirect_to @channel, notice: 'Channel was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"... | [
"0.6913254",
"0.6855041",
"0.6855041",
"0.67958575",
"0.6724565",
"0.66813886",
"0.6668404",
"0.6616094",
"0.6554495",
"0.653245",
"0.6527352",
"0.6499981",
"0.64771175",
"0.6462266",
"0.64348847",
"0.64316183",
"0.64105445",
"0.6367349",
"0.63603616",
"0.63411903",
"0.625714... | 0.6948494 | 1 |
DELETE /channels/1 DELETE /channels/1.json | def destroy
@channel.destroy
respond_to do |format|
format.html { redirect_to channels_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @channel = Channel.find(params[:id])\n @channel.destroy\n\n respond_to do |format|\n format.html { redirect_to channels_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @raw_channel = RawChannel.find(params[:id])\n @raw_channel.destroy\n\n respond_to do ... | [
"0.79557526",
"0.78064543",
"0.76956165",
"0.76956165",
"0.7682578",
"0.7661241",
"0.7650685",
"0.76304424",
"0.7550027",
"0.7542931",
"0.7522875",
"0.7495436",
"0.7416484",
"0.7351752",
"0.72208595",
"0.71968657",
"0.7188308",
"0.7125074",
"0.70081097",
"0.6994103",
"0.69862... | 0.79227597 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_channel
@channel = Channel.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 channel_params
params.require(:channel).permit(:url, :name, :user_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 |
checks if the user is signed in | def authorize
if !user_signed_in?
redirect_to new_user_session_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signed_in?\n !current_user.nil?\n end",
"def signed_in? \n\t\t!current_user.nil?\n\tend",
"def signed_in?\n !!current_user\n end",
"def signed_in?\n current_user.present?\n end",
"def signed_in?\n current_user.present?\n end",
"def user_signed_in?\n ... | [
"0.83142906",
"0.8308059",
"0.829143",
"0.82846767",
"0.82846767",
"0.8256725",
"0.8253425",
"0.8237343",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.8231443",
"0.82240415",
"0.82171977",
"0.82161653",
"0.8201511"... | 0.0 | -1 |
Stores the URL trying to be accessed. | def store_location
session[:forwarding_url] = request.original_url if request.get?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_location\n session[:forwarding_url] = request.url if request.get?\n # Makes sure that the URL is saved only for a GET request because submitting\n # DELETE, PATCH or POST will raise errors when the URL is expecting\n # a GET request.\n end",
"def store_location\n # store last url as lon... | [
"0.69116175",
"0.6895489",
"0.6884959",
"0.6784313",
"0.6784313",
"0.6784313",
"0.6784313",
"0.6784313",
"0.6784313",
"0.6694612",
"0.66793954",
"0.6637457",
"0.6633661",
"0.66288584",
"0.6592983",
"0.6592983",
"0.6592983",
"0.6592983",
"0.6591829",
"0.6568926",
"0.6557964",
... | 0.0 | -1 |
check the user is there | def logged_in?
unless session[:user_id].nil?
return current_user
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_exists?\n \t\tself.errors.add(:name, \"does not exist!\") unless self.user_id.present?\n \tend",
"def requires_user_existence!\n if not e.user_exists?\n error \"You have to setup your user before you can perform this action.\"\n exit\n end\n end",
"def hasuser? u... | [
"0.77963793",
"0.7765091",
"0.7714571",
"0.7626816",
"0.75965464",
"0.75778234",
"0.7555464",
"0.75364745",
"0.7536095",
"0.752014",
"0.7486503",
"0.74851435",
"0.74822354",
"0.74670625",
"0.7453231",
"0.7424219",
"0.7392861",
"0.7350835",
"0.7328013",
"0.7271756",
"0.7260479... | 0.0 | -1 |
GET /lookup_rads/1 GET /lookup_rads/1.xml | def show
@lookup_rad = LookupRad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @lookup_rad }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def create\n @lookup_rad = LookupRad.new(params[:lookup_rad])\n\n respond_to do |format|\n if @lookup_rad.save\n format.h... | [
"0.6365373",
"0.5930321",
"0.59016347",
"0.5824606",
"0.5741123",
"0.57105607",
"0.57022625",
"0.5654959",
"0.5631166",
"0.5615963",
"0.5603128",
"0.5577591",
"0.55626154",
"0.55594563",
"0.5558652",
"0.5554671",
"0.5486919",
"0.5482988",
"0.54729897",
"0.5426842",
"0.5423157... | 0.71305346 | 0 |
GET /lookup_rads/new GET /lookup_rads/new.xml | def new
@lookup_rad = LookupRad.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @lookup_rad }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @lookup_rad = LookupRad.new(params[:lookup_rad])\n\n respond_to do |format|\n if @lookup_rad.save\n format.html { redirect_to(@lookup_rad, :notice => 'Lookup rad was successfully created.') }\n format.xml { render :xml => @lookup_rad, :status => :created, :location => @lookup... | [
"0.7292655",
"0.71032465",
"0.7072553",
"0.70562154",
"0.6784758",
"0.6719099",
"0.67178077",
"0.671608",
"0.66384137",
"0.6486574",
"0.64478236",
"0.644596",
"0.6431843",
"0.6421213",
"0.64199144",
"0.6382245",
"0.63613373",
"0.6360366",
"0.63142943",
"0.6287426",
"0.6277401... | 0.77991956 | 0 |
POST /lookup_rads POST /lookup_rads.xml | def create
@lookup_rad = LookupRad.new(params[:lookup_rad])
respond_to do |format|
if @lookup_rad.save
format.html { redirect_to(@lookup_rad, :notice => 'Lookup rad was successfully created.') }
format.xml { render :xml => @lookup_rad, :status => :created, :location => @lookup_rad }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end",
"def show\n @lookup_rad = LookupRad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml ... | [
"0.61322904",
"0.56935406",
"0.5657473",
"0.5622554",
"0.5462752",
"0.5359125",
"0.5290753",
"0.5235044",
"0.5233241",
"0.52075934",
"0.5116682",
"0.5001049",
"0.49950022",
"0.49592912",
"0.49353576",
"0.49260402",
"0.49191228",
"0.48989207",
"0.4878724",
"0.48508793",
"0.483... | 0.696 | 0 |
PUT /lookup_rads/1 PUT /lookup_rads/1.xml | def update
@lookup_rad = LookupRad.find(params[:id])
respond_to do |format|
if @lookup_rad.update(params[:lookup_rad], :without_protection => true)
format.html { redirect_to(@lookup_rad, :notice => 'Lookup rad was successfully updated.') }
format.xml { head :ok }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @lookup_type = Irm::LookupType.find(params[:id])\n\n respond_to do |format|\n if @lookup_type.update_attributes(params[:irm_lookup_type])\n format.html { redirect_to({:action=>\"index\"},:notice => (t :successfully_updated))}\n format.xml { head :ok }\n else\n for... | [
"0.63384926",
"0.6110693",
"0.60450786",
"0.58712286",
"0.57740337",
"0.57697934",
"0.56566536",
"0.56071186",
"0.55328",
"0.54868895",
"0.547929",
"0.53968287",
"0.5321737",
"0.52932835",
"0.52836496",
"0.5282602",
"0.5272801",
"0.52327824",
"0.5217129",
"0.5201923",
"0.5189... | 0.69140226 | 0 |
DELETE /lookup_rads/1 DELETE /lookup_rads/1.xml | def destroy
@lookup_rad = LookupRad.find(params[:id])
@lookup_rad.destroy
respond_to do |format|
format.html { redirect_to(lookup_rads_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @lookup_set = LookupSet.find(params[:id])\n @lookup_set.destroy\n\n respond_to do |format|\n format.html { redirect_to(lookup_sets... | [
"0.67479515",
"0.6458872",
"0.6412142",
"0.6389025",
"0.63108414",
"0.6280421",
"0.62790304",
"0.6277793",
"0.62609065",
"0.6200048",
"0.61592877",
"0.6156389",
"0.61145484",
"0.61095536",
"0.6092755",
"0.6092364",
"0.60867673",
"0.60827565",
"0.6080881",
"0.60505277",
"0.604... | 0.748108 | 0 |
construction of all room instances moved to factory module | def initialize
@rooms = list_rooms
@reservations = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_hotel_rooms\n (1..20).each do |num|\n @all_rooms << num #Hotel::Room.new(num) I don't think I have to do this\n end\n end",
"def create_room\n Room.new\n end",
"def setup_hotel\n single = Room.new('Single', 1, 30)\n double = Room.new('Double', 2, 50)\n family = Room.new('Fam... | [
"0.6852046",
"0.6823832",
"0.6764863",
"0.6701169",
"0.6543367",
"0.6464359",
"0.638874",
"0.6348627",
"0.63034964",
"0.62731993",
"0.62642705",
"0.62619936",
"0.61696243",
"0.6144311",
"0.6138186",
"0.61310506",
"0.6128409",
"0.60537505",
"0.60299355",
"0.595414",
"0.5948536... | 0.6247193 | 12 |
See that we have can load up commands | def test_abbrev_stringify
assert_equal('(test)ing',
abbrev_stringify('testing', 'test'.size))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_load_commands\n include_in_universe\n end",
"def commands\n load_commands unless @commands\n @commands\n end",
"def load_commands\n subcommand_files.each { |subcommand| Kernel.load subcommand }\n true\n end",
"def load_commands\n subcommand_files.each { |su... | [
"0.7666353",
"0.74101466",
"0.7383536",
"0.7383536",
"0.7383536",
"0.7259815",
"0.69499654",
"0.68880874",
"0.6761793",
"0.6750951",
"0.6737156",
"0.6664577",
"0.66564584",
"0.6646624",
"0.6634914",
"0.6634914",
"0.6634914",
"0.6617089",
"0.65151554",
"0.64873683",
"0.6485801... | 0.0 | -1 |
GET /patient_photos/1 GET /patient_photos/1.xml | def show
@patient_photo = PatientPhoto.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @patient_photo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.... | [
"0.6862912",
"0.67022485",
"0.66826516",
"0.6631709",
"0.66201156",
"0.6572279",
"0.6572279",
"0.654447",
"0.6528273",
"0.65140533",
"0.65099275",
"0.65046567",
"0.65046567",
"0.65046567",
"0.6446299",
"0.6438636",
"0.64112914",
"0.6403613",
"0.63900304",
"0.6353113",
"0.6343... | 0.7227245 | 0 |
GET /patient_photos/new GET /patient_photos/new.xml | def new
@patient_photo = PatientPhoto.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @patient_photo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n end",
"def new\n @photo = Photo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photo }\n end\n e... | [
"0.73410255",
"0.7320266",
"0.7320266",
"0.7320266",
"0.7320266",
"0.7077842",
"0.7062983",
"0.70126915",
"0.6964489",
"0.6964489",
"0.69641036",
"0.695796",
"0.69178987",
"0.69021374",
"0.6897537",
"0.685587",
"0.6840541",
"0.683676",
"0.6831433",
"0.6829333",
"0.6816707",
... | 0.76339126 | 0 |
POST /patient_photos POST /patient_photos.xml | def create
@patient_photo = PatientPhoto.new(params[:patient_photo])
respond_to do |format|
if @patient_photo.save
flash[:notice] = 'PatientPhoto was successfully created.'
format.html { redirect_to(@patient_photo) }
format.xml { render :xml => @patient_photo, :status => :created... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @patient_photo = PatientPhoto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @patient_photo }\n end\n end",
"def create_photos\n end",
"def create\r\n @patient = Patient.new(params[:patient])\r\n\t\r\n respond_to do |format|\r\n ... | [
"0.61981225",
"0.6142787",
"0.6121864",
"0.6095089",
"0.60119826",
"0.59847736",
"0.5963811",
"0.59060735",
"0.5874532",
"0.586593",
"0.58468443",
"0.58374286",
"0.58173865",
"0.5813735",
"0.5803924",
"0.58021194",
"0.5798968",
"0.57915187",
"0.57674634",
"0.5762493",
"0.5744... | 0.67026335 | 0 |
PUT /patient_photos/1 PUT /patient_photos/1.xml | def update
@patient_photo = PatientPhoto.find(params[:id])
respond_to do |format|
if @patient_photo.update_attributes(params[:patient_photo])
flash[:notice] = 'PatientPhoto was successfully updated.'
format.html { redirect_to(@patient_photo) }
format.xml { head :ok }
else ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @external_photo = ExternalPhoto.find(params[:id])\n\n respond_to do |format|\n if @external_photo.update_attributes(params[:external_photo])\n format.html { redirect_to(@external_photo, :notice => 'External photo was successfully updated.') }\n format.xml { head :ok }\n ... | [
"0.617806",
"0.61425936",
"0.61425936",
"0.6142435",
"0.6142435",
"0.6124669",
"0.61132115",
"0.60323036",
"0.5994098",
"0.5975242",
"0.597375",
"0.5961009",
"0.59578323",
"0.5957421",
"0.5913997",
"0.59091675",
"0.59001714",
"0.58865285",
"0.5870882",
"0.5870491",
"0.5865336... | 0.6661486 | 0 |
DELETE /patient_photos/1 DELETE /patient_photos/1.xml | def destroy
@patient_photo = PatientPhoto.find(params[:id])
@patient_photo.destroy
respond_to do |format|
format.html { redirect_to(patient_photos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @patient = Patient.find(params[:id])\r\n @patient.destroy\r\n \r\n #DELETE PROFILE PIC - ADDED BY UPINDER\r\n @patientID = params[:id]\r\n @directory = File.join(RAILS_ROOT,\"public/patients/photos\")\r\n @directory = File.join(@directory,@patientID)\r\n Upload.delete(@direc... | [
"0.7378081",
"0.71004397",
"0.71004397",
"0.71004397",
"0.71004397",
"0.70509255",
"0.704594",
"0.6941099",
"0.68855464",
"0.6875102",
"0.68686014",
"0.68548715",
"0.6842913",
"0.6830886",
"0.6814246",
"0.67899895",
"0.67826307",
"0.6778522",
"0.6764202",
"0.6754791",
"0.6735... | 0.76953614 | 0 |
CHALLENGE DESCRIPTION: Credits: This problem appeared in the Facebook Hacker Cup 2013 Hackathon. When John was a little kid he didn't have much to do. There was no internet, no Facebook, and no programs to hack on. So he did the only thing he could... he evaluated the beauty of strings in a quest to discover the most b... | def frequency(a)
a.group_by do |e|
e
end.map do |key, values|
[values.size]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_beauty(string)\n chars = Hash.new { |h,k| h[k] = 0 }\n\n string.chars.each do |char|\n chars[char] += 1\n end\n\n next_value = 26\n beauty = 0\n chars.sort_by { |key, value| -value }.each do |_, count|\n beauty += count * next_value\n next_value -= 1\n end\n\n beauty\nend",
"def solve(s)... | [
"0.67497873",
"0.6666357",
"0.64377284",
"0.6403529",
"0.6243196",
"0.6238187",
"0.6229044",
"0.6146552",
"0.61362517",
"0.61142486",
"0.606762",
"0.60345054",
"0.6033986",
"0.6020357",
"0.59944546",
"0.5978795",
"0.5959737",
"0.5954947",
"0.59385717",
"0.5932988",
"0.5903649... | 0.0 | -1 |
Does the cell have a value? | def empty?
return @value == nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_value?(p0) end",
"def is_empty?(cell_value)\n #~ Remove the temp -1 key that is used to prevent and empty hash\n cell_value.delete(-1.to_s)\n \n cell_value.empty?\n end",
"def has_value?\n false\n end",
"def has_value?\n true\n end",
"def value?(value) true end",
"def... | [
"0.7480854",
"0.7443689",
"0.72727394",
"0.72597826",
"0.7253497",
"0.7238036",
"0.7221237",
"0.71926695",
"0.7157019",
"0.7137324",
"0.71232164",
"0.71091974",
"0.7102486",
"0.7102486",
"0.7074795",
"0.70530283",
"0.7048465",
"0.7039766",
"0.7011375",
"0.69879335",
"0.691224... | 0.62664455 | 70 |
Eliminate a value from the possible values that the cell can hold | def eliminate(val)
@modified = true if @candidates.delete(val) != nil
@value = @candidates.first if @candidates.size == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_possible_values_in_row_of(square)\n value_to_remove = square.value\n other_squares_from_row = get_row(square.row).reject { |next_square| next_square.column == square.column }\n other_squares_from_row.each do |square|\n square.possible_values.delete(value_to_remove)\n end\n end",
"def... | [
"0.71696377",
"0.6944922",
"0.6889438",
"0.6795256",
"0.6591282",
"0.64067817",
"0.62580824",
"0.62244076",
"0.62244076",
"0.6130164",
"0.60588896",
"0.60479724",
"0.60284644",
"0.6025427",
"0.5987947",
"0.5910927",
"0.5871154",
"0.58625805",
"0.5833795",
"0.5829455",
"0.5812... | 0.61815894 | 9 |
Set the cell's value. Note this is done explicitly here rather than using attr or attr_writer as there are additional consequences to writing a cells value | def value=(val)
@value = val
@candidates = []
@modified = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []= col, row, value\n (self.get_cell_by_position col, row).set_string_value value\n end",
"def set_value(row,col,value,sheet=nil)\n sheet = @default_value unless sheet\n @cell[sheet][[row,col]] = value\n end",
"def set(row = @row, col = @col, val)\n row, col = wrap(row, col)\n @cells[r... | [
"0.77570415",
"0.76830554",
"0.743283",
"0.73892295",
"0.7197327",
"0.7153625",
"0.70393616",
"0.69023484",
"0.6858924",
"0.68566364",
"0.68051785",
"0.6751911",
"0.67492104",
"0.6729053",
"0.6683533",
"0.6661915",
"0.66607356",
"0.6546565",
"0.65421236",
"0.65402454",
"0.652... | 0.0 | -1 |
Is this value allowed in the cell? | def allowed?(val)
return @candidates.include?(val)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid?\n value\n end",
"def can_have_value?()\n return true\n end",
"def can_have_value?\n return false\n end",
"def can_have_value?\n return true\n end",
"def valid_value?(row, column)\n return false unless %w[A B C].include?(row)\n return false unless [1,2,3].include?(column... | [
"0.71365994",
"0.7062925",
"0.7053181",
"0.6957608",
"0.69567794",
"0.6945293",
"0.68451947",
"0.68282545",
"0.6789859",
"0.6716355",
"0.67085147",
"0.66287947",
"0.6596117",
"0.6554142",
"0.6552759",
"0.65294784",
"0.65294784",
"0.6517368",
"0.64940476",
"0.6492202",
"0.6422... | 0.0 | -1 |
Has this cell been modified? | def modified?
@modified
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_changes?\n (@edited_rows_codes.count > 0) || (@destroyed_rows_codes.count > 0)\n end",
"def modified?\n @modified\n end",
"def modified?\n @modified\n end",
"def modified?\n\t\treturn @dirty ? true : false\n\tend",
"def changed?\r\n @changed\r\n end",
"def changed?\n ... | [
"0.7601456",
"0.7453286",
"0.7453286",
"0.74505925",
"0.74224347",
"0.740251",
"0.7384075",
"0.7373831",
"0.73575205",
"0.7355283",
"0.7338221",
"0.7334594",
"0.7153667",
"0.7112088",
"0.7086862",
"0.7076438",
"0.6954212",
"0.6954212",
"0.69416",
"0.6934964",
"0.69339365",
... | 0.74803203 | 1 |
Clear the modification status | def clear_modification_status
@modified = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_modified\n @modified = false\n nil\n end",
"def clear_changes!\n @changes.clear\n end",
"def clear\n\t\t@data.clear\n\t\t@modified = true\n\tend",
"def clean!\n @changes = []\n end",
"def reset_dirty_flag\n\t\t@dirty = false\n\tend",
"def clear\n do_clear... | [
"0.78984576",
"0.7205824",
"0.68489325",
"0.6706729",
"0.6574311",
"0.6371364",
"0.6351253",
"0.63302827",
"0.62897056",
"0.62897056",
"0.62613964",
"0.62433094",
"0.6225664",
"0.6225664",
"0.6207676",
"0.62051344",
"0.6191565",
"0.6184536",
"0.61720616",
"0.6160934",
"0.6149... | 0.88879395 | 0 |
Not Implemented. You cannot create or update a CloudTrailEvent. | def save
fail ESP::NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event(iam_role_arn:, event_name:, event_time:, event_source:, resources:, request_parameters:)\n puts \"create_event: #{iam_role_arn} #{event_name} #{event_time} #{event_source} res:#{resources} req:#{request_parameters}\"\n _ = @dynamo.update_item(\n expression_attribute_values: {\n '... | [
"0.6441639",
"0.61566496",
"0.60356295",
"0.6024815",
"0.5956212",
"0.5955799",
"0.5898879",
"0.5894193",
"0.5887303",
"0.58804864",
"0.5877716",
"0.58627534",
"0.5858721",
"0.5856878",
"0.5844623",
"0.5841361",
"0.58392423",
"0.5836063",
"0.5835486",
"0.57684016",
"0.5764007... | 0.0 | -1 |
Not Implemented. You cannot destroy a CloudTrailEvent. | def destroy
fail ESP::NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\r\n @event.destroy\r\n end",
"def destroy\n @event.destroy\n end",
"def destroy\n @event.destroy\n end",
"def destroy\n @event.destroy\n end",
"def destroy\n @event.destroy\n \n head :no_content\n end",
"def destroy\n event&.destroy\n render json: { mes... | [
"0.7577735",
"0.756443",
"0.756443",
"0.756443",
"0.7239561",
"0.71442115",
"0.711976",
"0.70947707",
"0.7056575",
"0.7056575",
"0.7056575",
"0.70558727",
"0.69195217",
"0.6892153",
"0.6892153",
"0.6887146",
"0.6886952",
"0.6856446",
"0.67854637",
"0.67845255",
"0.67519426",
... | 0.0 | -1 |
flatten hash or array of hashes to a hash of key => value pairs | def flatten(data)
result = {}
if data.is_a?(Hash)
data.each do |key, value|
flatten_add(result, key, value)
end
elsif data.is_a?(Array)
data.each_with_index do |value, i|
key = 'key' + i.to_s
flatten_add(result, key, value)
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flatten_hash(hash)\n hash.each_with_object({}) do |(key, value), new_object|\n # hash\n if value.is_a? Hash\n reflatten(key, value, new_object)\n # array of hashes\n elsif value.is_a?(Array) && value.first.is_a?(Hash)\n value.each do |val|\n reflatt... | [
"0.7462374",
"0.72136575",
"0.7019395",
"0.695491",
"0.67739385",
"0.67486084",
"0.66284263",
"0.6574635",
"0.65474254",
"0.65143704",
"0.65062773",
"0.6486602",
"0.6351156",
"0.6291534",
"0.6229518",
"0.622034",
"0.62043315",
"0.61689717",
"0.6145826",
"0.61425084",
"0.61094... | 0.69323903 | 4 |
Set the public and static views | def initialize(*args)
super(*args)
@title = "Object Log Application"
# NOTE: Main App URL is a hack...works with most examples
@nav_bar = <<-EOS
<ul class="menu">
<li><a href="#{@main_app_url}">Main App</a></li>
<li><a href="#{path_for('/')}">Main Object</a></li>
<l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init\t\n\tenable :static\n\tset :statics_folder, 'statics'\n\tset :deep_or_flat_structure, 'flat'\n\n\tset :public_folder, settings.statics_folder\n\n\tset :page_pool, page_pool()\nend",
"def views\n self[:views] ||= Gnash.new\n end",
"def view_paths; end",
"def view_paths; end",
"def view_path... | [
"0.63812566",
"0.635762",
"0.63396674",
"0.63396674",
"0.63396674",
"0.6209113",
"0.6191782",
"0.61714804",
"0.61617845",
"0.61360425",
"0.6097856",
"0.60419285",
"0.60396147",
"0.5981048",
"0.5948121",
"0.5946825",
"0.5939646",
"0.59378266",
"0.59367883",
"0.5924093",
"0.592... | 0.0 | -1 |
Some rows have last 2 columns shifted by 2 Check for numeric values of STATE in RTGEB0815.xlsx for examples This checks and fixes those | def fix_row_alignment!(row)
log "#{row['IFSC']}: Using State = '#{row['CITY2']}' STD_CODE=#{row['STATE']}, PHONE=#{row['STD CODE']} and discarding PHONE=#{row['PHONE']}", :info
row['STATE'],row['STD CODE'], row['PHONE'] = row['CITY2'], row['STATE'], row['STD CODE']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_state!(row)\n return unless row['STATE']\n possible_state = final_state = row['STATE'].strip.upcase\n map = {\n /ANDHRAPRADESH/ => 'ANDHRA PRADESH',\n /ANDAMAN/ => 'ANDAMAN AND NICOBAR ISLANDS',\n /BANGALORE/ => 'KARNATAKA',\n /BARDEZ/ => 'GOA',\n /BHUSAWAL/ => 'MAHARASHTRA',\n /BTM/ =... | [
"0.61566496",
"0.54957664",
"0.5107144",
"0.50847465",
"0.50655866",
"0.50299245",
"0.50258386",
"0.50190806",
"0.49883288",
"0.49463448",
"0.4923729",
"0.49154255",
"0.49106652",
"0.4880235",
"0.48780066",
"0.4875654",
"0.48699272",
"0.48149538",
"0.48142216",
"0.47804558",
... | 0.6335567 | 0 |
variant of FisherYates shuffle (ie. not the same as array.shuffle) | def shuffle(ary)
ary_dup = ary.dup
n = ary_dup.length
(0...n).each do |i|
j = rand([i+1, n-1].min...n)
ary_dup[i], ary_dup[j] = ary_dup[j], ary_dup[i]
end
ary_dup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fisher_yates_shuffle(a)\n (a.size-1).downto(1) { |i|\n j = rand(i+1)\n a[i], a[j] = a[j], a[i] if i != j\n }\nend",
"def shuffle array\n array.sort_by {rand}\nend",
"def shuffle array\r\n array.sort_by{rand}\r\nend",
"def shuffle!()\n replace(shuffle)\n end",
"def shuffle( arr... | [
"0.81988597",
"0.8187319",
"0.81493807",
"0.80726475",
"0.8042956",
"0.8033809",
"0.8033809",
"0.80141425",
"0.7907652",
"0.7892968",
"0.7880025",
"0.7859824",
"0.78125584",
"0.7800222",
"0.7797387",
"0.7796596",
"0.77504826",
"0.7715837",
"0.7698569",
"0.76935166",
"0.767469... | 0.7600235 | 23 |
Current monotonic time. Falls back to `now` if monotonic clock is not available. | def get_time
Process.clock_gettime(Process::CLOCK_MONOTONIC)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monotonic_now\n Process.clock_gettime(Process::CLOCK_MONOTONIC)\n end",
"def monotonic_timestamp\n return nil unless @ctx.key?(:monotonic_ts)\n @monotonic_timestamp ||= Time.at(0, @ctx[:monotonic_ts].first)\n end",
"def current_time() ! Int\n typedecl native: \"struct timesp... | [
"0.8743917",
"0.74308574",
"0.7269161",
"0.69769377",
"0.69217545",
"0.69150615",
"0.6903713",
"0.6903713",
"0.68835753",
"0.6719861",
"0.65508837",
"0.65508837",
"0.6545379",
"0.65382904",
"0.65338355",
"0.65326315",
"0.65326315",
"0.6494871",
"0.6490819",
"0.64749783",
"0.6... | 0.60924417 | 36 |
Overrides the implementation of `now with the provided callable. Overriding the method `now` instead of indirectly calling `block` removes one level of method call overhead. | def now_provider=(block)
define_singleton_method(:now, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def now_and_after(interval, &block); end",
"def perform_now(block=nil)\n Thread.current[:name] ||= name\n if defined?(Rails) && defined?(ActiveRecord::Base)\n require 'gb_dispatch/active_record_patch'\n thread_block = ->() do\n if Rails::VERSION::MAJOR < 5\n begin\n ... | [
"0.6436342",
"0.6400366",
"0.6219595",
"0.6107639",
"0.6107639",
"0.61063766",
"0.6079982",
"0.59450626",
"0.59003025",
"0.5799384",
"0.57890356",
"0.57595974",
"0.5705611",
"0.5704033",
"0.5689351",
"0.5653886",
"0.55963176",
"0.55952203",
"0.5577887",
"0.5559095",
"0.551798... | 0.72847354 | 0 |
Pide a calculadora que realize la operacion que correspona y lo guarda en la variable resultado | def guardar_resultado_operacion
@resultado= @@calculadora.send(session[:accion].to_sym, session[:operando1].to_i, session[:operando2].to_i)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oper\n return @oper\n end",
"def calculadora(uno,dos,tres=0, opciones= {})\n if(opciones['suma']==1)\n return uno +dos+tres\n end\n if(opciones['multiplica']==1)\n return uno * dos *tres\n end\ne... | [
"0.68902755",
"0.6855451",
"0.6761989",
"0.67037225",
"0.6534387",
"0.65211356",
"0.6373842",
"0.63648766",
"0.6349596",
"0.6295666",
"0.6271022",
"0.6261488",
"0.6249254",
"0.6243624",
"0.61925805",
"0.61730003",
"0.6171278",
"0.6166066",
"0.61660326",
"0.61485374",
"0.61426... | 0.76522976 | 0 |
Pide a calculdora el numero de operaciones realizadas y lo guarda en la variable cantidad_de_operaciones | def guardar_cantidad_operaciones
@cantidad_de_operaciones= @@calculadora.cantidad_de_operaciones
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def excede_control_de_pago_global()\n @sumatoria_posible_pago_todos_tickets_de_hoy_todos_parlay_global = 0 # inicializacionn de variable sumatoria en cero ok\n #La idea aqui es verificar si la sumatoria de posible pago de todas las jugadas de todos los tipos de tickets activos de hoy no excede el limite glob... | [
"0.6245128",
"0.60649467",
"0.58947015",
"0.5861044",
"0.58594435",
"0.58046174",
"0.57197493",
"0.57137036",
"0.56664795",
"0.5630033",
"0.56127524",
"0.5588779",
"0.5581986",
"0.55630386",
"0.5560865",
"0.55593497",
"0.5537066",
"0.5536677",
"0.55221987",
"0.54859346",
"0.5... | 0.78472704 | 0 |
Assert that the given element has the specified descendent. You can pass any parameters you normally would use during a search, including a block. | def have_descendent kind, filters = {}, &block
Accessibility::HasDescendentMatcher.new kind, filters, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_xpath_in_block(block_selector,xpath)\n within(block_selector) { expect(Capybara.page).to have_xpath xpath.gsub('//','.//') }\nend",
"def entry_should_be_visible(entry)\n expect(page).to have_css \"#feed-entries #entry-#{entry.id}\"\n within \"#feed-entries #entry-#{entry.id}\" do\n expect(page).... | [
"0.62048095",
"0.59218913",
"0.57336515",
"0.5726179",
"0.56906885",
"0.5688467",
"0.5671493",
"0.566063",
"0.5656908",
"0.5656908",
"0.563907",
"0.56290674",
"0.5590942",
"0.5565804",
"0.5485435",
"0.5483954",
"0.54475415",
"0.54122597",
"0.5388215",
"0.5385187",
"0.53376377... | 0.0 | -1 |
search_terms gathers all the search terms that can be used for a show, and returns them as a search string which can be used as part of a twitter search, or any other search | def search_terms
return self.broadcast_list
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_terms\n return @search_terms\n end",
"def get_search_terms(array_of_terms)\n\t\treturn \"q=\"+array_of_terms.join(\"+\")\n\tend",
"def search_terms=(value)\n @search_terms = value\n end",
"def search_all_terms\n render json: Article.with_all_t... | [
"0.7354715",
"0.70221084",
"0.69582593",
"0.693292",
"0.68736655",
"0.6846673",
"0.6807551",
"0.6768223",
"0.6733933",
"0.6716752",
"0.65865743",
"0.6576199",
"0.65385884",
"0.6517051",
"0.64938575",
"0.6454234",
"0.6450491",
"0.64482814",
"0.6426692",
"0.64090914",
"0.640734... | 0.6354503 | 30 |
Scrub sensitive parameters from your log filter_parameter_logging :password Create headers necessary for proper CSV file generation Grabbed from | def render_csv(filename = nil)
filename ||= params[:action]
filename += '.csv'
# String#index returns nil if no match is found
if request.env['HTTP_USER_AGENT'].index("MSIE")
headers['Pragma'] = 'public'
headers["Content-type"] = "text/plain"
headers['Cache-Control'] = 'no-cache,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_c... | [
"0.59509754",
"0.56278473",
"0.5499362",
"0.5499362",
"0.5309971",
"0.522713",
"0.5166511",
"0.5136934",
"0.51233715",
"0.5119223",
"0.51157355",
"0.5108328",
"0.5091525",
"0.50830775",
"0.50697947",
"0.5052021",
"0.5047181",
"0.5047181",
"0.5038717",
"0.50271076",
"0.5006844... | 0.0 | -1 |
Authenticate via HTTP Basic Authentication See TODO: Replace with user database and permission system | def authenticate
if defined?(APPWALL_USERNAME)
authenticate_or_request_with_http_basic do |username, password|
!(APPWALL_USERNAME.blank?) && username == APPWALL_USERNAME &&
Digest::MD5.hexdigest(password) == APPWALL_PASSWORD_HASH
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end",
"def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.bas... | [
"0.80977595",
"0.80769104",
"0.805949",
"0.80448705",
"0.8025938",
"0.80209243",
"0.7968008",
"0.7929057",
"0.79031026",
"0.7891756",
"0.78886425",
"0.7875529",
"0.7872017",
"0.7829166",
"0.77850753",
"0.77527565",
"0.77118963",
"0.770376",
"0.7697415",
"0.7671766",
"0.766198... | 0.73445475 | 45 |
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge by myself. 1. Pseudocode What is the input? we need a function that takes in an array for the second function, I need to bring in an ... | def total(array)
len = array.length
i = 0
sum = 0
while i < len do
sum = sum + array[i]
i = i + 1
end
return sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sentence_maker(array)\n x = 0\n sum = \"\"\n while x <= array.length-1\n sum += array[x].to_s + \" \"\n x += 1\n end\n sum.rstrip!\n sum += \".\"\n sum.capitalize!\n return sum\nend",
"def sentence_maker(array)\n\tx = 0\n\tsum = \"\"\n\twhile x <= array.length-1\n\t\tif x == array.length-1\n\t\... | [
"0.70482147",
"0.6958749",
"0.6840097",
"0.6729646",
"0.65105736",
"0.6494298",
"0.6477166",
"0.6447833",
"0.64155686",
"0.63992393",
"0.6378688",
"0.6363556",
"0.63474286",
"0.6314896",
"0.6292242",
"0.6267711",
"0.62546796",
"0.62525976",
"0.6225813",
"0.6200459",
"0.618821... | 0.5524965 | 74 |
Rejects Punctuation tokens when returning a length | def length
words.reject { |w| w.rel == 'punct' }.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n @tokens.length\n end",
"def description_length\n description&.scan(/\\w+/)\n end",
"def friendly_token(length = T.unsafe(nil)); end",
"def whitespace_token\n return nil unless md=WHITESPACE.match(@chunk)\n input = md.to_a[0]\n input.length\n end",
"def length_term\n se... | [
"0.65038246",
"0.64720035",
"0.6195816",
"0.6106345",
"0.6062289",
"0.5999073",
"0.59017915",
"0.5892887",
"0.58928585",
"0.5868613",
"0.58191645",
"0.58191645",
"0.58191645",
"0.58191645",
"0.5803032",
"0.5770072",
"0.57592046",
"0.5744819",
"0.57405704",
"0.57310694",
"0.57... | 0.68768394 | 0 |
Appends a word to the +words+ array | def <<(obj)
@words << obj
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def <<(word)\n @words << word\n end",
"def <<(word)\n @words << word\n end",
"def <<(word)\n @words << word\n end",
"def add(word)\n return if word.nil? || word.strip == ''\n\n @words.push(word)\n end",
"def add_words(new_words)\n new_words.each do ... | [
"0.78897953",
"0.78897953",
"0.7872797",
"0.7713456",
"0.7592",
"0.75386935",
"0.7429161",
"0.739379",
"0.7197099",
"0.71905637",
"0.7109573",
"0.704745",
"0.6997091",
"0.69763845",
"0.69346124",
"0.69337285",
"0.6927989",
"0.69207186",
"0.68848675",
"0.6879656",
"0.6879656",... | 0.6821013 | 26 |
Returns true if any of the words are =~ to any pattern in +pattns+ | def contains?(*pattns)
pattns.any? do |pattn|
words.any? { |wor| wor =~ pattn }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_words_valid? set\n (set & DICTIONARY) == set\n end",
"def contains_any(str, fragments)\r\n return false unless Regexp.union(fragments) =~ str\r\n true\r\n end",
"def includes_all_words?(string, query)\n words = parse_words(string)\n query.all? { |pattern| words.any? { |wo... | [
"0.60240936",
"0.599133",
"0.58521",
"0.58229584",
"0.5788031",
"0.5763833",
"0.57539254",
"0.5725612",
"0.56511915",
"0.56277853",
"0.559345",
"0.5588591",
"0.5578201",
"0.5559298",
"0.5547917",
"0.55202276",
"0.54812884",
"0.54661536",
"0.54473966",
"0.543601",
"0.54346716"... | 0.8311684 | 0 |
Checkes a sentence using +label+ and +check_ptn+ as search terms. Returns an array of all words whose matching label matches the check pattern exactly. | def [](label, check_ptn)
rgx = check_ptn.is_a?(Regexp) ? check_ptn : Regexp.new("\\b#{check_ptn}\\b", Regexp::IGNORECASE)
find_all { |w| w.method(label.to_sym).call =~ rgx }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_word_results(word, label=nil)\n return [word]\n end",
"def bank_valid_word_match(yes)\n if yes == true\n array1 << @word\n else nil\n end\n end",
"def probability_tokens_are_label(tokens, label)\n prob_label = @doc_counts[label].to_f / @doc_counts.values.reduce(:+)... | [
"0.5512748",
"0.51057065",
"0.49927118",
"0.49422702",
"0.4864749",
"0.48597398",
"0.48549086",
"0.48541942",
"0.48188877",
"0.47562486",
"0.4745544",
"0.47435427",
"0.47246033",
"0.4708957",
"0.4707109",
"0.47038686",
"0.46423495",
"0.46160355",
"0.46160355",
"0.46160355",
"... | 0.71409017 | 0 |
Checks against a Regex | def =~(pat)
to_s =~ pat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matches regex\n msg = \"#{self} did not match regex #{regex}\"\n check_if self.match(regex), msg\n end",
"def check_regex value, validator\n return unless regexp? value\n\n regex = value.value\n unless secure_regex?(regex)\n warn :model => @current_model,\n :warning_type => \"Format... | [
"0.78274274",
"0.76050174",
"0.73029745",
"0.7270238",
"0.7253927",
"0.7234907",
"0.7146553",
"0.7019732",
"0.6969272",
"0.6965571",
"0.6927705",
"0.68519384",
"0.68483484",
"0.6837281",
"0.68345016",
"0.67612743",
"0.67612743",
"0.67594665",
"0.67173463",
"0.66916394",
"0.66... | 0.0 | -1 |
Returns the root of the sentence, i.e. the word for which Wordroot? is true | def root
words.find(&:root?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def root\n return @notes.find { |note| note.part == :root } || self.low_note\n end",
"def root\n\t\t\t\tfind_root[0].to_s\n\t\t\tend",
"def get_root(doc)\n doc.children.first\n end",
"def find_word(word, node = @root)\n if word == \"\" && node.end_of_word\n return node\n else\n ... | [
"0.6442374",
"0.634661",
"0.61090434",
"0.6084215",
"0.60642225",
"0.6001387",
"0.5975422",
"0.5931515",
"0.58916414",
"0.5822233",
"0.58148456",
"0.58148456",
"0.5797857",
"0.5786353",
"0.5781708",
"0.57643455",
"0.57484645",
"0.5734681",
"0.5726937",
"0.5716607",
"0.5690607... | 0.85579133 | 0 |
Syntactic sugar, returns all for whom pos == 'VERB' | def verbs
pos 'VERB'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verb\n words.find { |wor| wor.pos == 'VERB' }\n end",
"def get_verbs\n @verbs ||= self.verbs\n end",
"def find(any_verb_form)\n end",
"def poss\r\n Pronouns.get_pronoun_set(@object)[2]\r\n end",
"def verbs\n (@verb.downcase.presence || 'get').split('|')\n end",
"def... | [
"0.73388493",
"0.56128216",
"0.5603956",
"0.5497395",
"0.5366134",
"0.5327903",
"0.5291551",
"0.5257211",
"0.52530867",
"0.52502364",
"0.5248232",
"0.5221836",
"0.51428753",
"0.5086025",
"0.50672656",
"0.50313514",
"0.48792884",
"0.4832317",
"0.48233107",
"0.48141584",
"0.481... | 0.7354318 | 0 |
Syntactic sugar, returns first for whom pos == 'VERB' | def verb
words.find { |wor| wor.pos == 'VERB' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verbs\n pos 'VERB'\n end",
"def pos(part_of_speech)\n case part_of_speech\n when 'noun'\n 'n'\n when 'adjective'\n 'adj'\n when 'verb'\n 'v'\n when 'adverb'\n 'adv'\n when 'interjection'\n 'interj'\n when 'pronoun'\n 'pron'\... | [
"0.6495975",
"0.56146634",
"0.5565094",
"0.5427241",
"0.5333361",
"0.5201015",
"0.51739365",
"0.51293117",
"0.50837517",
"0.50202036",
"0.5010757",
"0.500381",
"0.49677983",
"0.49669707",
"0.4965593",
"0.4955615",
"0.48998225",
"0.48838037",
"0.4863609",
"0.4845937",
"0.48301... | 0.75374943 | 0 |
Syntactic sugar, returns all for whom xpos == 'NNP' | def propn
xpos 'NNP'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_neigbouring_positions(pos)\n [ pos1(pos), pos2(pos), pos3(pos), pos4(pos), pos5(pos), pos6(pos), pos7(pos), pos8(pos) ]\n end",
"def poss\r\n Pronouns.get_pronoun_set(@object)[2]\r\n end",
"def filter_neighbouring_positions(pos)\n all_neighbouring_positions = get_neigbouring_po... | [
"0.57237256",
"0.5484254",
"0.52900344",
"0.52778435",
"0.5143564",
"0.50799733",
"0.50577146",
"0.49796987",
"0.49511892",
"0.4948112",
"0.48622158",
"0.48527288",
"0.48420796",
"0.48028588",
"0.47971863",
"0.47892818",
"0.4752853",
"0.4714758",
"0.47103077",
"0.46859023",
"... | 0.6289171 | 0 |
Syntactic sugar, returns all for whom rel == 'dobj' | def dobj
rel 'dobj'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reflections_for(main, rel)\n main.class\n .reflect_on_all_associations\n .select { |r| r.macro == rel && r.options[:through].nil? }\n end",
"def reflections_with_same_predicate\n owner.class.outgoing_reflections.select { |_k, v| v.options[:predicate] == reflection.predicate }\n ... | [
"0.5846502",
"0.56711143",
"0.56711143",
"0.56470454",
"0.55943716",
"0.5487393",
"0.54529786",
"0.54487085",
"0.5420371",
"0.53827643",
"0.53563076",
"0.53288794",
"0.5268372",
"0.5253887",
"0.5237315",
"0.5224011",
"0.5190747",
"0.5165359",
"0.51559955",
"0.51546025",
"0.51... | 0.58981454 | 0 |
Syntactic sugar, returns all for whom rel == 'pobj' | def pobj
rel 'pobj'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instances_relating_to(obj)\n relationships.map {|relationship_defn|\n relationship_defn.who_participates_with(obj)\n }.flatten\n end",
"def reflections_with_same_predicate\n owner.class.outgoing_reflections.select { |_k, v| v.options[:predicate] == reflection.predicate }\n ... | [
"0.6057089",
"0.5451318",
"0.5451318",
"0.5416328",
"0.53945756",
"0.53875786",
"0.537066",
"0.5287987",
"0.52475053",
"0.52447575",
"0.5239484",
"0.5199983",
"0.5162233",
"0.5142594",
"0.5116733",
"0.51095855",
"0.5103477",
"0.5085364",
"0.5084086",
"0.5073739",
"0.5069822",... | 0.6264853 | 0 |
Syntactic sugar, returns dobj | pobj | def obj
[dobj, pobj]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pobj\n rel 'pobj'\n end",
"def dobj\n rel 'dobj'\n end",
"def __getobj__; end",
"def handle_return_object(obj, pid = @my_pid)\n #Dont proxy these objects.\n return obj if obj.is_a?(TrueClass) || obj.is_a?(FalseClass) || obj.is_a?(NilClass)\n\n #The object is a proxy-obj - just re... | [
"0.62386245",
"0.58109045",
"0.554093",
"0.5450882",
"0.5436784",
"0.54072815",
"0.54058516",
"0.5387127",
"0.5335513",
"0.53212535",
"0.5289151",
"0.52800816",
"0.52800816",
"0.52800816",
"0.52800816",
"0.52800816",
"0.52800816",
"0.5275629",
"0.52572626",
"0.5247279",
"0.52... | 0.7008171 | 0 |
Syntactic sugar, returns all for whom rel == 'nsubj' | def nsubj
rel 'nsubj'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relation_subjects(record)\n query = ActiveFedora::SolrQueryBuilder.construct_query_for_rel(\n [[:has_model, proxy_class.to_rdf_representation], [:proxyFor, record.id]]\n )\n rows = ActiveFedora::SolrService::MAX_ROWS\n ActiveFedora::SolrService.query(query, fl: 'id', rows: ... | [
"0.5591121",
"0.5303989",
"0.52504563",
"0.5234975",
"0.5190148",
"0.5166306",
"0.5158945",
"0.5118511",
"0.5086068",
"0.5077033",
"0.5057944",
"0.50241095",
"0.49789515",
"0.4969913",
"0.49536195",
"0.49135166",
"0.48863754",
"0.48452234",
"0.4837292",
"0.4835951",
"0.482494... | 0.72625345 | 0 |
Syntactic sugar, returns true if any Word tokens do on pos == 'CONJ' | def conj?
words.any? { |wor| wor.pos == 'CONJ' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_conjunction?(language)\n pos == 'J' || xpos == ',' || lemma == ',' || CONJUNCTIONS[language]&.include?(lemma)\n end",
"def starts_with_consonant? s\n if s.empty?\n return false\n else\n stopwords = 'AEIOUaeiou0123456789$*~&!@#$%^()-=+/\\?,.'\n stopwords.each_char{|c|\n retu... | [
"0.64800286",
"0.62453324",
"0.613549",
"0.6073705",
"0.604623",
"0.58967733",
"0.5881221",
"0.58807606",
"0.58645403",
"0.58435726",
"0.58282137",
"0.57972664",
"0.5773296",
"0.57692707",
"0.5766831",
"0.5766831",
"0.5764056",
"0.57621837",
"0.57359666",
"0.5727208",
"0.5718... | 0.82561564 | 0 |
Syntactic sugar, returns all for whom pos == 'CONJ' | def conj
pos 'CONJ'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conj?\n words.any? { |wor| wor.pos == 'CONJ' }\n end",
"def poss( syn )\n cod = SITE_SYNONYMITY[nuc_codon.join]\n return [] unless cod\n\n pos_codon\n .zip(cod.split(\"\"))\n .select{|p| p.last == (syn=='syn' ? 's' : 'n')}\n .map(&:first)\n end",
"def is_conjunction?(langua... | [
"0.5951801",
"0.51972556",
"0.48890087",
"0.4666265",
"0.45936424",
"0.45654082",
"0.45494336",
"0.45227146",
"0.4520281",
"0.45092985",
"0.4506853",
"0.45051283",
"0.44807485",
"0.44757652",
"0.4473304",
"0.4445482",
"0.4417346",
"0.4415051",
"0.44127688",
"0.439447",
"0.438... | 0.52273834 | 1 |
Returns an array of all words whose parent are the provided word +wrd+ | def children_of(wrd)
self['head', wrd]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query(word)\n node = @the_node\n results = []\n word.split(\"\").each do |letter|\n next_node = node[letter]\n if next_node != nil\n node = next_node\n next\n else\n return ['']\n end\n end\n results << Word.new(word, node.final)\n... | [
"0.66967887",
"0.6059656",
"0.59648263",
"0.5944282",
"0.59350973",
"0.5920519",
"0.5902208",
"0.58722615",
"0.58652836",
"0.5838965",
"0.5819778",
"0.5794946",
"0.5776685",
"0.57361245",
"0.5643774",
"0.56382066",
"0.56322086",
"0.56157905",
"0.55943793",
"0.5593986",
"0.554... | 0.51807564 | 55 |
GET /searches GET /searches.json | def index
@results = {}
if TeSS::Config.solr_enabled
SEARCH_MODELS.each do |model_name|
model = model_name.constantize
@results[model_name.underscore.pluralize.to_sym] = Sunspot.search(model) do
fulltext search_params
with('end').greater_than(Time.zone.now) if model_n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @searches = @website.searches.all\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @searches }\n end\n end",
"def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render js... | [
"0.7737936",
"0.7604427",
"0.75483096",
"0.71530956",
"0.7150144",
"0.7135791",
"0.70674586",
"0.70497304",
"0.69962347",
"0.6986162",
"0.6971139",
"0.6954953",
"0.6952561",
"0.69155294",
"0.69155294",
"0.69155294",
"0.69155294",
"0.69155294",
"0.68742293",
"0.68722004",
"0.6... | 0.0 | -1 |
depends_on "cmake" => :build | def install
# Get rid of the JRE directory so it'll use the system JRE
system "rm", "-rf", "jre"
# There's probably a more correct way to do this
system "cp", "-a", ".", "#{libexec}"
# Link in the actual commands
bin.install_symlink "../libexec/SMCIPMITool"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def package_depends_on\n depends_on\n end",
"def install\n# Dependency tracking only, uncomment this section only if you know what you\n# are doing!\n#\n# mkdir 'build'\n# cd 'build' do\n# system \"cmake .. #{std_cmake_parameters}\"\n# system \"make package\"\n# end\nend",
"def ... | [
"0.6862918",
"0.67779785",
"0.6605081",
"0.6427604",
"0.6401638",
"0.6370821",
"0.62428576",
"0.6164104",
"0.6164104",
"0.6134335",
"0.6026515",
"0.6026515",
"0.6026515",
"0.594891",
"0.59437174",
"0.5839825",
"0.5780695",
"0.5748207",
"0.57473993",
"0.57118607",
"0.56998265"... | 0.0 | -1 |
Sends a lean json that has all of the convention names matching the query string | def client_search
@conventions = Convention.where("lower(name) LIKE lower(?)" , "%" + params[:query] + "%")
if @conventions.empty?
render json: {}
else
results = {}
results[:conventions] = @conventions.as_json
render json: results
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_index\n\t\tquery = begin\n\t\t\tparams.permit(:query).fetch(:query)\n\t\trescue\n\t\t\t''\n\t\tend\n\t\tusers = User.where('LOWER(nickname) LIKE LOWER(:query)', query: \"%#{query}%\")\n\t\trender json: users.map(&:name)\n\tend",
"def cugs_names_with_aliases\n channels = Channel.includes(:channel_alia... | [
"0.59236676",
"0.56349504",
"0.55736065",
"0.55587494",
"0.55344206",
"0.5470266",
"0.5463156",
"0.54621226",
"0.5401557",
"0.5400449",
"0.53835297",
"0.538044",
"0.53698206",
"0.53380054",
"0.5328156",
"0.53151196",
"0.5308778",
"0.53002423",
"0.52931523",
"0.52893215",
"0.5... | 0.70719606 | 0 |
This method is not thread safe, never call from multiple threads at once. | def recv_msg(codec, last: false, limit_size: nil)
data = @transport.read_data(last: last)
raise StopIteration if data.nil?
compressed, size, buf = *data
unless size == buf.size
raise "inconsistent data: #{buf}"
end
if limit_size && size > limit_size
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def lock; end",
"def lock; end",
"def lock; end",
"def pausable; end",
"def synchronized?; end",
"def prepareForReuse; end",
"def sync; end",
"def thread()\n #This is a stub, used for indexing\n end",
"def io_lock; end",
"def sync() end",
"def sync() end"... | [
"0.68606436",
"0.66234833",
"0.66234833",
"0.66234833",
"0.6308199",
"0.6131284",
"0.60578114",
"0.602662",
"0.6021089",
"0.5940466",
"0.59268814",
"0.59268814",
"0.59268814",
"0.5910843",
"0.5885751",
"0.5861754",
"0.5861754",
"0.5861754",
"0.577901",
"0.57099396",
"0.570993... | 0.0 | -1 |
This is called a GETTER or accessor method | def sugar
@sugar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getters; end",
"def get()\n \n end",
"def get\n raise NotImplementedError\n end",
"def get\n end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def get\n ... | [
"0.7931055",
"0.7899146",
"0.73996574",
"0.71710694",
"0.7146903",
"0.7146903",
"0.7146903",
"0.7146903",
"0.7146903",
"0.7146903",
"0.7146903",
"0.71017694",
"0.7080671",
"0.6952151",
"0.6893114",
"0.68408406",
"0.6758642",
"0.6758642",
"0.6690974",
"0.6652584",
"0.65777177"... | 0.0 | -1 |
This is called a SETTER method | def sugar=(new_amount)
@sugar = new_amount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set; end",
"def set; end",
"def __setter__\n \"#{self}=\"\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def _setter_method\n :\"_#{self[:name]}=\"\n end",
"def set(value)\n raise NotImplementedError\n end",
"def setter_method\n ... | [
"0.78790313",
"0.78790313",
"0.7761794",
"0.74552095",
"0.72910273",
"0.71641415",
"0.71362877",
"0.7114041",
"0.70998836",
"0.70299774",
"0.7004982",
"0.7004982",
"0.69458926",
"0.6870727",
"0.6825076",
"0.6823138",
"0.68170965",
"0.680213",
"0.6800568",
"0.67122173",
"0.658... | 0.0 | -1 |
validates :tag_name, presence: true | def save_tag(sent_tags)
current_tags = self.tags.pluck(:tag_name) unless self.tags.nil?
old_tags = current_tags - sent_tags
new_tags = sent_tags - current_tags
old_tags.each do |old|
self.tags.delete PostTag.find_by(tag_name: old)
end
new_tags.each do |new|
new_tag = Tag.find_or_cr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate\n name = params[:tag].downcase\n\n tag = ActsAsTaggableOn::Tag.where(\"name= ?\", name)[0]\n if tag == nil\n tag = ActsAsTaggableOn::Tag.new\n tag.name = name\n if tag.valid?\n head :no_content\n else\n respond_with tag.errors, status: :unprocessable_enti... | [
"0.80053717",
"0.775427",
"0.71844774",
"0.71844774",
"0.71844774",
"0.7093963",
"0.7082573",
"0.7082573",
"0.7082573",
"0.7082573",
"0.7082573",
"0.7082573",
"0.70716673",
"0.703705",
"0.6724174",
"0.6683121",
"0.6667297",
"0.6644221",
"0.66078687",
"0.6603597",
"0.6558105",... | 0.0 | -1 |
print palindrome?("A man, a plan, a canal Panama") print "\n" print palindrome?("Abracadabra") print "\n" | def count_words(string)
# your code here
ret = {}
s = string.downcase
s.split(/\b/).each do |w|
if w =~ /\w/
if ret[w]
ret[w] += 1
else
ret[w] = 1
end
end
end
return ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindromo?(palavra)\n palavra.downcase == palavra.downcase.reverse\nend",
"def is_palindrome = 'racecar'",
"def palindrome2? word\n word.downcase.reverse == word.downcase \nend",
"def real_palindrome?(werd)\n werd.delete(\" \").gsub(/[^A-Za-z0-9 ]/, '').downcase == werd.delete(\" \").gsub(/[^A-Za-z... | [
"0.83495194",
"0.8282438",
"0.8192849",
"0.81628025",
"0.8129946",
"0.81188256",
"0.8113344",
"0.8102868",
"0.80813193",
"0.80750304",
"0.80678517",
"0.8066512",
"0.8034075",
"0.8015915",
"0.80147284",
"0.8010109",
"0.7996088",
"0.7971865",
"0.7971651",
"0.79666543",
"0.79666... | 0.0 | -1 |
GET /sub_regions/1 GET /sub_regions/1.xml | def show
@sub_region = SubRegion.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @sub_region }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def regions\n client.get_stats('/stats/regions')\n end",
"def index\n @regions = parent.regions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @regions }\n format.js\t { render :partial => 'list', :layout => false }\n end\n end",
"def new\... | [
"0.65240276",
"0.63415504",
"0.6245345",
"0.6104802",
"0.6075268",
"0.6012216",
"0.6001311",
"0.5895825",
"0.5837433",
"0.5837433",
"0.5789",
"0.5768533",
"0.5766695",
"0.574577",
"0.573878",
"0.5731467",
"0.5707708",
"0.5687866",
"0.5651625",
"0.5648759",
"0.56462854",
"0.... | 0.71438354 | 0 |
GET /sub_regions/new GET /sub_regions/new.xml | def new
@sub_region = SubRegion.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @sub_region }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @region = parent.regions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @region }\n end\n end",
"def create\n @sub_region = SubRegion.new(params[:sub_region])\n\n respond_to do |format|\n if @sub_region.save\n flash[:no... | [
"0.75175214",
"0.7169571",
"0.7034446",
"0.69812286",
"0.65851486",
"0.650677",
"0.6499917",
"0.6199601",
"0.61799294",
"0.6177643",
"0.6176132",
"0.61567336",
"0.6107419",
"0.60777605",
"0.6066695",
"0.60646105",
"0.60386646",
"0.6028977",
"0.5993601",
"0.599032",
"0.5965853... | 0.7840067 | 0 |
POST /sub_regions POST /sub_regions.xml | def create
@sub_region = SubRegion.new(params[:sub_region])
respond_to do |format|
if @sub_region.save
flash[:notice] = 'SubRegion was successfully created.'
format.html { redirect_to(@sub_region) }
format.xml { render :xml => @sub_region, :status => :created, :location => @sub_r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @sub_region = SubRegion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sub_region }\n end\n end",
"def new\n @region = parent.regions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xm... | [
"0.58583236",
"0.5596696",
"0.5564836",
"0.55339694",
"0.54140383",
"0.5400482",
"0.53550875",
"0.53378963",
"0.5335684",
"0.5322265",
"0.5277518",
"0.51168597",
"0.5095649",
"0.5069241",
"0.5065713",
"0.50213474",
"0.501562",
"0.5003791",
"0.5001528",
"0.49951863",
"0.499448... | 0.65998167 | 0 |
PUT /sub_regions/1 PUT /sub_regions/1.xml | def update
@sub_region = SubRegion.find(params[:id])
respond_to do |format|
if @sub_region.update_attributes(params[:sub_region])
flash[:notice] = 'SubRegion was successfully updated.'
format.html { redirect_to(@sub_region) }
format.xml { head :ok }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n if params[:cancel_button]\n redirect_to redirect_url\n else\n @region = Region.find(params[:id])\n\n respond_to do |format|\n if @region.update_attributes(params[:region])\n ... | [
"0.62135667",
"0.60779744",
"0.60396034",
"0.6009849",
"0.59625745",
"0.59190273",
"0.5852342",
"0.5820756",
"0.57055086",
"0.5650062",
"0.5586607",
"0.5581159",
"0.5573451",
"0.55411744",
"0.55104274",
"0.55051893",
"0.55051893",
"0.55051893",
"0.5488593",
"0.5481674",
"0.54... | 0.7076273 | 0 |
DELETE /sub_regions/1 DELETE /sub_regions/1.xml | def destroy
@sub_region = SubRegion.find(params[:id])
@sub_region.destroy
respond_to do |format|
format.html { redirect_to(sub_regions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @region = parent.regions.find(params[:id])\n @region.destroy\n \n options = {}\n redirect_url = send(\"#{ parent_type }_regions_url\", parent, options)\n\n respond_to do |format|\n format.html { redirect_to redirect_url }\n format.xml { head :ok }\n end\n end",
"def... | [
"0.67831045",
"0.6459824",
"0.630416",
"0.6197759",
"0.61095524",
"0.6067233",
"0.60413945",
"0.602256",
"0.5990561",
"0.59121007",
"0.58985645",
"0.58984095",
"0.58208686",
"0.58098537",
"0.5773313",
"0.57578605",
"0.5743464",
"0.5741289",
"0.57341814",
"0.5701305",
"0.56932... | 0.732804 | 0 |
Used by the AIX provider to set fstype to nil. TODO use property to make nil a valid value for fstype | def clear_fstype
@fstype = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type; nil end",
"def type; nil end",
"def type\n nil\n end",
"def set_nil!\n @objects = nil\n @memory = nil\n\n self[:type] = :nil\n end",
"def reset\n self.instance_variables.each do |name|\n if name!= :@type\n instance_variable_set(name,NIL)\n ... | [
"0.6262361",
"0.6262361",
"0.61531633",
"0.60600364",
"0.6016163",
"0.59712756",
"0.58636093",
"0.5853525",
"0.57409245",
"0.5712987",
"0.5571789",
"0.5558108",
"0.5548572",
"0.54814506",
"0.5449989",
"0.54298264",
"0.53674966",
"0.5315482",
"0.53141356",
"0.53141356",
"0.530... | 0.7155801 | 1 |
puts threed([1, 3, 2, 3, 4, 3]) true puts threed([3, 3, 3]) false puts threed([1, 3, 2, 3, 4]) false puts threed([1, 3, 2, 3, 4, 3, 5, 3, 6]) false | def same_first_last(list)
if list.size - 1 == 0
return false
elsif list[list.size - 1] == list[0]
return true
else
return false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threed(list)\n hasthree = 0\n inarow = 0\n list.size.times do |i|\n if list[i] == 3\n hasthree += 1\n end\n if list[i] == 3 && list[i+1] == 3 && i != (list.size - 1)\n inarow += 1\n end\n end\n if hasthree == 3 && inarow == 0\n return true... | [
"0.69840103",
"0.68926567",
"0.66847026",
"0.66781116",
"0.64849305",
"0.6458903",
"0.63806826",
"0.62491155",
"0.6092743",
"0.60900015",
"0.60806143",
"0.60787946",
"0.60626894",
"0.60573566",
"0.60488003",
"0.6039301",
"0.60299486",
"0.60264605",
"0.6025332",
"0.6023884",
"... | 0.0 | -1 |
puts same_first_last([3]) false puts same_first_last([3, 3]) true puts same_first_last([3, 1, 4]) false | def get_sandwich(str)
new_str = ""
(str.size - 4).times do |ingred|
slice = str[ingred..(ingred + 4)]
if slice == "bread"
new_str = str[str.index(slice) + 5..str.rindex(slice) - 1]
end
end
return new_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def same_first_last(list) # done\n if list.size < 1\n return false\n end\n\n if list[0] != list[list.size - 1]\n return false\n end\n \n return true\nend",
"def same_firstlast(list)\n last = list.length - 1\n if list[0] == list[last] && list.length > 0\n return true\n... | [
"0.854472",
"0.8447193",
"0.84406865",
"0.8406333",
"0.835857",
"0.83241224",
"0.8297396",
"0.82603365",
"0.8110511",
"0.74602383",
"0.74035954",
"0.6704887",
"0.6696197",
"0.6631217",
"0.6621892",
"0.65179735",
"0.6460244",
"0.6441527",
"0.64402664",
"0.6427948",
"0.6420955"... | 0.0 | -1 |
puts count_code("code") 1 puts count_code("slurmp") 0 puts count_code("codeslurmpcoae") 2 | def middle_way(list_1, list_2)
meds = []
med_1 = median(list_1)
med_2 = median(list_2)
meds[0] = med_1
meds[1] = med_2
return meds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_code(str)\n\n\n\nend",
"def count_code(string)\n count = 0\n empty = []\n (string.size - 3).times do |i|\n slice = string[i..(i + 3)]\n if slice == \"code\" \n count += 1\n end\n end\n return count \nend",
"def count_code(str)\n times = 0\n str.size.times do |... | [
"0.83802074",
"0.7770099",
"0.7496569",
"0.74249643",
"0.71690714",
"0.7098187",
"0.6906856",
"0.6835594",
"0.6835594",
"0.68291724",
"0.6733388",
"0.6700918",
"0.6692391",
"0.6654709",
"0.66449136",
"0.65938526",
"0.6589639",
"0.6589639",
"0.65676475",
"0.6564094",
"0.656017... | 0.0 | -1 |
print middle_way([1, 2, 3], [2, 3, 4]) [2, 3] | def either_2_4(list)
count = 0
i = 0
list.each do |num|
if num == 2 && count == 0
if num == list[i + 1]
count += 2
end
elsif num == 4 && count == 0
if num == list[i + 1]
count += 1
end
elsif num == 4 && c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def middle_way(list1, list2)\n mid = list1.size / 2 \n mid2 = list2.size / 2\n return [list1[mid], list2[mid2]]\nend",
"def middle_way(list1, list2) #return list with middle of lists (assume both lists have odd number of elements)\n return [list1[list1.size/2], list2[list2.size/2]]\nend",
"def midd... | [
"0.7805204",
"0.77574867",
"0.7618423",
"0.7549899",
"0.71323",
"0.7060405",
"0.6780242",
"0.6666658",
"0.64621574",
"0.6279425",
"0.6143309",
"0.6134631",
"0.6105639",
"0.606992",
"0.60556155",
"0.5998023",
"0.5975474",
"0.59623504",
"0.59430605",
"0.59303313",
"0.589828",
... | 0.0 | -1 |
puts either_2_4([1, 2, 2, 3]) true puts either_2_4([1, 4, 4, 3]) true puts either_2_4([2, 2, 3, 4, 4]) false puts either_2_4([1, 2, 3, 4]) false | def g_happy(str)
i = 0
count = 0
str.size.times do |letter|
if str[letter] == "g"
if str[letter] != str[i + 1]
if str[letter] != str[i - 1]
return false
end
end
else
count += 1
end
i += 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def either_2_4(list)",
"def either_2_4(list)\n i = 0\n four = false\n two = false\n\n while i < list.size\n if four == true && list[i] == 2 && list[i + 1] == 2\n return false\n elsif four == false && list[i] == 2 && list[i + 1] == 2\n two = true\n end\n ... | [
"0.74117625",
"0.72169477",
"0.71933067",
"0.7122585",
"0.706466",
"0.70202583",
"0.69398874",
"0.6840391",
"0.6350044",
"0.63376445",
"0.62931204",
"0.62539434",
"0.62285346",
"0.6226663",
"0.6207392",
"0.62060726",
"0.6180335",
"0.6176909",
"0.6154574",
"0.6114339",
"0.6087... | 0.0 | -1 |
puts g_happy("agga") true puts g_happy("aggagga") true puts g_happy("aga") false puts g_happy("aggaga") false puts g_happy("happy") false puts g_happy("gaggag") false | def merge(list_1, list_2)
com_list = list_1 + list_2
new_list = list_1 + list_2
i_2 = 0
new_list.each do |a|
i = 0
new_list.each do |b|
if a >= b
new_list[i_2] = com_list[i]
end
i += 1
end
i_2 += 1
end
return new... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def good_guess?(n)\n if n == 42\n puts true\n else\n puts false\n end\nend",
"def good_guess?(n)\n if n == 42\n puts true\n else\n puts false\n end\nend",
"def good_guess?(num)\n\n if num == 42\n puts 'true'\n else\n puts 'false'\n end\nend",
"def happy?\nif @happiness >... | [
"0.666297",
"0.666297",
"0.6641086",
"0.66350305",
"0.6533095",
"0.6512145",
"0.6381918",
"0.637181",
"0.63699055",
"0.6363481",
"0.6334466",
"0.6332244",
"0.6274382",
"0.6274116",
"0.6268053",
"0.62624687",
"0.62595373",
"0.62557936",
"0.62488073",
"0.6224275",
"0.622084",
... | 0.0 | -1 |
print merge([1, 2, 8], [4, 9, 10]) [1, 2, 4, 8, 9, 10] | def can_balance(list)
i = 0
list.each do |a|
left = 0
right = 0
i2 = 0
list.each do |b|
if i2 <= i
left += b
else
right += b
end
i2 += 1
if left == right
return true
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge(list) \n\t\treturn list if list.length <= 1\n\n\t\tlen = list.length/2\n\t\tleft = list.slice(0, len)\n\t\tright = list.slice(len, list.length)\n\n\t\tfuse(merge(left), merge(right))\n\tend",
"def merge(list1, list2) #given 2 lists, return a list in ascending order\n return (list1+list2).sort # easy... | [
"0.7602364",
"0.75980103",
"0.74097824",
"0.7385873",
"0.73580277",
"0.7355523",
"0.72876585",
"0.7287656",
"0.72557634",
"0.7250391",
"0.720302",
"0.71648633",
"0.7163732",
"0.7163732",
"0.7163732",
"0.7132782",
"0.7119296",
"0.7108377",
"0.71070796",
"0.709613",
"0.70701015... | 0.0 | -1 |
puts can_balance([7, 4, 3]) true puts can_balance([8, 1, 2]) false | def shift_left(list)
i = 0
shifted = []
save = []
save[0] = list[0]
list.each do |num|
if i == 0
else
shifted[i - 1] = num
end
i += 1
end
shifted[list.size - 1] = save[0]
return shifted
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_balance(list)\n\nend",
"def balance(list)\n if list.size % 2 == 1 \n return false\n elsif list.size % 2 == 0\n return true\n end\nend",
"def can_balance(list)\n i = 0\n list.each do |n|\n left = 0\n right = 0\n i2 = 0\n list.each do |z|\n ... | [
"0.8059355",
"0.7559248",
"0.75491565",
"0.7523306",
"0.74983776",
"0.74614733",
"0.74361706",
"0.72408634",
"0.72387046",
"0.7206216",
"0.69851243",
"0.67917645",
"0.6679442",
"0.6677551",
"0.6663146",
"0.65783113",
"0.64767206",
"0.63966733",
"0.6395561",
"0.63803905",
"0.6... | 0.0 | -1 |
The report filename is test_name + measure_mode + report_type | def report_filename(printer, measure_mode)
suffix =
case printer
when RubyProf::FlatPrinter; 'flat.txt'
when RubyProf::GraphPrinter; 'graph.txt'
when RubyProf::GraphHtmlPrinter; 'graph.html'
when RubyProf::CallTreePrinter; 'tree.txt'
else printer.to_s.down... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n @report ||= \"#{RESULTS_DIR}/#{GROUP_NAME}-#{Time.now.strftime \"%d-%m-%Y-%H%M\"}.yaml\"\nend",
"def report_filename_for(title, variant=nil)\n return File.join(@reports_dir, \"#{title}#{variant ? '_'+variant.to_s : ''}_with_#{@tag}.log\")\n end",
"def make_file_name(proposal, type='paltrack')... | [
"0.66287595",
"0.6612264",
"0.6515173",
"0.64662373",
"0.6404217",
"0.63314986",
"0.6264283",
"0.6263172",
"0.62331873",
"0.62118137",
"0.62075824",
"0.61951697",
"0.6182138",
"0.61444104",
"0.60826206",
"0.6080401",
"0.6069934",
"0.60583526",
"0.60413134",
"0.59962475",
"0.5... | 0.71269387 | 0 |
Helper method for loading breweries for each state. Called in state loader CAREFUL: THIS HITS API ONCE FORE EACH STATE. 400 REQUEST LIMIT PER DAY | def load_breweries_per_capita(state)
@per_capita_hash[state]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seed_breweries\n @states.each do |state|\n # Loads brewery data from API\n state_brewery_hash = get_state_breweries(state.name)\n state_brewery_hash.each do |brewery|\n # Create city first if doesn't exist\n city_name = brewery[:locality]\n\n # Check in case city is not prov... | [
"0.68559444",
"0.6625805",
"0.65360427",
"0.62255895",
"0.5776834",
"0.5714861",
"0.57075065",
"0.5662059",
"0.5559842",
"0.55437183",
"0.55437183",
"0.5493841",
"0.5478758",
"0.54399085",
"0.5417121",
"0.54135317",
"0.54094034",
"0.53793424",
"0.5357828",
"0.53247213",
"0.53... | 0.6509406 | 3 |
Tests the sub_total calculation and that setting it manually doesn't modify the data. | def test_credit_note_sub_total_calculation
credit_note = create_test_credit_note
line_item = credit_note.line_items.first
# Make sure that everything adds up to begin with.
expected_sub_total = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.line_amount }
assert_equal(expected_sub_tot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_credit_note_sub_total_calculation2\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expec... | [
"0.7463627",
"0.73156714",
"0.72838926",
"0.7278757",
"0.7123067",
"0.7114474",
"0.6996909",
"0.69958496",
"0.6943258",
"0.6932367",
"0.6862244",
"0.68544084",
"0.68374956",
"0.6818632",
"0.68147624",
"0.6722014",
"0.6694188",
"0.66634375",
"0.6661647",
"0.665688",
"0.6603685... | 0.7544279 | 0 |
Tests the total_tax calculation and that setting it manually doesn't modify the data. | def test_credit_note_sub_total_calculation2
credit_note = create_test_credit_note
line_item = credit_note.line_items.first
# Make sure that everything adds up to begin with.
expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }
assert_equal(expected_total_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tax(status, base_total, tax_rate)\n if status == true\n amt = compute_tax(base_total, tax_rate)\n round_tax(amt)\n else\n 0.0\n end\n end",
"def calculate_tax\n if self.vendor.net_prices\n # this is for the US tax system. At this point, total is still net.\n self.tax... | [
"0.73312217",
"0.7216969",
"0.7141075",
"0.7071348",
"0.7046973",
"0.70217437",
"0.69959164",
"0.6992086",
"0.6975526",
"0.6946917",
"0.69319886",
"0.6916121",
"0.69145423",
"0.6899465",
"0.6893729",
"0.6866533",
"0.6864437",
"0.67634135",
"0.67243356",
"0.6723249",
"0.669778... | 0.7053209 | 4 |
Tests the total calculation and that setting it manually doesn't modify the data. | def test_credit_note_sub_total_calculation3
credit_note = create_test_credit_note
line_item = credit_note.line_items.first
# Make sure that everything adds up to begin with.
expected_total = credit_note.sub_total + credit_note.total_tax
assert_equal(expected_total, credit_note.total)
# Change ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_total\r\n self.total = self.order_items.collect{ |order_item| order_item.valid? ? (order_item.sub_total) : 0 }.sum.to_d\r\n end",
"def test_calc_total\r\n \t@test_prospector.total_gold = 1\r\n \t@test_prospector.total_silver = 1\r\n \tassert_equal '21.98', @test_prospector.calc_total\r\n en... | [
"0.73873997",
"0.72940177",
"0.71313727",
"0.69149816",
"0.68779016",
"0.67902166",
"0.6764172",
"0.67522913",
"0.67312366",
"0.6715197",
"0.6715197",
"0.6710006",
"0.6707122",
"0.6696424",
"0.668682",
"0.6676826",
"0.6658632",
"0.6627673",
"0.65975845",
"0.65838873",
"0.6583... | 0.6505414 | 23 |
Tests that the LineItemline_amount calculation is working correctly. | def test_line_amount_calculation
credit_note = create_test_credit_note
line_item = credit_note.line_items.first
# Make sure that everything adds up to begin with.
expected_amount = line_item.quantity * line_item.unit_amount
assert_equal(expected_amount, line_item.line_amount)
# Change the line... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_line_items_total\n total = 0\n for item in @order.order_line_items\n total += item.total\n end\n assert_equal @order.line_items_total, total\n end",
"def test_get_all_line_items_total\n assert_equal @order.line_items_total, @order.order_line_items.collect{ |p| p.unit_price * p.quant... | [
"0.7655406",
"0.75984013",
"0.758542",
"0.7484542",
"0.7421684",
"0.74212146",
"0.73767745",
"0.7213707",
"0.71662545",
"0.7070975",
"0.70395505",
"0.6999763",
"0.69934714",
"0.6964943",
"0.6959533",
"0.6940743",
"0.68545836",
"0.67623204",
"0.6760262",
"0.6722215",
"0.669188... | 0.86942834 | 0 |
Ensure that the totalling methods don't raise exceptions, even when credit_note.line_items is empty. | def test_totalling_methods_when_line_items_empty
credit_note = create_test_credit_note
credit_note.line_items = []
assert_nothing_raised(Exception) {
assert_equal(BigDecimal('0'), credit_note.sub_total)
assert_equal(BigDecimal('0'), credit_note.total_tax)
assert_equal(BigDecimal('0'), cre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_amount_validation\n @items.each do |i|\n next if i[:quantity].to_i * (i[:unit_price].to_i - i[:total_discount_amount].to_i) == i[:total_amount].to_i\n\n raise Klarna::Checkout::Errors::OrderValidationError.new(\n 'inconsistent_order_line_totals', 'total_line_am... | [
"0.7066226",
"0.67113274",
"0.6652595",
"0.6605369",
"0.658764",
"0.65683085",
"0.65683085",
"0.65683085",
"0.6540844",
"0.6537474",
"0.64984804",
"0.64984804",
"0.6495068",
"0.6495068",
"0.6495068",
"0.64947355",
"0.6491952",
"0.64802235",
"0.6463409",
"0.6459168",
"0.645789... | 0.8359489 | 0 |
Make sure that the create_test_credit_note method is working correctly with all the defaults and overrides. | def test_create_test_credit_note_defaults_working
credit_note = create_test_credit_note
# Test credit_note defaults.
assert_equal('ACCRECCREDIT', credit_note.type)
assert_kind_of(Date, credit_note.date)
assert_equal('12345', credit_note.credit_note_number)
assert_equal('MY REFERENCE FOR THIS CR... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_credit_note\n run_task :create_credit_note do\n line_items = create_xero_line_items(@proposal.credit_note_lines)\n if line_items.empty?\n logger.debug 'Not creating a credit note because there are no lines'\n current_state[:status] = 'not required because no credit n... | [
"0.7094288",
"0.667983",
"0.6612219",
"0.6587254",
"0.6368163",
"0.63175416",
"0.61764246",
"0.6156923",
"0.6112589",
"0.60135686",
"0.59694505",
"0.5965097",
"0.5947239",
"0.5947239",
"0.5947239",
"0.5947239",
"0.5850673",
"0.5827786",
"0.58167857",
"0.5798919",
"0.57547027"... | 0.8023163 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.