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 |
|---|---|---|---|---|---|---|
POST /other_contactinfos POST /other_contactinfos.json | def create
@other_contactinfo = OtherContactinfo.new(other_contactinfo_params)
respond_to do |format|
if @other_contactinfo.save
format.html { redirect_to @other_contactinfo, notice: 'Other contactinfo was successfully created.' }
format.json { render :show, status: :created, location: @other_contactinfo }
else
format.html { render :new }
format.json { render json: @other_contactinfo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def other_contactinfo_params\n params.require(:other_contactinfo).permit(:details, :info_type)\n end",
"def set_other_contactinfo\n @other_contactinfo = OtherContactinfo.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @other_contactinfo.update(other_contactinfo_param... | [
"0.6944965",
"0.6800945",
"0.6659774",
"0.66473895",
"0.6485835",
"0.63506263",
"0.6175852",
"0.6144532",
"0.61148643",
"0.6061068",
"0.6036811",
"0.6024937",
"0.59931034",
"0.5988497",
"0.59130096",
"0.5907712",
"0.5906936",
"0.5905976",
"0.59024817",
"0.58844054",
"0.587563... | 0.75828713 | 0 |
PATCH/PUT /other_contactinfos/1 PATCH/PUT /other_contactinfos/1.json | def update
respond_to do |format|
if @other_contactinfo.update(other_contactinfo_params)
format.html { redirect_to @other_contactinfo, notice: 'Other contactinfo was successfully updated.' }
format.json { render :show, status: :ok, location: @other_contactinfo }
else
format.html { render :edit }
format.json { render json: @other_contactinfo.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @contactinfo = Contactinfo.find(params[:id])\n\n respond_to do |format|\n if @contactinfo.update_attributes(params[:contactinfo])\n format.html { redirect_to person_path(@contactinfo.people_id), :notice => 'Contactinfo was successfully updated.' }\n format.json { head :ok }\n ... | [
"0.69581133",
"0.6947267",
"0.6752909",
"0.66839427",
"0.6682335",
"0.66715753",
"0.66371405",
"0.6609838",
"0.66091084",
"0.660885",
"0.66026706",
"0.65780205",
"0.65716827",
"0.65564317",
"0.6552869",
"0.65367144",
"0.65310216",
"0.65064603",
"0.6503897",
"0.6461425",
"0.64... | 0.7523633 | 0 |
DELETE /other_contactinfos/1 DELETE /other_contactinfos/1.json | def destroy
@other_contactinfo.destroy
respond_to do |format|
format.html { redirect_to other_contactinfos_url, notice: 'Other contactinfo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was success... | [
"0.741382",
"0.73675823",
"0.7327815",
"0.7294744",
"0.7268565",
"0.71789193",
"0.71342725",
"0.71280545",
"0.71161693",
"0.70743304",
"0.70705146",
"0.7022205",
"0.6999654",
"0.6965973",
"0.6965973",
"0.6965973",
"0.69557136",
"0.69546586",
"0.6935426",
"0.6927177",
"0.69228... | 0.7699122 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_other_contactinfo
@other_contactinfo = OtherContactinfo.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def other_contactinfo_params
params.require(:other_contactinfo).permit(:details, :info_type)
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 |
Constructor Create a new Rubella::Input::Base object using the given data | def initialize data
@data = data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(input_data)\n @data = input_data\n end",
"def initialize(input)\n @input = input\n end",
"def initialize(input)\n @input = input\n end",
"def initialize(input)\n @input = input\n end",
"def initialize(input)\n @input = input\n end",
"def initiali... | [
"0.74401456",
"0.7108795",
"0.7108795",
"0.7108795",
"0.69934124",
"0.69142705",
"0.6874311",
"0.67969006",
"0.6773014",
"0.67679775",
"0.66630715",
"0.6554341",
"0.6511931",
"0.6479336",
"0.6479336",
"0.6479336",
"0.6479336",
"0.64479154",
"0.6441564",
"0.6437749",
"0.643517... | 0.60132384 | 61 |
Passes each dataset trought the given block. | def each &block
@data.each &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_dataset(&block)\n datasets.each(&block)\n end",
"def each(&block)\n @data.each(&block)\n end",
"def each(&block)\n self.data.each(&block)\n end",
"def each &block\n @data.each &block\n end",
"def each_dataset(builder, &block)\n block.call(builder.ct.dataset)\n\... | [
"0.7853301",
"0.7049619",
"0.7003946",
"0.6941443",
"0.6820713",
"0.67093885",
"0.66809213",
"0.6599444",
"0.6481055",
"0.646827",
"0.63322854",
"0.6150459",
"0.612569",
"0.6089633",
"0.6062167",
"0.6048823",
"0.6044689",
"0.60440487",
"0.60221463",
"0.6018714",
"0.60116094",... | 0.6842563 | 4 |
Returns a String describing the file's content type | def detect
if blank_name?
SENSIBLE_DEFAULT
elsif empty_file?
EMPTY_TYPE
elsif calculated_type_matches.any?
calculated_type_matches.first
else
type_from_file_contents || SENSIBLE_DEFAULT
end.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filetype\n `file --mime-type -b #{@file_path}`.chomp\n end",
"def content_type\n file.try(:content_type)\n end",
"def content_type\n %x(file -bi \"#{self.path}\").chomp.scan(/^[a-z0-9\\-_]+\\/[a-z0-9\\-_]+/).first\n end",
"def file_content_type\n types = MIME::Types.type_... | [
"0.8484587",
"0.8415797",
"0.82371604",
"0.8178118",
"0.8136405",
"0.8110548",
"0.8084815",
"0.806098",
"0.79921305",
"0.7925827",
"0.784713",
"0.7792401",
"0.77783495",
"0.77778447",
"0.775118",
"0.77383804",
"0.7737693",
"0.7730963",
"0.7730583",
"0.7713818",
"0.76861805",
... | 0.0 | -1 |
media type spoof detection strategy: 1. it will not identify as spoofed if file name doesn't have any extension 2. it will identify as spoofed if any of the file extension's media types matches the media type of the content type. So it will return true for `text` of `text/plain` mismatch with `image` of `image/jpeg`, but return false for `image` of `image/png` match with `image` of `image/jpeg`. | def spoofed?
has_extension? and media_type_mismatch?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_image_type?\n file_content_type =~ %r(image)\n end",
"def not_image?(file)\n !file.content_type.include? 'image'\n end",
"def image?\n picture_content_type =~ %r{^(image|(x-)?application)/(bmp|gif|jpeg|jpg|pjpeg|png|x-png)$}\n end",
"def image?\n document_content_type =~ %r{^(image|(x-... | [
"0.7476229",
"0.7459013",
"0.74515355",
"0.71814746",
"0.7105635",
"0.7084438",
"0.7045984",
"0.7040026",
"0.70381165",
"0.70344985",
"0.70154774",
"0.7014197",
"0.701178",
"0.7010289",
"0.6994367",
"0.69935936",
"0.69730306",
"0.69560754",
"0.6945324",
"0.69327104",
"0.69284... | 0.74292076 | 3 |
Return the RGB value gained from a RGB/HSL/HWB function. | def rgb
raise NotImplementedError, 'Overwrite the method in a subclass'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgb_color; end",
"def hwb_to_rgb(hwb)\n hue, white, black = normalize_hwb(hwb)\n rgb = Utils.hsl_to_rgb([hue, 100, 50])\n\n rgb.map do |c|\n ((c * (1.0 - white - black)) + white * 255).round\n end\n end",
"def rgb_value(red, green, blue)\n [16, *[red, green, b... | [
"0.7161344",
"0.6968926",
"0.69406134",
"0.68681437",
"0.68132585",
"0.67819804",
"0.676807",
"0.6721363",
"0.6711482",
"0.6705129",
"0.67024076",
"0.6660875",
"0.66527814",
"0.664526",
"0.6597271",
"0.6596644",
"0.6596644",
"0.6596644",
"0.65943444",
"0.6576118",
"0.65400004... | 0.5861903 | 88 |
Return the parameters of a RGB/HSL/HWB function as an array of Integer/Float. The unit for H, S, L is assumed to be deg, %, % respectively. | def to_a
@normalized
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_array\n\t\t\tm_color = self.color.delete(' ')\n\t\t\tm_color.delete!('hsl(')\n\t\t\tm_color.delete!(')')\n\n\t\t\tm_color = m_color.split(',')\n\t\t\tm_color[0] = m_color[0].to_i \n\t\t\tm_color[1] = m_color[1].to_f / 100 \n\t\t\tm_color[2] = m_color[2].to_f / 100\n\t\t\tm_color \n\t\tend",
"def hls_to_rg... | [
"0.5703015",
"0.5495604",
"0.5459033",
"0.5427934",
"0.5355739",
"0.5355739",
"0.5315845",
"0.52996063",
"0.52996063",
"0.52702755",
"0.51830053",
"0.5178509",
"0.51388985",
"0.5119061",
"0.5065432",
"0.5064894",
"0.503895",
"0.5038378",
"0.5019139",
"0.50139385",
"0.5010467"... | 0.0 | -1 |
Return the opacity of a color presented as a RGB/HSL/HWB function. The returned value is normalized to a floating number between 0 and 1. | def opacity
@opacity ||= @normalized.length == 3 ? 1.0 : @normalized.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rgba\n rgb + [opacity]\n end",
"def alpha\n (rgba & 0x7F000000) >> 24\n end",
"def brightness(color)\n r, g, b = color\n # http://stackoverflow.com/a/596243\n 0.299 * r + 0.587 * g + 0.114 * b\n end",
"def brightness(red, green, blue)\n Math.sqrt(0.299 * red**2 + 0.58... | [
"0.6928135",
"0.6472066",
"0.6375856",
"0.6302304",
"0.6235044",
"0.6235044",
"0.6173126",
"0.6147864",
"0.60178804",
"0.59794897",
"0.5948166",
"0.59369165",
"0.59369165",
"0.5921029",
"0.59146553",
"0.5913207",
"0.5906395",
"0.588803",
"0.5846649",
"0.5836493",
"0.58360577"... | 0.6586281 | 1 |
Return the RGBA value gained from a RGB/HSL/HWB function. The opacity is normalized to a floating number between 0 and 1. | def rgba
rgb + [opacity]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alpha\n (rgba & 0x7F000000) >> 24\n end",
"def red\n (rgba & 0xFF0000) >> 16\n end",
"def from_rgba(red, green, blue, alpha)\n Inker.color(\"rgba(#{red}, #{green}, #{blue}, #{alpha})\")\n end",
"def rgba(r, g, b, a)\n r << 24 | g << 16 | b << 8 | a\n end",
"def rgba(... | [
"0.7262932",
"0.663237",
"0.6559448",
"0.6485357",
"0.6485357",
"0.6441858",
"0.62984455",
"0.62866646",
"0.6255446",
"0.6238692",
"0.6236016",
"0.62230605",
"0.6208864",
"0.62023795",
"0.6151743",
"0.6110701",
"0.6046085",
"0.60365885",
"0.60169226",
"0.595405",
"0.5953846",... | 0.7252437 | 1 |
Return true when the Color is completely opaque. | def opaque?
opacity == Utils::MAX_OPACITY
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opaque?\n all? { |color| Color.opaque?(color) }\n end",
"def opaque?\n alpha == ALPHA_OPAQUE\n end",
"def transparent?\n alpha == ALPHA_TRANSPARENT\n end",
"def transparent?\n @transparent\n end",
"def check_if_opacity_changed\n @color_components = nil if ... | [
"0.8414034",
"0.74013376",
"0.7083934",
"0.67261237",
"0.66811085",
"0.666327",
"0.65855724",
"0.6565472",
"0.6500654",
"0.6478315",
"0.6478315",
"0.64358896",
"0.64358896",
"0.643508",
"0.643508",
"0.6368792",
"0.6368792",
"0.6323006",
"0.6282712",
"0.6248431",
"0.61971843",... | 0.76011294 | 1 |
called by the Runner before the command, this can be used to setup additional items for the command | def before() ; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before\n if @pkg.has_key? :cmd and @pkg[:cmd].has_key? :before\n logger.info \"Executing before commands...\"\n run :before\n end\n end",
"def set_commands; end",
"def add_pre_command(cmd)\n cmd\n end",
"def pre_command_hook(&block)\n @rye_pre_command_hook = bl... | [
"0.6827961",
"0.6450564",
"0.6449802",
"0.63972044",
"0.6199914",
"0.6145817",
"0.613688",
"0.6129636",
"0.60614306",
"0.6059833",
"0.60518146",
"0.6031548",
"0.5983168",
"0.5915383",
"0.5902271",
"0.5893778",
"0.58850485",
"0.585007",
"0.5816736",
"0.58022875",
"0.57995594",... | 0.54496604 | 69 |
called by the Runner to execute the command | def run
raise Error, "Unknown command `#{command_name}`"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute(command)\n end",
"def execute\n parse_command\n run_command(command)\n end",
"def execute_command(command)\n end",
"def execute_command(command)\n end",
"def execute(command) # rubocop:disable Lint/UnusedMethodArgument\n end",
"def run\n # TODO: inclu... | [
"0.7973707",
"0.79033667",
"0.79008216",
"0.79008216",
"0.77562803",
"0.77079225",
"0.7621169",
"0.7525238",
"0.7516317",
"0.7377425",
"0.7242268",
"0.7234024",
"0.71835506",
"0.71743274",
"0.71624076",
"0.7141574",
"0.71113205",
"0.7090686",
"0.70900095",
"0.70686334",
"0.70... | 0.7170364 | 14 |
called by the Runner if an error is encountered during the run method | def error()
results.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_failed; end",
"def run_and_raise_on_failure\n # TODO ?\n end",
"def handle_perform_error(_e); end",
"def run_failed(exception)\n super\n Chef::Log.warn(\"<< END >>\")\n end",
"def safe_run\n run\n rescue Ohai::Exceptions::Error => e\n @failed = ... | [
"0.7950934",
"0.7228256",
"0.710166",
"0.690071",
"0.68825483",
"0.66944325",
"0.6692612",
"0.66387546",
"0.66018116",
"0.65892684",
"0.6542962",
"0.6540164",
"0.6500783",
"0.64940673",
"0.6492425",
"0.6492165",
"0.64886385",
"0.64886385",
"0.64886385",
"0.64886385",
"0.64886... | 0.60952127 | 63 |
called by runner if a signal is hit | def shutdown()
results.close
@delete_results = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signal; end",
"def signal; end",
"def signal_received; end",
"def signal\n end",
"def signal_received=(_arg0); end",
"def signal_queue; end",
"def signal\n @cmd_result.signal\n end",
"def signal\n @condition.signal\n true\n end",
"def signal\n @condition.signal\n tru... | [
"0.82261705",
"0.82261705",
"0.8163782",
"0.8142026",
"0.77753067",
"0.71608514",
"0.7126699",
"0.6931618",
"0.6931618",
"0.6925834",
"0.67384404",
"0.67362183",
"0.6674198",
"0.66381586",
"0.65904015",
"0.6533097",
"0.6530303",
"0.6481437",
"0.6468084",
"0.6465543",
"0.64554... | 0.0 | -1 |
called by runner when all is done | def after()
if options['error-filelist'] then
if analyzer.bad_data_count > 0 then
File.open( options['error-filelist'], "w+" ) do |f|
analyzer.dump_errors_to( f )
end
logger.info "wrote error filelist to #{options['error-filelist']}"
end
end
if output != $stdout then
output.close
results.close
File.unlink( results_dbfile ) if @delete_results
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done; end",
"def batch_finished\n end",
"def done\n end",
"def done\n end",
"def run_completed\n end",
"def finish()\n #This is a stub, used for indexing\n end",
"def finished; end",
"def finish; end",
"def finish; end",
"def finish; end",
"def finish; end",
... | [
"0.7542461",
"0.7316184",
"0.7284506",
"0.7284506",
"0.726032",
"0.7187867",
"0.71502495",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7094639",
"0.7045853",
"0.7045853",
"0.6963837",
"0.6963813",
"0.6938609",
"0.6916406",
"... | 0.0 | -1 |
The list of commands registered. | def commands
unless defined? @commands
@commands = []
end
return @commands
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def commands\n @commands ||= []\n end",
"def commands\n @commands.keys.sort\n end",
"def commands\n @commands ||= [].tap do |c|\n commands_list.each do |command|\n if command.instance_of? String\n c << standard_commands[command].new\n else\... | [
"0.86579055",
"0.8247886",
"0.82139695",
"0.8134658",
"0.8005553",
"0.79961854",
"0.7982354",
"0.7859371",
"0.7851082",
"0.7721278",
"0.7715624",
"0.76922435",
"0.7677882",
"0.7620708",
"0.75244856",
"0.7510431",
"0.7485274",
"0.7476543",
"0.74724555",
"0.7462219",
"0.7441945... | 0.86594325 | 0 |
get the command klass for the given name | def find( name )
@commands.find { |klass| klass.command_name == name }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_name\n klass_name = self.class.name.split('::').last\n command = klass_name.gsub(/([^\\^])([A-Z])/, '\\1_\\2').downcase\n command\n end",
"def _retrieve_class_and_command(name, sent_command = nil) #:nodoc:\n if name.nil?\n [self.class, nil]\n elsif self.clas... | [
"0.73914486",
"0.7375479",
"0.7332331",
"0.7252605",
"0.7217673",
"0.7150824",
"0.6966317",
"0.69244397",
"0.6901188",
"0.68781906",
"0.6867688",
"0.68579996",
"0.6791404",
"0.6791404",
"0.6791404",
"0.6787059",
"0.67576337",
"0.6595642",
"0.641231",
"0.64101624",
"0.6409243"... | 0.7611954 | 0 |
overwrite to support decorator | def current_user
return @current_user if @current_user
@current_user = super.decorate if super
@current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decorate!; end",
"def decorate!; end",
"def wrapper; end",
"def delegating_method; end",
"def decorated_object_behavior\n #code\n end",
"def _actual_decorator\n @_decorator\n end",
"def wrapper\n -> fn { -> { fn } }\n end",
"def collection_decorator\n\n\n\n\n\n\n\n ... | [
"0.81181633",
"0.81181633",
"0.7186066",
"0.6777097",
"0.67610145",
"0.6753328",
"0.6724755",
"0.66246074",
"0.6472978",
"0.6472978",
"0.6413068",
"0.6401581",
"0.639449",
"0.63332546",
"0.63200665",
"0.6261418",
"0.6220026",
"0.61774987",
"0.61751604",
"0.61751604",
"0.61744... | 0.0 | -1 |
Function to parse a CSV file and import to RT | def import_cert_to_rt(filename)
CSV.open(filename, 'r') do |row|
next if row.first == "CertName" # skip headers
certname, expiration, registrar, username = row
certname = certname.upcase.strip
$all_certs << certname
# check if the cert exists in RT
# if it's already in RT do an update
# otherwise add it to RT
certname_id = $rt_certs[certname]
if certname_id
puts "Updating #{certname}: register=#{registrar} username=#{username} expiration=#{expiration}"
result = `#{RT_BIN} edit asset/#{certname_id} set Status='production' 'CF-Registrar'='#{registrar}' 'CF-Expire Date'='#{expiration}' 'CF-Username'='#{username}'`
else
puts "Adding #{certname}: register=#{registrar} username=#{username} expiration=#{expiration}"
result = `#{RT_BIN} create -t asset set Type='SSLCert' Name='SSLCERT: #{certname}' Status='production' 'CF-Registrar'='#{registrar}' 'CF-Expire Date'='#{expiration}' 'CF-Username'='#{username}'`
end
# FIXME: RT doesn't return an error code if an asset can't be updated/created do to database conflict
if $?.success?
puts result
else
$stderr.puts result
end
end
rescue => e
$stderr.puts "Error parsing file #{filename}"
$stderr.puts e.message
exit 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @... | [
"0.7485334",
"0.7436841",
"0.73518157",
"0.7332536",
"0.72870696",
"0.7251726",
"0.7245863",
"0.7171335",
"0.71514165",
"0.71455264",
"0.71082675",
"0.7107302",
"0.7006604",
"0.6999771",
"0.69731766",
"0.6954527",
"0.6941093",
"0.6941045",
"0.693321",
"0.6916081",
"0.6832392"... | 0.0 | -1 |
building method to locate all of the 1s in the 2D array | def coords
blur_pixels = []
# blur_pixels is the array, and then we need to fill it
@array.each_with_index do |row, row_int| #nested loops
row.each_with_index do |int, col_index| # iterating over integers in arrays
if int == 1 #1 is the number we are using as the culprit in our blur
blur_pixels << [row_int, col_index] # << is pushing into the blur_pixels array
end
end
end
blur_pixels
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_ones\n ones_locations = []\n # => finding index of ROW and COL for each 1 in grid and storing as row/col array pairs\n @image_array.each_index do |row|\n @image_array[row].each_index do |col|\n if @image_array[row][col] == 1\n puts \"#{row}, #{col}\" # <---this is just to di... | [
"0.79268605",
"0.7907457",
"0.76177156",
"0.73913074",
"0.66066617",
"0.65828246",
"0.64323366",
"0.6161578",
"0.5979109",
"0.59425765",
"0.59282035",
"0.58369833",
"0.583304",
"0.5811763",
"0.5805519",
"0.57808787",
"0.5710863",
"0.5705753",
"0.56942433",
"0.5678074",
"0.562... | 0.57603115 | 16 |
building method to adulterate integers around 1s | def blur!(distance = 1) #needs the !, is a bang, syntax is telling that is going to change the state of what we are operating on.
distance.times do #looping for distance
blur_pixels = coords # accessing array from previous method
@array.each_with_index do |row, row_int|
row.each_with_index do |int, col_index|
blur_pixels.each do |row_int_coord, col_index_coord|
if row_int == row_int_coord && col_index == col_index_coord
# left of 1
@array[row_int][col_index -1] = 1 unless col_index == 0
# right of 1
@array[row_int][col_index +1] = 1 unless col_index >= @col_length-1
# above 1
@array[row_int -1][col_index] = 1 unless row_int == 0
# below 1
@array[row_int +1][col_index] = 1 unless row_int >= @row_length-1
end
end
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plus_one(digits)\n digits[-1] += 1 \n digits \nend",
"def plus_one_short digits\n # int.next return the next int Ex: 2 -> 3\n # int.digits return an array of int digits\n # array.join return an string of array digits concatenation.\n # string.to_i return an int\n # array.reverse return an reversed ar... | [
"0.70861",
"0.6867956",
"0.6814455",
"0.6746421",
"0.6746061",
"0.6651129",
"0.6603917",
"0.653027",
"0.64255285",
"0.6407912",
"0.6394866",
"0.63786465",
"0.6329597",
"0.6329597",
"0.6322206",
"0.6296236",
"0.62703663",
"0.6250604",
"0.6246097",
"0.6188957",
"0.6180884",
"... | 0.0 | -1 |
Check to see if the current session is authenticated | def authenticated?
authentication.authenticated?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticated?\n !!session[:user]\n end",
"def authenticated?\n @session != nil && !@session['session_expires'].nil? && @session['session_expires'] > Time.now && @session['auth'] == true && @session['ip'] == @cgi.remote_addr\n end",
"def check_authenticated\n @logged_in = session[:lo... | [
"0.87378633",
"0.85987055",
"0.8405101",
"0.8310101",
"0.82792187",
"0.81854314",
"0.8157824",
"0.8120899",
"0.81083995",
"0.8073257",
"0.80565757",
"0.8018669",
"0.8004726",
"0.80025095",
"0.79868263",
"0.7957281",
"0.79453963",
"0.792161",
"0.79176235",
"0.7888434",
"0.7882... | 0.7944236 | 17 |
Authenticates the session via the authentication object. See Merb::Authenticationauthenticate for usage | def authenticate!(request, params, *rest)
authentication.authenticate!(request, params, *rest)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n auth.call(:authenticate)\n end",
"def authenticate(session, cookies)\n session['account_id'] = id\n session['organization_id'] = organization_id\n refresh_credentials(cookies)\n self\n end",
"def authenticate\n authenticated_session || render_unauthorized\n... | [
"0.7452915",
"0.73859245",
"0.72958523",
"0.7283444",
"0.72262216",
"0.7183791",
"0.7148814",
"0.6900081",
"0.68898976",
"0.6874672",
"0.6873032",
"0.68729514",
"0.6870258",
"0.68691456",
"0.6860131",
"0.6858656",
"0.6834811",
"0.6804231",
"0.67733604",
"0.6759826",
"0.675882... | 0.65058863 | 49 |
Provides access to the currently authenticated user. | def user
authentication.user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n @authenticated_user\n end",
"def current_user\n @authenticated_user\n end",
"def current_user\n\t\tauthenticated(User)\n\tend",
"def current_user\n authentication.account\n end",
"def current_user\n super\n if @current_user\n return @current_user\n ... | [
"0.80881256",
"0.80881256",
"0.8006508",
"0.7861459",
"0.78411317",
"0.7826515",
"0.78056157",
"0.7791998",
"0.7771798",
"0.77689874",
"0.7748864",
"0.7737617",
"0.77168053",
"0.7701085",
"0.7701085",
"0.7673588",
"0.76720756",
"0.7671951",
"0.76628906",
"0.76571476",
"0.7657... | 0.8066464 | 2 |
set the currently authenticated user manually Merb::Authenticationstore_user should know how to store the object into the session | def user=(the_user)
authentication.user = the_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_user\n UserInfo.current_user = session[:user]\n end",
"def set_user\r\n @user = current_user\r\n end",
"def set_user\n @user = current_user \n end",
"def set_user\n @user = @current_user\n end",
"def set_user\n @user = current_user\n end",
"def set_user\n @user = ... | [
"0.8455377",
"0.8224727",
"0.81495327",
"0.813052",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
"0.81120765",
... | 0.7824028 | 53 |
Remove the user from the session and clear all data. | def abandon!
authentication.abandon!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def forget_everything\n empty_session!\n PersistentUser.new(@user).delete\n end",
"def destroy\n @session[:user_id] = nil\n @current_user = nil\n end",
"def destroy\n session.delete(:user)\n end",
"def logout\n session[:user] = nil\n end",
"def logout\n @session[:... | [
"0.82708997",
"0.80914783",
"0.8033627",
"0.79084516",
"0.7856751",
"0.77981716",
"0.7773232",
"0.7767687",
"0.77671665",
"0.7740955",
"0.77392745",
"0.7729122",
"0.77090925",
"0.7705379",
"0.77004397",
"0.77004397",
"0.77004397",
"0.7699604",
"0.76972693",
"0.76972693",
"0.7... | 0.0 | -1 |
2. loop through numbers 3. next if numbers length is less than 2 4. create evens count 5. add 1 to evens count if number is divisible by 2 6. return true if evens count is greater than or equal to 2 7. return false | def EvenPairs(str)
str.scan(/d+/).each do |current|
current.length.times do |i|
first, second = current[0...i].to_i, current[i..-1].to_i
return true if first.even? && second.even? && ![first, second].include?(0)
end
end
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lucky_sevens?(numbers)\n\tnumbers.each_cons(3) { |group| return true if group.reduce(:+) === 7 }\n\tfalse\n\t\nend",
"def check_if_evenly_divisible(number, count) \n divisible = false \n (1..count).each do |i|\n if number % i == 0\n divisible = true\n else\n return false\n end\n end\n ... | [
"0.76631624",
"0.7599953",
"0.72702813",
"0.7195503",
"0.7183025",
"0.71289283",
"0.71289283",
"0.71170014",
"0.71157646",
"0.7107096",
"0.706514",
"0.706398",
"0.7057",
"0.7054747",
"0.70520425",
"0.7041416",
"0.7015398",
"0.7013949",
"0.7011219",
"0.6997789",
"0.69894767",
... | 0.0 | -1 |
This enables us to have a group of checkboxes that is backed by the array stored in Spotlight::BlacklightConfigurationdocument_index_view_types | def document_index_view_types
vals = configuration.document_index_view_types
Blacklight::OpenStructWithHashAccess.new.tap do |s|
view_type_options.each do |k|
s[k] = vals.include?(k.to_s)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def checkboxes; end",
"def document_index_view_controls\n document_index_views.select do |_k, config|\n config.display_control.nil? || blacklight_configuration_context.evaluate_configuration_conditional(config.display_control)\n end\n end",
"def index\n @checklist_types = ChecklistType.all\n en... | [
"0.61778724",
"0.59826356",
"0.5752681",
"0.55858094",
"0.5480275",
"0.5432407",
"0.5346459",
"0.52310586",
"0.52117366",
"0.5198922",
"0.5167887",
"0.5137502",
"0.5132881",
"0.5111924",
"0.5086849",
"0.5057139",
"0.50547206",
"0.5054495",
"0.50533575",
"0.50502807",
"0.50394... | 0.6910731 | 0 |
This enables us to have a group of checkboxes that is backed by the array stored in Spotlight::BlacklightConfigurationdefault_sort_fields | def sort_fields
fields = configuration.sort_fields
Blacklight::OpenStructWithHashAccess.new.tap do |s|
default_sort_fields.each_with_index do |(k, field), index|
s[k] = Blacklight::OpenStructWithHashAccess.new.tap do |c|
c.enabled = fields[k] && fields[k][:enabled]
c.label = fields[k][:label] if fields[k]
c.weight = index + 1
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_checkbox_group(name, options = [])\n field = field_content(name)\n field_name = prop(field, 'name') || name\n group = {}\n unless field.nil?\n group[:question] = prop(field, 'question')\n group[:name] = field_name\n group[:checkboxes] = options.presence || options_group(prop(fi... | [
"0.61133957",
"0.58382106",
"0.5836909",
"0.57873416",
"0.57289314",
"0.56604284",
"0.56538564",
"0.56499636",
"0.5590614",
"0.5561395",
"0.55457735",
"0.5442636",
"0.53984755",
"0.53977174",
"0.5387622",
"0.5379397",
"0.5372678",
"0.52897656",
"0.52671576",
"0.52057016",
"0.... | 0.6496761 | 0 |
Constructor of class Validable | def initialize
@errors = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(params = {})\n super\n self.is_valid = true\n end",
"def initialize *args\n super\n \n raise ArgumentError, errors.full_messages.join(\"\\n\") unless self.valid?\n self\n end",
"def be_valid\n ArBeValid.new\n end",
"def be_valid\n BeValid.new\n end... | [
"0.7485547",
"0.7344449",
"0.73171973",
"0.685001",
"0.6806699",
"0.6476233",
"0.64217705",
"0.63814986",
"0.638127",
"0.6355844",
"0.63467795",
"0.6325476",
"0.6325476",
"0.6325476",
"0.6325476",
"0.6325476",
"0.62933266",
"0.6291647",
"0.62628114",
"0.6231715",
"0.62287694"... | 0.0 | -1 |
This method ensure the Object is valid and can handle a response | def valid?
!@errors.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_object(obj)\n ret = json\n return ret if ret.instance_of?(obj)\n\n msg = \"Expected #{obj} in response for #{url}. The returned object is a #{ret.class}.\"\n raise Exceptions::ExceptionWithResponse.new(msg, self)\n end",
"def valid_request object, params\n ... | [
"0.7460467",
"0.68402845",
"0.68023795",
"0.64396214",
"0.63902813",
"0.63181716",
"0.62769115",
"0.62767935",
"0.6201306",
"0.6196025",
"0.6173114",
"0.61548823",
"0.61533827",
"0.6142354",
"0.6119806",
"0.6077421",
"0.60768515",
"0.6068392",
"0.6064663",
"0.604246",
"0.6041... | 0.0 | -1 |
Method to add error to error object | def add_error(error)
@errors = error
@errors
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_error(error)\n @errors.add(error)\n self\n end",
"def add_error(message)\n self.errors << message\n end",
"def add_request_error(error = {})\n @errors ||= []\n @errors << error\n end",
"def add_error(line)\n add_value(line, \"error\")\n end",
"def custom_... | [
"0.77393323",
"0.76335555",
"0.74000937",
"0.7371469",
"0.7280868",
"0.72651505",
"0.7251061",
"0.7155794",
"0.7123427",
"0.7100259",
"0.70700693",
"0.70653546",
"0.70515895",
"0.7030741",
"0.7030253",
"0.70015264",
"0.6978771",
"0.6943847",
"0.6940032",
"0.6938986",
"0.69342... | 0.82734853 | 0 |
expand regions from shorthand codes to arrays of ISO codes | def expand(*regions)
regions = normalize_territories(regions.flatten)
expanded_set(regions).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand_meshcode(meshcode)\n (6..12).map do |n|\n meshcode[0, n]\n end\n end",
"def layover_codes\n %w[ATL ORD DFW DEN]\n end",
"def australian_postcodes\n australian_postcodes_regular + australian_postcodes_po_boxes\nend",
"def translation_codes(preferred_code_sets)\n... | [
"0.56714696",
"0.56666684",
"0.5633063",
"0.5579016",
"0.5397923",
"0.53255206",
"0.53093135",
"0.52641433",
"0.5175824",
"0.51554155",
"0.513407",
"0.513407",
"0.513407",
"0.513407",
"0.513407",
"0.513407",
"0.51286286",
"0.5096761",
"0.50959885",
"0.50959885",
"0.5092807",
... | 0.5850148 | 0 |
Parse strings like 'EU GB' or 'EU +RU' to fully expanded arrays of ISO codes. Expandable codes (i.e. EU) will be expanded, codes with a `` prefix will be removed from the result and codes with a `+` prefix, or with no prefix will be added to the result. | def territories(territory_list)
parser = Parser.new(territory_list)
allowed = expanded_set(parser.accept)
rejected = expanded_set(parser.reject)
(allowed - rejected).to_a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_iso_list( paths_string )\n paths_string.split(':')\n .map do |path|\n if File.exists?( path )\n if File.directory? path\n Dir[File.join(path, '*.iso')]\n elsif File.file? path\n path\n else\n []\n e... | [
"0.5339266",
"0.5332102",
"0.5311575",
"0.517115",
"0.5169764",
"0.5127796",
"0.50489616",
"0.50292975",
"0.4975275",
"0.49496445",
"0.49427518",
"0.4827528",
"0.4750215",
"0.47391522",
"0.47322574",
"0.4659274",
"0.46574658",
"0.4592107",
"0.45895422",
"0.45890817",
"0.45873... | 0.0 | -1 |
Takes a filename, returns an array of the form: [[start, duration, event name, stream], [...], ...], where start is the time, in ms, at which an event started, duration is the event's duration in ms, and the event name is a string saying what the event was (kernel name, etc.). The stream field is a string corresponding to the stream in which the event occurred. | def get_file_events(filename)
lines = []
File.open(filename, 'rb') {|f| lines = f.read.split(/\n+/)}
pid = "unkown PID"
if filename =~ /trace_gpu_(\d+)/
pid = $1
end
to_return = []
lines.each do |line|
next if line !~ /\d+,\d+/
# Remove arguments to functions in (), since they'll contain commas.
line.gsub!(/\([^\)]+\)/, "()")
line.gsub!(/\[[^\]]+\]/, "[]")
columns = line.split(",")
start_time = columns[0].to_f
duration = columns[1].to_f
event = columns[-1].gsub(/"/, "")
stream = "PID #{pid}, stream #{columns[-2].to_s}"
to_return << [start_time, duration, event, stream]
end
to_return
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probe_streams (filename)\n\n \t\t\n \tstreams_cmd = \"ffprobe -print_format json -show_streams #{filename}\"\n \tprobe_response = nil\n \tOpen3.popen3(streams_cmd) {|i,o,e,t|\n \t\tprobe_response = o.read.chomp\n \t}\n \t\n \tstreams = JSON.parse(probe_response)\n \tif not streams.... | [
"0.5773351",
"0.56796473",
"0.5667601",
"0.5602811",
"0.5597146",
"0.55736727",
"0.554559",
"0.55152804",
"0.54904944",
"0.5488145",
"0.5482432",
"0.54585624",
"0.5419562",
"0.5398362",
"0.5378982",
"0.5369932",
"0.5351165",
"0.53146124",
"0.5246976",
"0.52451",
"0.52151626",... | 0.8301831 | 0 |
GET /casestudies or /casestudies.json | def index
@casecategories = Casecategory.all
@casestudies = Casestudy.all
@q = Casestudy.ransack(params[:q])
cate = params[:cate]
if !cate.nil?
@casestudies = Casestudy.where(:casecategory_id => cate)
else
@casestudies = @q.result(distinct: true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @case_studies }\n end\n end",
"def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n... | [
"0.7170999",
"0.6932479",
"0.6674364",
"0.6562635",
"0.6401115",
"0.6387642",
"0.6369196",
"0.63572395",
"0.6346134",
"0.6335675",
"0.6331738",
"0.6248643",
"0.6169367",
"0.6161778",
"0.61331564",
"0.60927117",
"0.60008276",
"0.58002114",
"0.5740994",
"0.5739947",
"0.5738514"... | 0.5679986 | 27 |
GET /casestudies/1 or /casestudies/1.json | def show
@casestudies = Casestudy.all
@q = Casestudy.ransack(params[:q])
@casestudies = @q.result(distinct: true)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @case_study }\n end\n end",
"def index\n @case_studies = CaseStudy.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n ... | [
"0.71968246",
"0.7037006",
"0.67808145",
"0.6652115",
"0.6543137",
"0.65406173",
"0.64401937",
"0.640327",
"0.63896215",
"0.6315186",
"0.6314074",
"0.6241372",
"0.62396",
"0.6161436",
"0.6137103",
"0.61135364",
"0.6023599",
"0.5994402",
"0.5964823",
"0.59482706",
"0.5917147",... | 0.6190426 | 13 |
POST /casestudies or /casestudies.json | def create
@casestudy = Casestudy.new(casestudy_params)
@casestudy.user = current_user
respond_to do |format|
if @casestudy.save
format.html { redirect_to @casestudy, notice: "Casestudy was successfully created." }
format.json { render :show, status: :created, location: @casestudy }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @casestudy.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @study_case = StudyCase.new(study_case_params)\n\n if @study_case.save\n render :show, status: :created\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def create\n @case_study = CaseStudy.new(params[:case_study])\n\n respond_to do ... | [
"0.7127624",
"0.699154",
"0.6947445",
"0.6592165",
"0.65890574",
"0.65242034",
"0.62290967",
"0.6213644",
"0.61687976",
"0.6144155",
"0.6144155",
"0.61243117",
"0.61039364",
"0.59518725",
"0.59405226",
"0.59118384",
"0.5848929",
"0.58000237",
"0.5794361",
"0.5790098",
"0.5712... | 0.65650094 | 5 |
PATCH/PUT /casestudies/1 or /casestudies/1.json | def update
respond_to do |format|
if @casestudy.update(casestudy_params)
format.html { redirect_to @casestudy, notice: "Casestudy was successfully updated." }
format.json { render :show, status: :ok, location: @casestudy }
else
format.html { render :edit, status: :unprocessable_entity }
format.json { render json: @casestudy.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @study_case.update(study_case_params)\n render :show, status: :ok\n else\n render json: @study_case.errors, status: :unprocessable_entity\n end\n end",
"def update\n @case_study = CaseStudy.find(params[:id])\n\n respond_to do |format|\n if @case_study.update_attribu... | [
"0.7398746",
"0.71050406",
"0.70940787",
"0.70940787",
"0.7090652",
"0.66962856",
"0.66922575",
"0.6644913",
"0.64628386",
"0.62465966",
"0.61933",
"0.6161151",
"0.6161151",
"0.6161151",
"0.60952723",
"0.60918736",
"0.6059777",
"0.604179",
"0.6031065",
"0.60287625",
"0.602426... | 0.7016764 | 5 |
DELETE /casestudies/1 or /casestudies/1.json | def destroy
@casestudy.destroy
respond_to do |format|
format.html { redirect_to casestudies_url, notice: "Casestudy was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n respond_to do |format|\n format.html { redirect_to case_studies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @case_study = CaseStudy.find(params[:id])\n @case_study.destroy\n\n ... | [
"0.7810131",
"0.779628",
"0.7722037",
"0.7591771",
"0.75071084",
"0.75071084",
"0.74565864",
"0.7161924",
"0.7154037",
"0.7154037",
"0.7076429",
"0.7042111",
"0.69577354",
"0.69363457",
"0.68454915",
"0.6841748",
"0.68047774",
"0.67804176",
"0.67804176",
"0.67733526",
"0.6747... | 0.7471003 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_casestudy
@casestudy = Casestudy.friendly.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 |
Only allow a list of trusted parameters through. | def casestudy_params
params.require(:casestudy).permit(:title, :description, :image, :user_id, :casecategory_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Permit updating and creating team partitions. | def team_params
params.require(:team_partition).permit(:name, :automated, :min_size, :max_size, :released)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_part\n @part = Part.find(params[:id])\n # authorize(@part)\n end",
"def leave_team\n team = Team.find_by_id params[:id]\n partition = TeamPartition.find_by_id team.partition_id\n if partition.editable\n team_membership = TeamMembership.where(:user_id => current_user.id, :team_i... | [
"0.5509358",
"0.54548556",
"0.530179",
"0.52720076",
"0.5243054",
"0.5201097",
"0.51170194",
"0.51084995",
"0.5077782",
"0.50491834",
"0.50317067",
"0.50290287",
"0.5022885",
"0.50221735",
"0.5020748",
"0.5005962",
"0.49940404",
"0.4977669",
"0.4946049",
"0.49458835",
"0.4929... | 0.6451678 | 0 |
Password and auth stuff. | def saved_password
@saved_password ||= BCrypt::Password.new(encrypted_password)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password; end",
"def password\n end",
"def password\n end",
"def password\n\n end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def password=(_arg0); end",
"def pas... | [
"0.7871616",
"0.7871616",
"0.7871616",
"0.7871616",
"0.7871616",
"0.7871616",
"0.77004063",
"0.77004063",
"0.76753604",
"0.75044906",
"0.75044906",
"0.75044906",
"0.75044906",
"0.7408827",
"0.7280889",
"0.72637844",
"0.72239864",
"0.7204841",
"0.7200175",
"0.7200175",
"0.7198... | 0.0 | -1 |
pops every link from a given page into an array and returns that array | def get_hrefs
# this will grab all the html from the url that
# the user created the scraper with
url_to_scrape = HTTParty.get(self.url)
# nokogiri turns everything from HTTParty into nodes.
nodes = Nokogiri::HTML(url_to_scrape)
nodes.css('a').each do |a|
self.hrefs << a['href']
end
self.hrefs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pages(url)\n urls = Array.new\n data = Array.new \n data << Nokogiri::HTML(ScraperWiki.scrape(url))\n data[0].css('p.pages a').each do |link|\n urls << editUrl(link.attribute(\"href\").to_s())\n end\n\n urls.uniq.each do |link|\n data << Nokogiri::HTML(ScraperWiki.scrape(link))\n end\n\n return d... | [
"0.75864667",
"0.75864667",
"0.7454071",
"0.7382355",
"0.7242995",
"0.7183609",
"0.7056289",
"0.7024644",
"0.6992715",
"0.69836795",
"0.69657946",
"0.6937173",
"0.6882893",
"0.68781316",
"0.68731326",
"0.68553096",
"0.68540186",
"0.6852048",
"0.68191755",
"0.67367035",
"0.673... | 0.6248191 | 73 |
Never trust parameters from the scary internet, only allow the white list through. | def topic_params
params[:topic][:tag_list] = params[:topic].delete(:tags)
params[:topic].permit(:name, :description, :content, :parent_topic_id, :tag_list )
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 |
can accept search options. by book or by tag: params[:book_id], params[:tag] | def index
if params[:book_id]
@quotes = Book.find(params[:book_id]).quotes
elsif params[:tag]
@quotes = Quote.tagged_with(params[:tag]).order(:created_at)
else
@quotes = Quote.order(:created_at).limit(50)
end
respond_with(quotes: @quotes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:tag]\n @search = Book.approved?(@user).search(tags_name_eq: params[:tag])\n else\n @search = Book.approved?(@user).search(params[:q])\n end\n @books = @search.result.includes(:reviews, :tags).paginate(:page => params[:page]).order(rating: :desc)\n @search.build_c... | [
"0.73485225",
"0.7105141",
"0.70603037",
"0.69446",
"0.6897852",
"0.67624354",
"0.6744391",
"0.6739331",
"0.6713057",
"0.66749245",
"0.6592852",
"0.65648234",
"0.6535827",
"0.64809805",
"0.63986874",
"0.63369465",
"0.6333541",
"0.63205975",
"0.6278877",
"0.62432986",
"0.62347... | 0.0 | -1 |
GET /papers GET /papers.json | def index
@papers = Paper.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def index\n @papers = Paper.all\n end",
"def show\n @venue = Venue.find(params[:id])\n @papers = @venue.papers.order(:listorder)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json... | [
"0.7817853",
"0.6901522",
"0.67550915",
"0.6572619",
"0.6545435",
"0.6453543",
"0.6430495",
"0.642274",
"0.63527143",
"0.63045746",
"0.6227392",
"0.6205611",
"0.61766136",
"0.6142387",
"0.5988508",
"0.59847057",
"0.5972417",
"0.59689146",
"0.5911887",
"0.59098214",
"0.5900857... | 0.68502676 | 5 |
GET /papers/1 GET /papers/1.json | def show
respond_to do |format|
format.html {}
format.json {}
format.rdf { render rdf: @paper }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @papers = Paper.all\n\n render json: @papers\n end",
"def show\n @paper = Paper.find(params[:id])\n @document = Document.where(paper_id: @paper.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @paper }\n end\n end",
... | [
"0.7366392",
"0.68371415",
"0.6662318",
"0.66555285",
"0.65707386",
"0.65707386",
"0.65707386",
"0.65707386",
"0.6547795",
"0.6448477",
"0.63245744",
"0.6310223",
"0.6229214",
"0.61642945",
"0.61002916",
"0.60747206",
"0.60518825",
"0.6051057",
"0.59942913",
"0.5955898",
"0.5... | 0.63189995 | 11 |
POST /papers POST /papers.json | def create
@paper = Paper.new(paper_params)
respond_to do |format|
if @paper.save
format.html { redirect_to @paper, notice: 'Paper was successfully created.' }
format.json { render :show, status: :created, location: @paper }
else
format.html { render :new }
format.json { render json: @paper.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n params = paper_params\n authors = params.delete(:authors).split(\",\").map do |aname|\n Author.find_or_create_by(name: aname.strip)\n end\n\n awards = params.delete(:awards).split(\",\").map do |abody|\n Award.find_or_create_by(body: abody.strip, year: paper_params[:year])\n e... | [
"0.6897804",
"0.68026155",
"0.6722719",
"0.66868454",
"0.66774225",
"0.65337527",
"0.64680845",
"0.6170233",
"0.6154368",
"0.6114335",
"0.60739464",
"0.6039765",
"0.60063684",
"0.5954063",
"0.59012634",
"0.59012634",
"0.59012634",
"0.59012634",
"0.5901189",
"0.59011334",
"0.5... | 0.67253083 | 2 |
PATCH/PUT /papers/1 PATCH/PUT /papers/1.json | def update
respond_to do |format|
if @paper.update(paper_params)
format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }
format.json { render :show, status: :ok, location: @paper }
else
format.html { render :edit }
format.json { render json: @paper.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @paper = Paper.find(params[:id])\n\n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.65842164",
"0.64762634",
"0.64610016",
"0.64433736",
"0.6397956",
"0.6377216",
"0.62301135",
"0.61594945",
"0.61535436",
"0.6143695",
"0.6067672",
"0.6059405",
"0.6040723",
"0.602471",
"0.60238636",
"0.6015431",
"0.6015395",
"0.5982759",
"0.5961736",
"0.5949037",
"0.593074... | 0.6522072 | 2 |
DELETE /papers/1 DELETE /papers/1.json | def destroy
@paper.destroy
respond_to do |format|
format.html { redirect_to papers_url, notice: 'Paper was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @paper = Paper.find(params[:id])\n @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to papers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @author_paper = AuthorPaper.find(params[:id])\n @author_paper.destroy\n\n respond_to ... | [
"0.73830336",
"0.7095339",
"0.6927301",
"0.688844",
"0.688735",
"0.6836361",
"0.67775553",
"0.67721736",
"0.6758027",
"0.6720797",
"0.67138404",
"0.6699268",
"0.6674213",
"0.6650748",
"0.66479254",
"0.6633831",
"0.65898305",
"0.657488",
"0.65695727",
"0.6567983",
"0.6567983",... | 0.7145216 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_paper
@paper = Paper.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 paper_params
params.require(:paper).permit(:title, :author1first, :author1mid, :author1last, :author1workplace, :author2first, :author2mid, :author2last, :author2workplace, :author3first, :author3mid, :author3last, :author3workplace, :author4first, :author4mid, :author4last, :author4workplace, :author5first, :author5mid, :author5last, :author5workplace, :abstract, :creationdate, :sectionurlid, :papernumber, :filefunction, :jel, :keywords, :suppress, :wpid, :series_id, :url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /obsahs GET /obsahs.json | def index
@obsahs = Obsah.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @ahoogahs = Ahoogah.all\n end",
"def index\n @himalayas = Himalaya.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end",
"def... | [
"0.6453749",
"0.64522845",
"0.6340524",
"0.62865925",
"0.61746067",
"0.61554897",
"0.6137299",
"0.60873705",
"0.6064395",
"0.59846044",
"0.5979318",
"0.5971246",
"0.5947471",
"0.59462535",
"0.59398085",
"0.5919802",
"0.59194577",
"0.5912019",
"0.5910387",
"0.59100825",
"0.589... | 0.69971883 | 0 |
GET /obsahs/1 GET /obsahs/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end",
"def index\n @obsahs = Obsah.all\n end",
"def index\n @hikiyamas = @omatsuri.hikiyamas\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hikiyamas }\n format.json ... | [
"0.67951834",
"0.6746184",
"0.6270124",
"0.6258851",
"0.62461567",
"0.62438905",
"0.62043816",
"0.61781573",
"0.6113683",
"0.6070943",
"0.60507256",
"0.6050401",
"0.60477215",
"0.6042769",
"0.6032611",
"0.603045",
"0.6013382",
"0.60064507",
"0.59817183",
"0.59739214",
"0.5963... | 0.0 | -1 |
POST /obsahs POST /obsahs.json | def create
@obsah = Obsah.new(obsah_params)
respond_to do |format|
if @obsah.save
format.html { redirect_to @obsah, notice: 'Obsah was successfully created.' }
format.json { render :show, status: :created, location: @obsah }
else
format.html { render :new }
format.json { render json: @obsah.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @hanghoa = Hanghoa.new(hanghoa_params)\n\n respond_to do |format... | [
"0.6302574",
"0.5985249",
"0.5908059",
"0.58256584",
"0.582149",
"0.57115245",
"0.56679875",
"0.5638376",
"0.56285965",
"0.5617354",
"0.5581958",
"0.5568673",
"0.55490357",
"0.55479395",
"0.55402607",
"0.55354804",
"0.5527957",
"0.550276",
"0.550179",
"0.54875183",
"0.5487398... | 0.6605168 | 0 |
PATCH/PUT /obsahs/1 PATCH/PUT /obsahs/1.json | def update
respond_to do |format|
if @obsah.update(obsah_params)
format.html { redirect_to @obsah, notice: 'Obsah was successfully updated.' }
format.json { render :show, status: :ok, location: @obsah }
else
format.html { render :edit }
format.json { render json: @obsah.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n ... | [
"0.6503249",
"0.6432474",
"0.6369995",
"0.62584984",
"0.6237458",
"0.6190987",
"0.61110306",
"0.60973257",
"0.60755426",
"0.604708",
"0.6029718",
"0.60198945",
"0.60039985",
"0.59858465",
"0.59854394",
"0.5982067",
"0.59737545",
"0.59651923",
"0.5950961",
"0.59433526",
"0.594... | 0.6215955 | 5 |
DELETE /obsahs/1 DELETE /obsahs/1.json | def destroy
@obsah.destroy
respond_to do |format|
format.html { redirect_to obsahs_url, notice: 'Obsah was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSu... | [
"0.72179943",
"0.695193",
"0.6780755",
"0.6763151",
"0.6761551",
"0.6744215",
"0.6701694",
"0.66758955",
"0.66529536",
"0.6646819",
"0.6645998",
"0.6645979",
"0.6625283",
"0.6613382",
"0.6613382",
"0.6613382",
"0.6613382",
"0.6606291",
"0.65841633",
"0.6583906",
"0.6574461",
... | 0.68613887 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_obsah
@obsah = Obsah.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.6164095",
"0.6046031",
"0.5945298",
"0.59179014",
"0.58890367",
"0.58341795",
"0.5776118",
"0.5700777",
"0.5700777",
"0.5656277",
"0.56218207",
"0.5423995",
"0.5411516",
"0.5411516",
"0.5411516",
"0.5395004",
"0.53783494",
"0.53593004",
"0.53412604",
"0.534078",
"0.5332865... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def obsah_params
params.require(:obsah).permit(:pouzivatel, :priradene_profesie, :priradene_obory, :nazov_obsahu, :vzdelavaci_obsah)
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 |
def update p (params[:id]) p ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" | def destroy
@window = Window.find(params[:id])
@window.destroy
flash[:notice] = "successfully deleted"
redirect_to :controller => "windows" , :action=> "index"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\t\t\"update called - updating #{params[:id]}\"\n\t\tend",
"def update(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :patch, params)\n end",
"def update!(**args)\n @id = args[:id] if args.key?(:id)\n end",
"def update!(**args)\n ... | [
"0.8377415",
"0.7391598",
"0.73193735",
"0.73193735",
"0.73193735",
"0.73193735",
"0.73193735",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178",
"0.7289178"... | 0.0 | -1 |
separate the article search for article page , static_page, dynamic_page | def advance_search
if params[:entity_type]=="static-fragment"
@page_properties={:selected_menu=>'static_fragment',:menu_title=>'Static Fragment List'}
else
@page_properties={:selected_menu=>'static_articles',:menu_title=>'Static Page List'}
end
@search=true
@search_data=SearchData.new(params[:search_data]) if params[:search_data]
@article_path="static_page"
@selected_section=@site.static_sections.find(params[:search_data][:section_id]) if params[:search_data] and params[:search_data][:section_id]!=""
session[:per_page]=params[:per_page] if params[:per_page]!=nil
sort_init "updated_at"
sort_update
respond_to do |format|
format.html do
render :action=>"index" ,:entity_type => params[:entity_type]
end
format.js do
render :update do |page|
page.replace_html 'article_list',component_table_list(@site.find_component_by_name("static_article_search"))
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n @search_words = params[:search_word].split(/[#{ActiveSupport::Multibyte::Unicode.codepoints_to_pattern(ActiveSupport::Multibyte::Unicode::WHITESPACE)}]+/)\n @articles = Article.search(params[:search_word], params[:page], current_user)\n @more_link_path = more_articles_path(search_word: params... | [
"0.6789429",
"0.678591",
"0.6670147",
"0.6551789",
"0.65248567",
"0.64468193",
"0.6416405",
"0.64089143",
"0.63872856",
"0.63651615",
"0.63528365",
"0.6310351",
"0.6242196",
"0.6236336",
"0.62360007",
"0.62276953",
"0.62203205",
"0.62148124",
"0.6186862",
"0.61548036",
"0.614... | 0.7186469 | 0 |
Thanks to mojombo for his clippy swf | def clippy(text, bgcolor='#FFFFFF')
html = <<-EOF
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
width="110"
height="14"
id="clippy" >
<param name="movie" value="/flash/clippy.swf"/>
<param name="allowScriptAccess" value="always" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param NAME="FlashVars" value="text=#{text}">
<param name="bgcolor" value="#{bgcolor}">
<embed src="/flash/clippy.swf"
width="110"
height="14"
name="clippy"
quality="high"
allowScriptAccess="always"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer"
FlashVars="text=#{text}"
bgcolor="#{bgcolor}"
/>
</object>
EOF
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def main_sprite ; end",
"def blit; end",
"def frames; end",
"def clippy(text, bgcolor='#FFFFFF')\n html = <<-EOF\n <object classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\"\n width=\"110\"\n height=\"14\"\n id=\"clippy\" >\n <param name=\"movie\" v... | [
"0.61604047",
"0.6082686",
"0.6004981",
"0.592952",
"0.5864999",
"0.57822734",
"0.57701176",
"0.573908",
"0.57035655",
"0.57035655",
"0.57035655",
"0.56761104",
"0.56480163",
"0.55988497",
"0.5569817",
"0.556314",
"0.5558982",
"0.5558319",
"0.555526",
"0.552278",
"0.5492703",... | 0.5995158 | 3 |
cut association between Gitem and Cluster and clear the clustered items | def clear_cluster_by_name(name)
Cluster.where(:word_en_name => name).delete_all
Gitem.where(:word_en_name => name).update_all(:cluster_id => nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retain_k_itemsets(k)\n self.delete_if do |cluster|\n cluster.num_core_items != k\n end \n end",
"def categories_given_without(items,user)\n categorized_items = categories_given_items(items)\n\n categorized_items.each{ |sub_array| clear_category_from_us... | [
"0.6191512",
"0.56647944",
"0.56551903",
"0.5614474",
"0.55767995",
"0.55296695",
"0.5487072",
"0.54146",
"0.53969264",
"0.53848445",
"0.5376399",
"0.5363631",
"0.5345202",
"0.5326996",
"0.5316538",
"0.5312454",
"0.53052694",
"0.52907956",
"0.5269034",
"0.5267798",
"0.5260799... | 0.6256317 | 0 |
cluster those unclustered items | def cluster_by_word_en_name(name)
clusters = Cluster.where(:word_en_name => name).all #modify later, use only recent N clusters
un_clustered_items = Gitem.where(:word_en_name => name, :cluster_id => nil).all
un_clustered_items.each { |item| cluster_item(item, clusters) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def star_cluster; end",
"def cluster_list\n super\n end",
"def cluster_by\n return @cluster_by\n end",
"def cluster_by_value\n return @cluster_by_value\n end",
"def split_cluster(mposts, cluster)\n return nil if mposts.empty?\n # The mposts ... | [
"0.6520829",
"0.6350346",
"0.62525344",
"0.6207324",
"0.6187618",
"0.608973",
"0.6044708",
"0.59596634",
"0.59590846",
"0.5954651",
"0.5939964",
"0.590613",
"0.5858644",
"0.5774703",
"0.5688295",
"0.56403136",
"0.5621813",
"0.56154794",
"0.55654454",
"0.55634695",
"0.55208844... | 0.576183 | 14 |
initialize everything that has to be done to the word and setup instance variables | def initialize(word)
@word = word.split("")
@guesses = @word.length * 2
@underscore_array = @word.map {|x| "_" }
@underscore = @underscore_array.join(" ")
@guessed_array = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize()\r\n\t\t\r\n\t\t@word = WIN32OLE.new('word.application')\r\n\t\t@word.Visible = true\r\n\t\t@word.Documents.Add\r\n\t\t\r\n\t\t@justification = {\r\n\t\t\t\"A gauche\" => 0,\r\n\t\t\t\"Centrer\" => 1,\r\n\t\t\t\"A droite\" => 2,\r\n\t\t\t\"Justifier\" => 3\r\n\t\t}\r\n\tend",
"def initialize\r\n ... | [
"0.738784",
"0.72065735",
"0.7099423",
"0.70740575",
"0.6773413",
"0.6757803",
"0.6738988",
"0.67352563",
"0.66900176",
"0.6679109",
"0.66768414",
"0.6635893",
"0.66285115",
"0.66144985",
"0.66105574",
"0.66105574",
"0.66105574",
"0.66105574",
"0.66105574",
"0.66105574",
"0.6... | 0.0 | -1 |
QUESTION: How do I access class variables outside of the class? For example, I'm trying to output the converted number's unit. I'd like to designate this in TemperatureTools and output in main. How do I do this? | def initialize
@unit = 'f'
@celsius = false; #11/10/15 PS-Changed from 'true'.
@temperature = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_temperature_unit\n\t\t@tempUnit\n\tend",
"def convert_temp(value,unit)\n if unit.chomp == \"f\"\n puts \"fahrenheit: #{value}\"\n puts \"to Celcius: #{((value.to_i - 32) / 1.8).round(2)}\"\n puts \"to Kelvin: #{((value.to_i + 459.67) / 1.8).round(2)}\"\n elsif unit.chomp == \"C... | [
"0.7032637",
"0.6702511",
"0.6337107",
"0.63285035",
"0.62571377",
"0.6255428",
"0.6226489",
"0.62112784",
"0.6208092",
"0.6196414",
"0.61956775",
"0.61831594",
"0.6124282",
"0.60635924",
"0.6039719",
"0.60163796",
"0.59895605",
"0.59795487",
"0.5959435",
"0.5933195",
"0.5904... | 0.6468587 | 2 |
a. definieren Sie eine Methode say_hello mit dem Argument name. Das Ergebnis des Aufrufs ist dann die Ausgabe: 'Ich bin Ludwig' | def say_hello (name)
puts "Ich bin #{name}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_hello_wih_argument (name)\n puts name\nend",
"def say_hello(name)\n puts \"Hello, #{name}!\"\n end",
"def say_hello(name)\n \"Hello, #{name}.\"\n end",
"def say_hello(name,health=0)\n\t\"Ich bin #{name} und mir geht es zu #{health}% gut.\"\nend",
"def hello(name)\n output = []\n ou... | [
"0.80266756",
"0.80039424",
"0.7900596",
"0.78776574",
"0.7868343",
"0.7867913",
"0.78574204",
"0.78151083",
"0.77986646",
"0.77651364",
"0.76740706",
"0.7656614",
"0.7643684",
"0.7640394",
"0.7625125",
"0.7616831",
"0.7562954",
"0.756045",
"0.75595367",
"0.75595367",
"0.7553... | 0.7688125 | 10 |
b. rufen Sie die Methode mit verschiedenen namen auf | def say_hello (name)
puts "Ich bin #{name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def zuruecksetzen()\n end",
"def private; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def probers; end",
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"... | [
"0.72653496",
"0.71602225",
"0.703308",
"0.67515457",
"0.67515457",
"0.67515457",
"0.67515457",
"0.6585142",
"0.6549371",
"0.64987314",
"0.64011717",
"0.64011717",
"0.64011717",
"0.64011717",
"0.6376536",
"0.63596725",
"0.63596725",
"0.6340631",
"0.6242978",
"0.6201863",
"0.6... | 0.0 | -1 |
c. puts soll nun aus der Methode entfernt werden | def say_hello(name)
"Ich bin #{name}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def puts(message); end",
"def puts(*args)\n args.each do |obj|\n self.write \"#{obj.to_s.sub(/\\n$/, '')}\\n\"\n flush\n end\n end",
"def checked_puts object = ''\n real_puts object\n @prev_printed = false\n end",
"def puts(msg)\n # print msg\n # print \"\\n\"\n @lines << \"#... | [
"0.69590366",
"0.69496185",
"0.69117725",
"0.68851197",
"0.6859009",
"0.6845405",
"0.68422407",
"0.6833283",
"0.6784055",
"0.6738092",
"0.6663596",
"0.6639224",
"0.66044104",
"0.6597639",
"0.6565073",
"0.6555877",
"0.65506995",
"0.65431005",
"0.6540792",
"0.65105677",
"0.6499... | 0.0 | -1 |
d. aendern sie die Methode, so dass sie einen Statndarparmameter health entgegennimmt. Die Ausgabe lautet dann: 'Ich bin Ludwig mit einem Wert von 100' | def say_hello(name,health=0)
"Ich bin #{name} und mir geht es zu #{health}% gut."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats\n puts 'You have ' + self.health.to_s + ' health remaining and have ' + self.denarii.to_s + ' denarii to your name.'\n end",
"def health\n (100 * @health.to_f / @max_health).round(2)\n end",
"def healthstats\n\t\t@warrior.health\n\tend",
"def to_s\n if @health < 0\n @healt... | [
"0.6926028",
"0.6858037",
"0.66565835",
"0.65146464",
"0.65065336",
"0.64484656",
"0.63543624",
"0.63163525",
"0.6307553",
"0.62822974",
"0.6275375",
"0.626826",
"0.6229282",
"0.6229282",
"0.62024",
"0.61966383",
"0.618664",
"0.61342436",
"0.6057566",
"0.60144264",
"0.6010175... | 0.56694055 | 62 |
d. updaten Sie das Objekt player1 und lassen sich das objekt anzeigen | def hi
puts "Ich heiße #{@name} und mir geht es zu #{@health}% gut."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setplayer1\r\n\t\t\t@player1 = \"O\"\r\n\t\tend",
"def player1\n @players.first\n end",
"def getplayer1\r\n\t\t\treturn @player1\r\n\t\tend",
"def setplayer2\r\n\t\t\t@player2 = \"X\"\r\n\t\tend",
"def pbChangePlayer(id)\n return false if id<0 || id>=8\n meta=pbGetMetadata(0,MetadataPlayerA... | [
"0.68483365",
"0.67146075",
"0.6624716",
"0.6355698",
"0.6302851",
"0.6223779",
"0.62120885",
"0.6209375",
"0.62085164",
"0.617763",
"0.6160321",
"0.61598355",
"0.61381185",
"0.61215234",
"0.611633",
"0.6061493",
"0.60550046",
"0.598496",
"0.5954423",
"0.5952588",
"0.59487",
... | 0.0 | -1 |
def favorite_params params.require :restaurant.permit(:name, :address, :img_url, :user_rating) end | def search
query = {
'res_id' => params[:id]
}
@search = HTTParty.get('https://developers.zomato.com/api/v2.1/restaurant?', query: query, headers: headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite_restaurant_params\n params.require(:favorite_restaurant).permit(:user_id, :restaurant_id)\n end",
"def restaurant_params\n params.require(:restaurant).permit(:name, :address, :rating)\n end",
"def restaurant_params\n params.require(:restaurant).permit(:name, :address, :description, ... | [
"0.89503765",
"0.8911625",
"0.87972456",
"0.8630613",
"0.8611892",
"0.85746133",
"0.8543731",
"0.8437636",
"0.8354963",
"0.8323558",
"0.8310198",
"0.8277778",
"0.825554",
"0.8254795",
"0.8254795",
"0.82445353",
"0.8227455",
"0.8222082",
"0.81953704",
"0.8190719",
"0.81906176"... | 0.0 | -1 |
instance methods Refer to boards by name throughout the interface. | def to_param
"#{id}-#{name.parameterize}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def board\n end",
"def board\n\n end",
"def get_board()\n raise 'needs implementation'\n end",
"def get_board\n @board\n end",
"def board\n @board ||= Board.find(params[:id])\n end",
"def current_board\n @current_board\n end",
"def board\n game.board\n end",
"def display... | [
"0.6676827",
"0.6631878",
"0.64559454",
"0.6310989",
"0.59247303",
"0.5911178",
"0.5893042",
"0.58903754",
"0.5885357",
"0.5847629",
"0.5847439",
"0.58398414",
"0.5836306",
"0.5800154",
"0.57960045",
"0.5777304",
"0.5770076",
"0.57681495",
"0.5748422",
"0.5747145",
"0.5738994... | 0.0 | -1 |
The layout array for this board. It is derived from the layout_text by walking through the layout_text arrays and finding a Tile with the same name for each name in the layout_text. | def layout
return @layout if @layout
bad_tiles = [] # The set of tile names that didn't work!
@layout = [] # The 2D array of tiles
for row in layout_text
@layout.push(r = [])
for tile_name in row
tile = Tile.find_by_name(tile_name)
r.push(tile)
# Handle an error by remembering the tile name
unless tile
bad_tiles.push(tile_name) unless bad_tiles.include?(tile_name)
end
end
end
# If there was a problem raise the Error.
unless bad_tiles.empty?
@layout = nil
raise Error("Bad tiles: %s" % bad_tiles.join(", "))
end
@layout
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def [](layout_name)\n layouts[layout_name]\n end",
"def getLayoutData\n @layoutData\n end",
"def layout\n\n raise \"Missing bulletin for layout object!\" if (! self.bulletin)\n \n raise \"Missing layout style/name for layout object!\" if (! self.name)\n\n # assume everything prepared if t... | [
"0.590931",
"0.5676871",
"0.5658021",
"0.55244416",
"0.5498113",
"0.5490243",
"0.54761255",
"0.5423547",
"0.54106265",
"0.5365305",
"0.53608483",
"0.5346692",
"0.53379804",
"0.5323639",
"0.5301259",
"0.52933466",
"0.5290587",
"0.5286434",
"0.5225586",
"0.5223056",
"0.5211015"... | 0.79736495 | 1 |
Set the tile at col,row to the Tile so named | def set_tile(col, row, name)
reset_layout
layout_text[col][row] = name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tile_at(x, y, new_tile, layer: :ground)\n new_tile.x = x\n new_tile.y = y\n @layers[:tile_layers][layer][y][x] = new_tile\n end",
"def set_tile(x,y,z)\n @api.send(\"player.setTile(#{x},#{y},#{z})\")\n end",
"def []=(x, y, tile)\n validate_coords(x, y)\n raise 'needs to be a tile' un... | [
"0.7538558",
"0.72934693",
"0.72352135",
"0.71492076",
"0.7050432",
"0.69162256",
"0.69162256",
"0.69162256",
"0.69162256",
"0.6866449",
"0.68635213",
"0.6673846",
"0.66512877",
"0.662555",
"0.6527055",
"0.651597",
"0.6494575",
"0.6397648",
"0.6392952",
"0.63877815",
"0.63744... | 0.82829654 | 1 |
with their corresponding output dictionaries (or errors) and the fixture description Edgar Cabrera, 2015 | def configuration_fixtures
{
'can create a single route' => {
input: %q{
/api:
/resource:
1
},
output: {
'/api/resource' => 1
}
},
'can create multiple nested routes' => {
input: %q{
/entry_1:
/resource_a:
1
/resource_b:
/nested_a:
2
/nested_b:
3
/entry_2:
/resource_c:
4
},
output: {
'/entry_1/resource_a' => 1,
'/entry_1/resource_b/nested_a' => 2,
'/entry_1/resource_b/nested_b' => 3,
'/entry_2/resource_c' => 4
}
},
'allows non-bottom level routes to return a value' => {
input: %q{
/api:
/resource:
1
$body: 2
},
output: {
'/api/resource' => 1,
'/api' => 2
}
},
'allows the specification of a return status code' => {
input: %q{
/api:
/resource_1: 'result'
/resource_2:
$status: 301
$body: 4
},
output: {
'/api/resource_1' => 'result',
'/api/resource_2' => {body: 4, status: 301}
}
},
'disallows using raw keys with meta-fields' => {
input: %q{
/api:
$body: 'hello'
raw: 1
},
output: Embassy::Parser::UnexpectedTypeError
},
'can return an object as a body' => {
input: %q{
/api:
$body:
a: 1
b: 2
c: 3
},
output: {
'/api' => {'a' => 1, 'b' => 2, 'c' => 3}
}
},
'can return an array as body' => {
input: %q{
/api:
$body:
- 1
- 2
- 3
},
output: {
'/api' => [1, 2, 3]
}
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_FailureDescription()\n \t return @outputs[\"FailureDescription\"]\n \tend",
"def gather_results(spec, output, result)\n {\n :arch => RbConfig::CONFIG[\"arch\"],\n :vendor => RbConfig::CONFIG[\"target_vendor\"],\n :os => RbConfig::CONFIG[\"target_os\"],... | [
"0.5940991",
"0.58836275",
"0.5796592",
"0.5595161",
"0.5587278",
"0.5561713",
"0.5532017",
"0.55309194",
"0.5524391",
"0.550294",
"0.5487838",
"0.5442394",
"0.54330933",
"0.542711",
"0.54221916",
"0.54127234",
"0.54127234",
"0.5411155",
"0.54043746",
"0.5399728",
"0.5380069"... | 0.0 | -1 |
show action is open to guest so that they see the events and the slides. | def show
@event = Event.find params[:id]
@slides = @event.slides.page(params[:page]).per(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show()\n view.show\n end",
"def show\n \t\n end",
"def show\n \t\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\r\n\r\n end",
"def show\n \n \n end",
"def show\n \n \n end",
"def show\n \n \n end",
"def show\n \n \n end",... | [
"0.7290275",
"0.716552",
"0.716552",
"0.7130169",
"0.7130169",
"0.7130169",
"0.71008533",
"0.71008533",
"0.71008533",
"0.71008533",
"0.70934933",
"0.70934933",
"0.70934933",
"0.70913625",
"0.706924",
"0.706924",
"0.706924",
"0.70640814",
"0.7061479",
"0.70582014",
"0.70582014... | 0.0 | -1 |
edit this file first! inside irb: `load "bigoh.rb"` using ruby: `ruby bigoh.rb` run test for first few numbers take the output and plug into OEIS.org to get the formula! in OS X Terminal, doubleclicking on the commaseparated string will select it nicely for CmdC ;) | def bigOh
iterations = 6
1.upto(iterations) { |n| print methodA(n).to_s + (n != iterations ? "," : "") }
puts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def n2e(num)\n\n return '' if num.kind_of?(String) and (num =~ /^[0]+$/)\n return '' if num.kind_of?(String) and (num !~ /^\\d+$/)\n \n num = num.to_i if num.kind_of?(String)\n n = num.to_s.split(//)\n len = n.size\n \n # To create constance inside a function, we need to use instance\n # variable... | [
"0.57012534",
"0.56173575",
"0.5560599",
"0.555093",
"0.54990876",
"0.5487078",
"0.54798",
"0.547446",
"0.54519784",
"0.5408359",
"0.532398",
"0.53146845",
"0.5287105",
"0.5278129",
"0.5268188",
"0.52665806",
"0.52347445",
"0.52319795",
"0.5217993",
"0.5216421",
"0.5213104",
... | 0.5045526 | 53 |
method to be tested, edit to insert/change loops as necessary | def methodA(n)
count = 0
for i in 1..n
for j in 1..i
count += f(j)
end
end
return count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_12917265\n setup_changeset_test(12917265)\n assert_equal(6, find_changes('el_type' => 'N').size)\n #assert_equal(3, @tiles.size)\n end",
"def test_should_add_edit_and_remove_line_items_in_invoice\r\n assert_no_difference 'Invoice.count' do\r\n assert_no_difference 'LineItem.count' do\r... | [
"0.5850618",
"0.571484",
"0.5677153",
"0.5676094",
"0.5645146",
"0.56430703",
"0.56274927",
"0.5608583",
"0.5576551",
"0.556129",
"0.55568403",
"0.55229807",
"0.55107707",
"0.5489409",
"0.5477612",
"0.54641247",
"0.5457286",
"0.5432466",
"0.5431299",
"0.54124415",
"0.54048693... | 0.0 | -1 |
model the runtime of a function can be a constant (return 1) to measure number of times of execution or be proportional to the input parameter j | def f(j)
return j
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def k(n); 5 * n * n; end",
"def condition(i, j)\n # first solved the two equations for just i and j\n 500_000 - 1000*i - 1000*j + i*j == 0\nend",
"def combinatory(n,i)\n t = 1.0\n 1.upto(i) do |j|\n t = t* (n-j+1) / j\n end\n return t\nend",
"def s1(n)\n (n*(n+1)/2)**2\nend",
"def weight(i,... | [
"0.6320057",
"0.6184622",
"0.61785465",
"0.60690826",
"0.5956819",
"0.58854806",
"0.5825684",
"0.5820083",
"0.57886577",
"0.5776781",
"0.57558787",
"0.5751441",
"0.5749772",
"0.5749772",
"0.5732457",
"0.57053655",
"0.5662936",
"0.5655168",
"0.5653815",
"0.5646216",
"0.5639031... | 0.0 | -1 |
Is there a better way to solve this? | def display_hand
display_hand = []
@hand.each do |h|
display_hand << "#{create_hand(h)}"
end
display_hand
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def solution4(input)\n end",
"def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if f... | [
"0.54439896",
"0.5279812",
"0.5191856",
"0.5048246",
"0.5016492",
"0.50031245",
"0.49637464",
"0.496176",
"0.49538603",
"0.4949075",
"0.49407354",
"0.49296248",
"0.492747",
"0.48829824",
"0.48744765",
"0.485446",
"0.48435578",
"0.4829026",
"0.48257735",
"0.4824958",
"0.481588... | 0.0 | -1 |
Is there a better way to solve this? | def display_pairs
@display_pairs = []
pairs.each do |pair|
i = 0
result = ""
while i < pair.count
result << "#{create_hand(pair[i])}"
result << ' and ' if i != (pair.count - 1)
i += 1
end
@display_pairs << result if result != ""
end
@display_pairs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def anchored; end",
"def solution4(input)\n end",
"def sluggish_octopus(fishes) \n fishes.each_with_index do |fish1, i1|\n max_length = true\n fishes.each_with_index do |fish2, i2|\n next if i1 == i2\n # puts \"#{fish1} --- #{fish2}\"\n max_length = false if f... | [
"0.54439896",
"0.5279812",
"0.5191856",
"0.5048246",
"0.5016492",
"0.50031245",
"0.49637464",
"0.496176",
"0.49538603",
"0.4949075",
"0.49407354",
"0.49296248",
"0.492747",
"0.48829824",
"0.48744765",
"0.485446",
"0.48435578",
"0.4829026",
"0.48257735",
"0.4824958",
"0.481588... | 0.0 | -1 |
GET /story_threads GET /story_threads.json | def index
previous_post = StoryThreadsController.current_thread.story_posts.last
@last_words = previous_post.last_words
@parent_id = previous_post.id
@finished_threads = StoryThread.finished
@story_post = StoryPost.new
respond_to do |format|
format.html # index.html.erb
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def threads\n @threads = Contribution.where(\"user_id=?\",params[:id]).all.order(\"created_at desc\")\n end",
"def index\n @chat_threads = current_user.chat_threads.order(\"updated_at DESC\")\n render json: @chat_threads, each_serializer: Rest::ChatThreadSerializer\n end",
"def index\n @threads =... | [
"0.654329",
"0.6507265",
"0.64110565",
"0.6361611",
"0.63384986",
"0.6198296",
"0.6180101",
"0.6151384",
"0.6123439",
"0.61115235",
"0.60472846",
"0.60280526",
"0.6005949",
"0.59811854",
"0.59351546",
"0.59351546",
"0.59109867",
"0.58600396",
"0.5859015",
"0.58462065",
"0.583... | 0.63393474 | 4 |
GET /story_threads/1 GET /story_threads/1.json | def show
@story_thread = StoryThread.find(params[:id])
respond_to do |format|
if (@story_thread.end_time.future?)
format.html { redirect_to root_path, notice: 'Thread is not finished and cannot be viewed.' }
else
format.html # show.html.erb
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @my_thread = current_user.organization.my_threads.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_thread }\n end\n end",
"def show\n \n @my_thread = MyThread.find(params[:id])\n @thread_comments = @my_thread.th... | [
"0.66796756",
"0.65120804",
"0.6451149",
"0.6279058",
"0.62153894",
"0.61366194",
"0.6129988",
"0.61233836",
"0.60986096",
"0.6062093",
"0.60064",
"0.5880269",
"0.5863079",
"0.586094",
"0.5808077",
"0.5763892",
"0.576087",
"0.57283306",
"0.57283306",
"0.57159466",
"0.5693027"... | 0.0 | -1 |
custom rendering to print Message below description list | def render_response_for_get(json_response, options)
render_response(json_response, options, rest_object_key) do
record = json_response[rest_object_key]
print_h1 rest_label, [], options
print cyan
print_description_list(rest_column_definitions(options), record, options)
# show log message settings...
print_h2 "Message", options
print cyan
puts record['message']
print reset,"\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render\n out = HighLine.new\n out.wrap_at = 78\n out.say <<-RENDER\n<%=color(\"#{@name}\", :bold)%> [#{@category.upcase}]\n<%='-'*#{@name.length}%>\n#{@description}\nRENDER\n end",
"def message message # yield label or field being used for display for further customization\n @s... | [
"0.6498811",
"0.63494766",
"0.62550765",
"0.6226038",
"0.6169647",
"0.60935724",
"0.60864997",
"0.60642684",
"0.605063",
"0.5989751",
"0.5987386",
"0.5966583",
"0.59378105",
"0.59041816",
"0.59041816",
"0.5888021",
"0.5870219",
"0.58522755",
"0.5828935",
"0.58169997",
"0.5803... | 0.0 | -1 |
Builds the enum from string | def build_from_hash(value)
constantValues = ColorType.constants.select { |c| ColorType::const_get(c) == value }
raise "Invalid ENUM value #{value} for class #ColorType" if constantValues.empty?
value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end",
"def build_from_hash(value)\n constantValues = NewOrResale.... | [
"0.66046983",
"0.6548398",
"0.65373033",
"0.6528928",
"0.64598405",
"0.6446511",
"0.64443517",
"0.6443306",
"0.6406087",
"0.6405894",
"0.6379518",
"0.6374375",
"0.6367104",
"0.6359485",
"0.63550735",
"0.6346857",
"0.63404876",
"0.6319777",
"0.63088304",
"0.6306753",
"0.630464... | 0.6285593 | 33 |
GET /inscriptions GET /inscriptions.xml | def index
@inscriptions = Inscription.includes(:tournament).all
respond_to do |format|
format.html # index.rb
format.xml { render :xml => @inscriptions }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inscriptions = Inscription.all\n end",
"def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end",
"def index\n @subscriptions = Subscription.all\n\n respond_to do |format|\n format.html # index.html.erb\n fo... | [
"0.6662439",
"0.6561078",
"0.65183264",
"0.65183264",
"0.6437558",
"0.63738894",
"0.6282084",
"0.6282084",
"0.6282084",
"0.62718284",
"0.6196949",
"0.61860085",
"0.6179192",
"0.6174059",
"0.6173413",
"0.6168862",
"0.616335",
"0.6110263",
"0.6091775",
"0.6068482",
"0.60665977"... | 0.6752687 | 0 |
GET /inscriptions/1 GET /inscriptions/1.xml | def show
@inscription = Inscription.where(id:params[:id]).
includes(:tournament, :inscription_players => [:player, :series]).first
@inscription.tournament.build_series_map @inscription.own_player
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @inscription }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @inscriptions = Inscription.includes(:tournament).all\n\n respond_to do |format|\n format.html # index.rb\n format.xml { render :xml => @inscriptions }\n end\n end",
"def show\n @subscription = Subscription.find(params[:id])\n\n respond_to do |format|\n format.html # s... | [
"0.66009575",
"0.6392754",
"0.6392754",
"0.6392754",
"0.6374983",
"0.6374983",
"0.63745064",
"0.6279521",
"0.62580913",
"0.6213216",
"0.61995953",
"0.6179211",
"0.6104671",
"0.61023283",
"0.6091419",
"0.6046824",
"0.60196304",
"0.6008216",
"0.59900546",
"0.5982991",
"0.597900... | 0.0 | -1 |
GET /inscriptions/new GET /inscriptions/new.xml | def new
@tournaments = Tournament.all
@inscription = Inscription.new
@inscription.tournament = guess_tournament
respond_to do |format|
format.html # new.rb
format.xml { render :xml => @inscription }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @subscription = Subscription.new\n @subscription.confirmed = true\n get_list_and_segments\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end",
"def new\n @subscription = Subscription.new\n\n respond_to do |for... | [
"0.73041624",
"0.71943206",
"0.71943206",
"0.7057376",
"0.6765874",
"0.6716221",
"0.6700903",
"0.66784877",
"0.664548",
"0.66423225",
"0.6634091",
"0.6602727",
"0.65581685",
"0.6546521",
"0.65269476",
"0.65059936",
"0.6500222",
"0.64806247",
"0.64806247",
"0.64806247",
"0.648... | 0.6200119 | 80 |
POST /inscriptions POST /inscriptions.xml | def create
@inscription = Inscription.new(params[:inscription])
@inscription.email.strip!
if not @inscription.valid? then
# This would not work, tell the user why this is
@tournaments = Tournament.all
render :action => :new
return
end
if @inscription.licence then
if Inscription.find_by_licence_and_tournament_id(@inscription.licence, @inscription.tournament_id) then
flash[:error] = t('flash.inscription_exists', licence: @inscription.licence)
@tournaments = Tournament.all
redirect_to :action => "new"
return
else
if Player.find_by_licence(@inscription.licence).nil? then
flash[:error] = t 'flash.no_player_for_licence', licence: @inscription.licence
@tournaments = Tournament.all
redirect_to :action => "new"
return
end
end
end
if @inscription.email then
if Inscription.find_by_email_and_tournament_id @inscription.email, @inscription.tournament_id then
flash[:error] = t 'flash.inscription_for_email_exists', address: @inscription.email
@tournaments = Tournament.all
redirect_to :action => "new"
return
end
end
add_name_if_missing @inscription
@inscription.create_secret
respond_to do |format|
if @inscription.save
create_keep_informed(@inscription) if @inscription.keep_informed?
Confirmation.confirmation(@inscription, host).deliver
flash[:notice] = t 'flash.inscription_form_created_successfully'
format.html { redirect_to(@inscription) }
format.xml { render :xml => @inscription, :status => :created, :location => @inscription }
else
flash[:notice] = 'inscription could not be saved'
@tournaments = Tournament.all
format.html { render :action => "new" }
format.xml { render :xml => @inscription.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_subscriptions(to_hash)\n end",
"def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end",
"def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_param... | [
"0.6370699",
"0.63383174",
"0.6236548",
"0.59404224",
"0.5902841",
"0.5875228",
"0.5789049",
"0.5788216",
"0.57825357",
"0.5749351",
"0.5738138",
"0.5725756",
"0.56952685",
"0.5692052",
"0.56683904",
"0.5665997",
"0.5664014",
"0.5649161",
"0.56053126",
"0.5601442",
"0.558781"... | 0.0 | -1 |
PUT /inscriptions/1 PUT /inscriptions/1.xml | def update
if session[:id] != params[:id].to_i and @admin.nil? then
flash[:error] = t 'error.may_only_edit_own_inscription'
redirect_to inscriptions_url
return
end
@inscription = Inscription.find(params[:id])
add_name_if_missing @inscription
respond_to do |format|
@inscription.name=params[:inscription][:name]
if @inscription.save
flash[:notice] = t 'notice.inscription_edited_success'
format.html { redirect_to(@inscription) }
format.xml { head :ok }
else
@tournaments = Tournament.all
format.html { render :action => "edit" }
format.xml { render :xml => @inscription.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n ... | [
"0.62270683",
"0.6148252",
"0.6043025",
"0.5871554",
"0.5855499",
"0.5808987",
"0.57794964",
"0.57781446",
"0.5777029",
"0.57154006",
"0.563161",
"0.5575355",
"0.55635023",
"0.55214244",
"0.5519735",
"0.55015403",
"0.54968554",
"0.5492944",
"0.54897785",
"0.5484662",
"0.54807... | 0.0 | -1 |
DELETE /inscriptions/1 DELETE /inscriptions/1.xml | def destroy
if session[:id] != params[:id] and @admin.nil? then
flash[:error] = t 'error.may_only_delete_own_inscription'
redirect_to inscriptions_url
return
end
@inscription = Inscription.find(params[:id])
@inscription.destroy
respond_to do |format|
format.html { redirect_to(inscriptions_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end"... | [
"0.65536386",
"0.6533301",
"0.65114635",
"0.64817816",
"0.6399203",
"0.6399203",
"0.6399203",
"0.63825446",
"0.6320024",
"0.6305504",
"0.6270985",
"0.62674",
"0.6251565",
"0.6251565",
"0.6251565",
"0.6251565",
"0.6251565",
"0.6245776",
"0.61876327",
"0.6162976",
"0.6157869",
... | 0.6240816 | 18 |
Returns whether a given file exists within the storage. | def file?(path)
# :nocov:
false
# :nocov:
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_exists?\n File.exists?(file_path)\n end",
"def exists?\n file.exists?\n end",
"def exists?\n File.exist? file_path\n end",
"def file_exists?\n File.exists?(@filename)\n end",
"def exists?\n FileTest.exists?(@file)\n end",
"def exist?\n ::File.exist... | [
"0.8704748",
"0.84151435",
"0.8258743",
"0.8128153",
"0.81152993",
"0.81069106",
"0.8090961",
"0.8085429",
"0.80805236",
"0.80793065",
"0.80397904",
"0.80115336",
"0.7998872",
"0.7982509",
"0.79448736",
"0.7921696",
"0.79071337",
"0.79044956",
"0.7880094",
"0.7847707",
"0.783... | 0.0 | -1 |
Returns whether a given directory exists within the storage. | def directory?(path)
# :nocov:
false
# :nocov:
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dir_exists?(path)\n begin\n @meta_data = @client.stat(path)\n if (@meta_data[\"type\"] == \"DIRECTORY\")\n return true\n else\n return false\n end\n rescue\n return false\n end \n end",
"def directory_exists?(path)\n... | [
"0.8125628",
"0.8054656",
"0.80539256",
"0.8010437",
"0.7995723",
"0.79605764",
"0.79120326",
"0.7907096",
"0.78637916",
"0.78636456",
"0.7786277",
"0.77859145",
"0.77611107",
"0.7755221",
"0.77255714",
"0.7713048",
"0.77005094",
"0.7695586",
"0.7692372",
"0.767528",
"0.76197... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.