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 |
|---|---|---|---|---|---|---|
Any methods below here | def song_params
#Returns a sanitized hash of the params with nothing extra
#requiring the song model and permitting only these fields
params.required(:song).permit(:title,:artist_name, :artwork)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def operations; end",
"def operations; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def custom; end",
"def custom; end",
"def who_we... | [
"0.7842896",
"0.7587465",
"0.74950874",
"0.74950874",
"0.74950874",
"0.74950874",
"0.72760093",
"0.72760093",
"0.7194511",
"0.7109308",
"0.7109308",
"0.69752413",
"0.69752413",
"0.6968664",
"0.6904021",
"0.6892205",
"0.6892205",
"0.6892205",
"0.6892205",
"0.6892205",
"0.68922... | 0.0 | -1 |
GET /tuiters GET /tuiters.json | def index
@tuiters = Tuiter.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for #{entities} because of #{e.message}\")\n en... | [
"0.6940582",
"0.66415864",
"0.6558677",
"0.6369428",
"0.6329221",
"0.62737584",
"0.6271449",
"0.62660956",
"0.6223621",
"0.62045413",
"0.6187952",
"0.6182104",
"0.6172584",
"0.6134421",
"0.60864866",
"0.60694146",
"0.6065655",
"0.6054601",
"0.6049252",
"0.6046585",
"0.6025698... | 0.71317255 | 0 |
GET /tuiters/1 GET /tuiters/1.json | def show
@tuiter = Tuiter.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @tuiters = Tuiter.all\n end",
"def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs f... | [
"0.6811072",
"0.6468253",
"0.6436418",
"0.6292779",
"0.61729753",
"0.6130288",
"0.60809314",
"0.605266",
"0.6014502",
"0.59905916",
"0.5954175",
"0.59373534",
"0.5924705",
"0.59200037",
"0.59043103",
"0.5895822",
"0.5893968",
"0.5874728",
"0.5865565",
"0.5864936",
"0.58623797... | 0.6226233 | 4 |
POST /tuiters POST /tuiters.json | def create
@tuiter = current_user.tuiters.new(tuiter_params)
respond_to do |format|
if @tuiter.save
format.html { redirect_to @tuiter, notice: 'Tuiter was successfully created.' }
format.json { render :show, status: :created, location: @tuiter }
else
format.html { render :ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :json,\n accept: :json\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n ... | [
"0.65398055",
"0.6291924",
"0.59515613",
"0.5920423",
"0.59033483",
"0.5862219",
"0.58397293",
"0.5820478",
"0.5801294",
"0.5783595",
"0.572369",
"0.5708551",
"0.5689968",
"0.5676024",
"0.567324",
"0.5670576",
"0.56635886",
"0.5650273",
"0.56412876",
"0.5617724",
"0.5608187",... | 0.68252236 | 0 |
PATCH/PUT /tuiters/1 PATCH/PUT /tuiters/1.json | def update
@tuiter = current_user.tuiters.find(params[:id])
respond_to do |format|
if @tuiter.update(tuiter_params)
format.html { redirect_to @tuiter, notice: 'Tuiter was successfully updated.' }
format.json { render :show, status: :ok, location: @tuiter }
else
format.html { ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @ty.update(ty_params)\n format.html { redirect_to @ty, notice: 'Tie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ty.errors, status: :unpr... | [
"0.62987226",
"0.6269833",
"0.62202924",
"0.6217671",
"0.6164537",
"0.61376375",
"0.61140984",
"0.60916424",
"0.60548306",
"0.6052009",
"0.6037454",
"0.6006319",
"0.59903973",
"0.5989462",
"0.5989462",
"0.5977762",
"0.5942859",
"0.5925088",
"0.59243834",
"0.5923917",
"0.59136... | 0.65386224 | 0 |
DELETE /tuiters/1 DELETE /tuiters/1.json | def destroy
@tuiter = current_user.tuiters.find(params[:id])
@tuiter.destroy
respond_to do |format|
format.html { redirect_to tuiters_url, notice: 'Tuiter was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tetramod = Tetramod.find(params[:id]... | [
"0.7134025",
"0.70193624",
"0.6900573",
"0.6846984",
"0.68050754",
"0.6797261",
"0.6768648",
"0.67603266",
"0.67583066",
"0.67583066",
"0.6746772",
"0.6746372",
"0.67454165",
"0.6736604",
"0.6736604",
"0.6707625",
"0.67028815",
"0.6699637",
"0.66986436",
"0.66933507",
"0.6680... | 0.7038717 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_tuiter
@tuiter = Tuiter.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 tuiter_params
params.require(:tuiter).permit(:user_id, :content, :photo)
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 |
For any number that is a multiple of 3, print 'Fizz' For any number that is a multiple of 5, print 'Buzz' For any number that is a multiple of both 3 and 5, print 'FizzBuzz' For all other numbers, print the number. | def fizzbuzz(num)
i = 0;
num.times do
i += 1
# Check to see if num is a multiple of 3 but not 5
if (i % 3 == 0 && i % 5 != 0)
p "Fizz"
# Check to see if num is a multiple of 5 but not 3
elsif (i % 5 == 0 && i % 3 != 0)
p "Buzz"
# Check to see if num is a multiple ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multiples(num)\n# \"each\" loop for each integer\n (1..num).each do |num|\n # numbers that are mulitples of 3 and 5\n if num % 3 == 0 && num % 5 == 0\n puts \"FizzBuzz\"\n # multiples of 5\n elsif num % 5 == 0\n puts \"Buzz\"\n # multiples of 3\n ... | [
"0.8361797",
"0.8309741",
"0.82808745",
"0.82808334",
"0.82793045",
"0.8267715",
"0.8263662",
"0.82557034",
"0.82522607",
"0.82522607",
"0.82522607",
"0.82522607",
"0.82522607",
"0.82522607",
"0.82402563",
"0.82293725",
"0.82289743",
"0.8224857",
"0.8204748",
"0.8187627",
"0.... | 0.795865 | 48 |
Never trust parameters from the scary internet, only allow the white list through. | def customer_params
params.require(:customer).permit(:name, :email_id, :phone_no, :category_id, :to_get_done, :image)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
write a function caesar_cipher(str, shift) THIS IS A SPECIAL CHIPHER. Say alphabet = ('a'..'z').to_a. Instead of maping alphabet[n] => alphabet[n + shift], map alphabet[n] => alphabet[n shift]. you should still wrap your index if it becomes larger than 25. Assume lowercase and no punctuation. Preserve spaces. | def caesar_cipher(str, shift)
alphabet ||= ('a'..'z').to_a
res = ""
str.chars.each do |letter|
if letter == " "
res += letter
else
old_idx = alphabet.index(letter)
new_idx = old_idx*shift % 26
res += alphabet[new_idx]
end
end
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def caesar_cipher(str, shift)\n alpha = ('a'..'z').to_a\n\n str.split(' ').map do |word|\n word.chars.map { |x| alpha[(alpha.index(x) + shift) % 26] }.join\n end.join(' ')\nend",
"def caesar_cipher(str, shift)\n letters = (\"a\"..\"z\").to_a\n\n encoded_str = \"\"\n str.each_char do |char|\n if char ... | [
"0.9067013",
"0.9034722",
"0.8998305",
"0.89942205",
"0.89843035",
"0.89643896",
"0.89634126",
"0.8931543",
"0.8916494",
"0.8907049",
"0.88979185",
"0.88518465",
"0.8818629",
"0.88108224",
"0.87952495",
"0.8791422",
"0.8754484",
"0.8739783",
"0.8737447",
"0.8731616",
"0.86974... | 0.90782297 | 0 |
params we use: :inputs => script filename and any input files it uses (type: Pathname or array of them) :cmd => command to run :output => (abs or rel to cwd) Pathname for output file, or array of them | def initialize(params)
super
inputs = ensureArray(requireParam(params, :inputs))
@cmd = requireParam(params, :cmd)
outputs = ensureArray(requireParam(params, :output)).map {|filepath| if filepath.relative? then canonicalizeFilepath(filepath, Dir.pwd()) else filepath end}
inputs.each {|filepath| addPrereq f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_cmd(input); end",
"def read_and_execute(inp)\n args = inp.split(' ') # Split the input by space\n cmd_name = args[0] # First argument of the command name\n cmd_args = args[1..inp.length] # Second argument is the argument of the commands\n @commands_available[cmd_name].execute(... | [
"0.67931163",
"0.611696",
"0.604761",
"0.5995606",
"0.5859852",
"0.58361566",
"0.58241576",
"0.5809839",
"0.5801674",
"0.5786828",
"0.57492155",
"0.5741215",
"0.57231176",
"0.5721825",
"0.56931585",
"0.5691845",
"0.5683503",
"0.5668869",
"0.56519324",
"0.5644746",
"0.5604376"... | 0.6267271 | 1 |
update dependences (in BuildEnv and in rake) as necessary at build time return: whether we're done updating and can progress to actual build steps | def updateDeps(rakeTask)
#no-op
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def up_to_date?(targets, command, deps, env, options = {})\n Array(targets).each do |target|\n cache_key = get_cache_key(target)\n\n unless Rscons.phony_target?(target)\n # target file must exist on disk\n unless File.exist?(target)\n if options[:debug]\n ... | [
"0.6691769",
"0.6642655",
"0.6642655",
"0.62062657",
"0.6137424",
"0.6078064",
"0.60547656",
"0.60219353",
"0.5881262",
"0.5778993",
"0.57385004",
"0.5727465",
"0.57253474",
"0.5705865",
"0.5690923",
"0.56433636",
"0.56267947",
"0.5625909",
"0.5611093",
"0.56108046",
"0.55895... | 0.58496094 | 9 |
run build commands return: none | def build(rakeTask)
printAndCall(@cmd)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build\n if phase.has_key?('build')\n execute(\"build\", phase['build'])\n end\n end",
"def build\n cd_and_sh( pkg_dir, build_commands )\n end",
"def run_make()\n result = false\n Dir.chdir(PATH_BUILD) do\n result = call_system_command(CMD_BUILD_MAKE)\n puts \"penguin mak... | [
"0.74894005",
"0.74118084",
"0.693515",
"0.6912765",
"0.6864459",
"0.67274386",
"0.6717369",
"0.6700021",
"0.6608848",
"0.6564791",
"0.6545539",
"0.65438247",
"0.65289116",
"0.65277207",
"0.6527637",
"0.6433794",
"0.64102805",
"0.63795215",
"0.63631994",
"0.63354605",
"0.6288... | 0.56952935 | 100 |
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted: | def store_dir
# "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
"#{Rails.application.secrets[:carrierwave_store_dir]}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_dir\n 'file_uploads'\n end",
"def store_dir\n \"uploads\"\n end",
"def store_dir\n 'uploads'\n end",
"def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # D... | [
"0.75068045",
"0.7366448",
"0.7332805",
"0.73325366",
"0.7303435",
"0.7298843",
"0.72783065",
"0.72783065",
"0.72783065",
"0.7269316",
"0.7245341",
"0.7229466",
"0.72267234",
"0.7202735",
"0.718704",
"0.7179192",
"0.7165246",
"0.71505165",
"0.71505165",
"0.71505165",
"0.71505... | 0.0 | -1 |
zdefinowac w pliku secrets | def cache_dir
"#{Rails.application.secrets[:carrierwave_cache_dir]}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def secret(name)\n Config::Core::File.new(@path + \"secret-#{name}\")\n end",
"def secrets=(_arg0); end",
"def secrets=(_arg0); end",
"def secret_file\n config[:secret_file] ||\n Chef::Config[:knife][:secure_data_bag][:secret_file]\n end",
"def secret\n decrypt_secre... | [
"0.72872776",
"0.7123556",
"0.7123556",
"0.67813075",
"0.6694642",
"0.6694642",
"0.6693945",
"0.6693945",
"0.6670088",
"0.6600355",
"0.65964895",
"0.65843374",
"0.65747577",
"0.65747577",
"0.65747577",
"0.65747577",
"0.65741146",
"0.6571749",
"0.6571749",
"0.6563556",
"0.6530... | 0.0 | -1 |
process convert: :png, if: :not_convertable? | def full_filename (for_file = model.source.file)
super.chomp(File.extname(super)) + '.png'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def imagemagick?; end",
"def convert(format)\n manipulate! do |img|\n \t@format = format\n img.convert\n img = yield(img) if block_given?\n img\n end\n end",
"def imagemagick7?; end",
"def convert_standalone_image(el, _opts, img); end",
"def convert_to_img\n\t\t\t`gs ... | [
"0.6733594",
"0.6378538",
"0.63755405",
"0.6271144",
"0.61416024",
"0.6111061",
"0.60641795",
"0.6023521",
"0.59987354",
"0.5977289",
"0.59513986",
"0.5918654",
"0.5914412",
"0.59080696",
"0.5906524",
"0.58252317",
"0.58103627",
"0.57500446",
"0.57404035",
"0.5730764",
"0.572... | 0.0 | -1 |
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this: def extension_whitelist %w(jpg jpeg gif png) end Override the filename of the uploaded files: Avoid using model.id or version_name here, see uploader/store.rb for details. def filename "something.jpg" if origi... | def override_content_type_and_save_info
case File.extname(file.file).delete('.').to_sym
when :xlsx
file.content_type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
when :docx
file.content_type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whiteli... | [
"0.7380505",
"0.735746",
"0.735746",
"0.735746",
"0.7353778",
"0.7319156",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7292911",
"0.7277899",
"0.72448605",
"0.... | 0.0 | -1 |
override this if you want to specialize the default scope on your trigrams store | def fuzzily_scope
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search_scope\n super\n end",
"def set_search_scope(opts)\n opts = check_params(opts,[:search_scopes])\n super(opts)\n end",
"def default_scope; end",
"def define_scopes(custom_plural = T.unsafe(nil)); end",
"def set_t_scope\n @t_scope = :bookmarks\n end",
"def scope_optio... | [
"0.5996451",
"0.55916697",
"0.5525323",
"0.54763657",
"0.5419209",
"0.5390488",
"0.5390488",
"0.5376583",
"0.5351724",
"0.5344652",
"0.53232354",
"0.526834",
"0.52379715",
"0.523319",
"0.523319",
"0.5174832",
"0.51606905",
"0.5143238",
"0.5129832",
"0.5106126",
"0.5077748",
... | 0.0 | -1 |
todo draw and draw_multiple should be one function, refactor | def draw(options)
csv = Roo::CSV.new(options['csv'])
budgets = extract_available_budgets(csv.column(options['budgets_col']))
normalized_deadlines = normalize_deadlines(csv, extract_available_deadlines(csv, options), options)
budgets.each_index do |i|
budget = budgets[i]
scores_for_budget = []
first... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\t\t\n\tend",
"def draw\n\n\t\tend",
"def draw; end",
"def draw; end",
"def draw\n end",
"def draw\n end",
"def draw\n end",
"def draw\n\t\t\t\t\n\t\t\tend",
"def draw\n\t\tend",
"def draw\n end",... | [
"0.7014345",
"0.7014345",
"0.7014345",
"0.7014345",
"0.69941044",
"0.698861",
"0.698861",
"0.69327176",
"0.69327176",
"0.69327176",
"0.69084007",
"0.68976796",
"0.6873424",
"0.67479205",
"0.6746223",
"0.6696784",
"0.660919",
"0.660919",
"0.660919",
"0.65461516",
"0.651185",
... | 0.0 | -1 |
METHODS TO CALL ON DB. C.R.U.D. FUNCTIONALITY | def sql_command_menu
puts "\n\n\n\n"
puts "======================="
puts " Available Commands: "
puts "=======================\n\n"
puts
puts %q{ Please select a command:
(1) -- Create People Table.
(2) -- Create Posts Table.
(3) -- Create All Tables.
(4) -- Update People Table.
(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select(db); end",
"def select(db); end",
"def db; end",
"def db; end",
"def query; end",
"def db(*args); data(1, args); end",
"def query\n end",
"def method_missing(method, *args)\n return @@db.send(method, *args) if @@db.respond_to?(method)\n super\n end",
"def execute; end",
"... | [
"0.71962094",
"0.71962094",
"0.71942294",
"0.71942294",
"0.7129624",
"0.7079625",
"0.67188966",
"0.6696786",
"0.6652427",
"0.6652427",
"0.66179776",
"0.6567529",
"0.6561333",
"0.6561333",
"0.6525359",
"0.64835817",
"0.64835817",
"0.64727956",
"0.6438037",
"0.641992",
"0.63788... | 0.0 | -1 |
Public: Normalize channel to adapter supported format channel The string channel name Returns The normalized channel prefixed with supported format for Faye | def normalize_channel(channel)
"/#{channel}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def normalized_channel_name(channel, add_prefix=true)\n norm_chan = channel.dup\n norm_chan.downcase! unless options[:case_sensitive_channel_names]\n norm_chan = \"##{norm_chan}\" unless server_type.channel_prefix?(channel[0,1]) or not add_prefix\n return norm_chan\n end",
"def channel\n ... | [
"0.67498285",
"0.6312421",
"0.59670454",
"0.58920765",
"0.5847849",
"0.5828631",
"0.5652836",
"0.5594834",
"0.55451983",
"0.5517829",
"0.5465537",
"0.5432646",
"0.54153305",
"0.53898644",
"0.5306843",
"0.5261964",
"0.52168185",
"0.51955795",
"0.5186779",
"0.5178247",
"0.51347... | 0.72921246 | 0 |
this method is only used for properties that are searched through find method, because QT_API returns graphic string in search results | def graphic_url
QuickTravel.url + graphic if graphic.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getgraphics(*)\n super.to_s\n end",
"def painter_name\n # Return back the name of my painter\n self.painter.name\n end",
"def property(_name)\n raise Orocos::NotFound, \"#property is not implemented in #{self.class}\"\n end",
"def updateSearching(sender)\n info = ''\n ... | [
"0.58587897",
"0.55810183",
"0.557908",
"0.5494443",
"0.54053795",
"0.5309483",
"0.51091254",
"0.49845615",
"0.49643773",
"0.49568015",
"0.4954914",
"0.49542683",
"0.49542084",
"0.49541986",
"0.49235675",
"0.49231467",
"0.49068007",
"0.49020812",
"0.4898533",
"0.4896885",
"0.... | 0.0 | -1 |
Show invalid properties with the reasons. Usually used together with valid? | def list_invalid_properties
invalid_properties = Array.new
invalid_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil.... | [
"0.76497203",
"0.76497203",
"0.76497203",
"0.76497203",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7637422",
"0.7356452",
"0.7334807",
"0.72685325",
"0.7238964",
"0.7231359",
"0.72258264",
"0.7208294",
"0.71760833"
] | 0.7170241 | 96 |
Check to see if the all the properties in the model are valid | def valid?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_properties\n true\n end",
"def validate_properties\n true\n end",
"def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :... | [
"0.7900103",
"0.7900103",
"0.7097818",
"0.7077233",
"0.7031574",
"0.70310163",
"0.6952408",
"0.68700933",
"0.68573046",
"0.68573046",
"0.68288",
"0.6823968",
"0.6822039",
"0.68153054",
"0.6793949",
"0.67525256",
"0.6684135",
"0.66756153",
"0.6669457",
"0.6629309",
"0.66185474... | 0.0 | -1 |
Checks equality by comparing each attribute. | def ==(o)
return true if self.equal?(o)
self.class == o.class &&
communications_campaign_names == o.communications_campaign_names &&
communications_email_subjects == o.communications_email_subjects &&
communications_flow_names == o.communications_flow_names &&
email_d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ==(other)\n attributes == other.attributes\n end",
"def ==(other) # :nodoc:\n @attrs == other.attrs\n end",
"def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en... | [
"0.72932124",
"0.7189842",
"0.70406866",
"0.7007727",
"0.68881786",
"0.68621296",
"0.67085785",
"0.66622394",
"0.661674",
"0.6586541",
"0.65844727",
"0.65818226",
"0.65561724",
"0.6545535",
"0.6508076",
"0.64813215",
"0.64577025",
"0.64179385",
"0.6414028",
"0.6414028",
"0.64... | 0.0 | -1 |
Calculates hash code according to all attributes. | def hash
[communications_campaign_names, communications_email_subjects, communications_flow_names, email_domains, geolocation_countries, geolocation_states, language_iso_codes, max_values, page_views, preferred_languages, referrer_domains, time_on_site_max, time_on_site_min, urls, user_agent_device_names, user_ag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash() end",
"def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ... | [
"0.7118691",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.70400536",
"0.68960655",
"0.67847186",
"0.6707762",
"0.670052",
"0.6688737",
"0.66705376",
"0.6489735",
"0.6462376",
"0.6462376",
"0.64444333",
"0.6413127",
"0.6395483",
"0.638... | 0.0 | -1 |
Builds the object from hash | def build_from_hash(attributes)
return nil unless attributes.is_a?(Hash)
self.class.swagger_types.each_pair do |key, type|
if type =~ /\AArray<(.*)>/i
# check to ensure the input is an array given that the attribute
# is documented as an array but the input is not
if at... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end",
"def build_from_hash(attributes)\n\n end",
"def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ... | [
"0.8011074",
"0.7470833",
"0.7457607",
"0.7256629",
"0.72455454",
"0.70060325",
"0.6973257",
"0.6955014",
"0.69459796",
"0.69398683",
"0.69363195",
"0.6917627",
"0.6872358",
"0.6796184",
"0.6783521",
"0.67575246",
"0.67575246",
"0.67560464",
"0.67514306",
"0.67136854",
"0.666... | 0.0 | -1 |
Deserializes the data based on type | def _deserialize(type, value)
case type.to_sym
when :DateTime
DateTime.parse(value)
when :Date
Date.parse(value)
when :String
value.to_s
when :Integer
value.to_i
when :Float
value.to_f
when :BOOLEAN
if value.to_s =~ /\A(true|t|yes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s... | [
"0.7331687",
"0.727466",
"0.72510564",
"0.7246295",
"0.72190756",
"0.721442",
"0.7191511",
"0.71839666",
"0.71802425",
"0.71802425",
"0.71802425",
"0.71802425",
"0.71802425",
"0.71802425",
"0.71802425",
"0.7179591",
"0.7179591",
"0.7179591",
"0.7179591",
"0.7179591",
"0.71795... | 0.72299516 | 18 |
Returns the string representation of the object | def to_s
to_hash.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @object.to_s\n end",
"def to_s\n object.to_s\n end",
"def serialize(object)\n object.to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"def to_s\n @string || @object.to_s('F')\n end",
"de... | [
"0.9010481",
"0.8950689",
"0.84703803",
"0.8340893",
"0.83363867",
"0.83363867",
"0.8331558",
"0.82545733",
"0.81452745",
"0.814375",
"0.8135387",
"0.8126432",
"0.80925727",
"0.8086306",
"0.80725205",
"0.803857",
"0.8030969",
"0.80052185",
"0.80052185",
"0.80052185",
"0.80052... | 0.0 | -1 |
to_body is an alias to to_hash (backward compatibility) | def to_body
to_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_body\r\n to_hash\r\n end",
"def to_body\n to_hash\nend",
"def to_body\n to_hash\nend"
] | [
"0.84283537",
"0.8347048",
"0.8347048"
] | 0.0 | -1 |
Returns the object in the form of hash | def to_hash
hash = {}
self.class.attribute_map.each_pair do |attr, param|
value = self.send(attr)
next if value.nil?
hash[param] = _to_hash(value)
end
hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash\n object\n end",
"def hash\r\n return to_s.hash\r\n end",
"def hash\n to_a.hash\n end",
"def hash\n [_hash, name, owner].hash\n end",
"def hash\n return to_s.hash\n end",
"def hash\n @hash\n end",
"def hash\n @hash.hash\n end",
"def hash\n ... | [
"0.8270299",
"0.78767854",
"0.78726953",
"0.7802364",
"0.7789188",
"0.77806795",
"0.7775915",
"0.7767511",
"0.7760525",
"0.7760525",
"0.77559966",
"0.7731286",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",
"0.7713916",... | 0.0 | -1 |
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value | def _to_hash(value)
if value.is_a?(Array)
value.compact.map { |v| _to_hash(v) }
elsif value.is_a?(Hash)
{}.tap do |hash|
value.each { |k, v| hash[k] = _to_hash(v) }
end
elsif value.respond_to? :to_hash
value.to_hash
else
value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [value].hash\n end",
"def hash\n [value].hash\n end",
"def hash\n\t\tvalue.hash\n\tend",
"def hash\n value.hash\n end",
"def hash\n @value.hash\n end",
"def hash\r\n return to_s.hash\r\n end",
"def to_hash\n @value\n end",
"def to_hash\n @va... | [
"0.6721729",
"0.6721729",
"0.6670509",
"0.66586363",
"0.65893847",
"0.64539677",
"0.641838",
"0.641838",
"0.6383302",
"0.63453764",
"0.63036317",
"0.6224793",
"0.6154382",
"0.6103922",
"0.60805297",
"0.60805297",
"0.60734206",
"0.60371464",
"0.6021932",
"0.59395087",
"0.59055... | 0.0 | -1 |
, :rescue_nil => true | def initialize(identifier)
@identifier = identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returns_nil; end",
"def error(exception) nil ; end",
"def catch_exceptions; end",
"def nil?; false; end",
"def null?; @null; end",
"def is_exception?; end",
"def null?; false end",
"def try(*args)\n nil\n end",
"def try(*args)\n nil\n end",
"def safely\n yield\n rescue Exception\... | [
"0.7107188",
"0.6776557",
"0.67038035",
"0.6639586",
"0.66032696",
"0.65738845",
"0.6552447",
"0.64611095",
"0.64608854",
"0.6456729",
"0.6347977",
"0.6337442",
"0.6337442",
"0.6337442",
"0.6337442",
"0.6337442",
"0.6328864",
"0.6302423",
"0.6300365",
"0.6300365",
"0.6300365"... | 0.0 | -1 |
, :rescue_nil => true | def initialize(identifier)
@identifier = identifier
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def returns_nil; end",
"def error(exception) nil ; end",
"def catch_exceptions; end",
"def nil?; false; end",
"def null?; @null; end",
"def is_exception?; end",
"def null?; false end",
"def try(*args)\n nil\n end",
"def try(*args)\n nil\n end",
"def safely\n yield\n rescue Exception\... | [
"0.71094924",
"0.6775137",
"0.6700952",
"0.6640609",
"0.66054744",
"0.6569774",
"0.6554422",
"0.646154",
"0.646132",
"0.6456475",
"0.6347559",
"0.63345",
"0.63345",
"0.63345",
"0.63345",
"0.63345",
"0.63262385",
"0.6305307",
"0.6300286",
"0.6300286",
"0.6300286",
"0.6251390... | 0.0 | -1 |
returns the word of the sentence that contains the most vowels. | def most_vowels(str)
words = str.split(" ")
hash = Hash.new(0)
words.each do |word|
hash[word] = vowel_count(word)
end
sorted_hash = hash.sort_by { |key, val| val} # [["a", 1], ["what", 1], ["life", 2], ["wonderful", 3]]
return sorted_hash[-1][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_vowels(sentence)\n \tcountMost = 0\n \tmostVowelWord = \"\"\n \tsentence.split.each do |word|\n \tcurrent = countVowels(word)\n \tif current > countMost\n countMost = current\n mostVowelWord = word\n end\n end\n \treturn mostVowelWord\nend",
"def most_vowels(sente... | [
"0.8664968",
"0.8269816",
"0.82411313",
"0.8125318",
"0.8087403",
"0.80791146",
"0.7851711",
"0.77639204",
"0.7598772",
"0.7574426",
"0.7509496",
"0.74968374",
"0.74751735",
"0.7403814",
"0.7321625",
"0.7232883",
"0.7216693",
"0.71875465",
"0.71827126",
"0.71494734",
"0.70960... | 0.78452533 | 7 |
GET /coversations GET /coversations.json | def index
@coversations = Coversation.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @covers = Cover.all\n end",
"def index\n @covers = Cover.all\n end",
"def index\n skip_authorization\n @discovers = Discover.all\n end",
"def index\n @covers = Cover.all(:order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n forma... | [
"0.658302",
"0.658302",
"0.6572223",
"0.65477985",
"0.60144746",
"0.5964048",
"0.58421165",
"0.57331944",
"0.5685471",
"0.5651875",
"0.56376237",
"0.56134427",
"0.5520361",
"0.5508434",
"0.55075145",
"0.550068",
"0.550068",
"0.54709387",
"0.5408973",
"0.54028803",
"0.53954506... | 0.73930365 | 0 |
GET /coversations/1 GET /coversations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coversations = Coversation.all\n end",
"def index\n @covers = Cover.all(:order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @covers }\n end\n end",
"def index\n @covers = Cover.all\n end",
"def index\n ... | [
"0.722953",
"0.67556244",
"0.6669359",
"0.6669359",
"0.6551324",
"0.62626374",
"0.6218487",
"0.620283",
"0.613541",
"0.59223324",
"0.59096014",
"0.5768042",
"0.5752485",
"0.5752485",
"0.57421243",
"0.57306135",
"0.5654762",
"0.56345147",
"0.56222963",
"0.5612345",
"0.55901706... | 0.0 | -1 |
POST /coversations POST /coversations.json | def create
@coversation = Coversation.new(coversation_params)
respond_to do |format|
if @coversation.save
format.html { redirect_to @coversation, notice: 'Coversation was successfully created.' }
format.json { render :show, status: :created, location: @coversation }
else
for... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @coversations = Coversation.all\n end",
"def create\n @movie = Movie.new(movie_params)\n\n respond_to do |format|\n if @movie.save\n params[:covers]['path'].each do |cover|\n @movie.covers.create!(:path => cover, :movie_id => @movie.id)\n end\n format.html... | [
"0.6403755",
"0.61224717",
"0.5842342",
"0.5842342",
"0.5781772",
"0.577849",
"0.5530728",
"0.550766",
"0.5498556",
"0.54971796",
"0.5428796",
"0.539319",
"0.53846955",
"0.53644013",
"0.53644013",
"0.5343707",
"0.5319428",
"0.53083605",
"0.5291534",
"0.5266901",
"0.52336985",... | 0.575421 | 6 |
PATCH/PUT /coversations/1 PATCH/PUT /coversations/1.json | def update
respond_to do |format|
if @coversation.update(coversation_params)
format.html { redirect_to @coversation, notice: 'Coversation was successfully updated.' }
format.json { render :show, status: :ok, location: @coversation }
else
format.html { render :edit }
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @movie.update(movie_params)\n if params[:covers].present?\n params[:covers]['path'].each do |cover|\n @movie.covers.create!(:path => cover, :movie_id => @movie.id)\n end\n end\n format.html { redirect_back_or_default... | [
"0.62690437",
"0.6167196",
"0.6131728",
"0.5924418",
"0.5855574",
"0.5818039",
"0.5807593",
"0.5806879",
"0.57737106",
"0.5742467",
"0.57333845",
"0.5674964",
"0.5671876",
"0.566046",
"0.5658592",
"0.56584",
"0.5651488",
"0.5648857",
"0.56418973",
"0.5630963",
"0.56207323",
... | 0.0 | -1 |
DELETE /coversations/1 DELETE /coversations/1.json | def destroy
@coversation.destroy
respond_to do |format|
format.html { redirect_to coversations_url, notice: 'Coversation was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cover = Cover.find(params[:id])\n @cover.destroy\n\n respond_to do |format|\n format.html { redirect_to covers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cover.destroy\n respond_to do |format|\n format.html { redirect_to covers_url, not... | [
"0.7020864",
"0.6863481",
"0.6863481",
"0.6859586",
"0.684928",
"0.6808539",
"0.6779715",
"0.6779715",
"0.668395",
"0.6656753",
"0.66039115",
"0.6563917",
"0.65353173",
"0.6522979",
"0.6514759",
"0.650329",
"0.649673",
"0.6490759",
"0.6488777",
"0.6480112",
"0.64467096",
"0... | 0.6372878 | 26 |
Use callbacks to share common setup or constraints between actions. | def set_coversation
@coversation = Coversation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def coversation_params
params.require(:coversation).permit(:title, :description)
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 |
initialize a multipart message body | def initialize (boundary = nil)
@parts = [ ]
if boundary.nil?
@boundary = "XXXArangoBatchXXX"
else
@boundary = boundary
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(headers, body)\n content_type = headers['Content-Type']\n boundary = content_type.parameters['boundary']\n\n if boundary.nil?\n raise Malformed.new(\"Expected multipart Content-Type header to contain 'boundary' parameter\",\n 1)\n else... | [
"0.74401504",
"0.6941627",
"0.6867997",
"0.6840404",
"0.6798734",
"0.6727389",
"0.66922194",
"0.6641884",
"0.6533138",
"0.65241414",
"0.65081394",
"0.6496907",
"0.6480434",
"0.64144677",
"0.63997287",
"0.63950604",
"0.6389266",
"0.6368478",
"0.6363507",
"0.63438267",
"0.63167... | 0.5943563 | 44 |
get the message boundary | def getBoundary
return @boundary
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def boundary\n @raw.split(\"boundary=\")[1].split(\"\\n\")[0]\n end",
"def boundary\n @boundary\n end",
"def boundary\n return unless multipart?\n @boundary ||= Mail::Field.new(\"content-type\", http.headers[\"content-type\"]).parameters['boundary']\n end",
"def boundary\n ... | [
"0.7981573",
"0.79287404",
"0.74379444",
"0.7349238",
"0.70599926",
"0.7051294",
"0.679338",
"0.6570189",
"0.65639365",
"0.63122845",
"0.62847245",
"0.62842816",
"0.62308276",
"0.61070824",
"0.6049894",
"0.59687436",
"0.5918791",
"0.5918094",
"0.58227503",
"0.56832767",
"0.55... | 0.79817545 | 0 |
add a part to a multipart message body | def addPart (method, url, headers, body, contentId = "")
part = { :method => method, :url => url, :headers => headers, :body => body, :contentId => contentId }
@parts.push(part)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_part(part)\n if !body.multipart? && !self.body.decoded.blank?\n @text_part = Mail::Part.new('Content-Type: text/plain;')\n @text_part.body = body.decoded\n self.body << @text_part\n add_multipart_alternate_header\n end\n add_boundary\n self.body << part\n ... | [
"0.82945585",
"0.766621",
"0.70559376",
"0.6998622",
"0.6938634",
"0.6915176",
"0.6739071",
"0.6669604",
"0.6555636",
"0.6518154",
"0.64676493",
"0.64079195",
"0.63909805",
"0.63570666",
"0.6354564",
"0.63455147",
"0.6223544",
"0.6198075",
"0.61839676",
"0.60711575",
"0.60699... | 0.69842565 | 4 |
split the response body into its individual parts | def getParts (boundary, body)
parts = [ ]
valid = false
while 1
position = body.index("--" + boundary)
break if position != 0 or position == nil
follow = body.slice(position + boundary.length + 2, 2)
break if follow != "\r\n" and follow != "--"
if follow == "--"
va... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def seperate_body()\n\t\t@stream.split(\"\\n\\n\", 2)[1]\n\tend",
"def splitResponsePack(responsePack)\n responseList = [] ;\n while(responsePack.length > 0)\n # get length\n len = DataType_UByte.unpack!(responsePack) ;\n len -= DataType_UByte.size ; # reduced len\n ... | [
"0.6975885",
"0.6743964",
"0.65876627",
"0.65154487",
"0.6486759",
"0.6257521",
"0.6166212",
"0.6127869",
"0.6124171",
"0.60500157",
"0.6046758",
"0.6036674",
"0.60340357",
"0.60016185",
"0.599835",
"0.5994839",
"0.5972009",
"0.5965223",
"0.5963885",
"0.59119105",
"0.5905781"... | 0.68158567 | 1 |
get the string representation of a multipart message body | def to_s
body = ""
@parts.each do|part|
# boundary
body += "--" + @boundary + "\r\n"
# header
body += "Content-Type: application/x-arango-batchpart"
if part[:contentId] != ""
body += "\r\nContent-Id: " + part[:contentId]
end
body += "\r\n\r\n"
# ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def body\n if mail.multipart?\n mail.parts.map { |part| Nokogiri::HTML(part.body.decoded).text }.join(\"\\n\\n\")\n else\n Nokogiri::HTML(mail.body.decoded).text\n end\n end",
"def part(mime_type)\n part = mail.parts.find{|p| p.mime_type == mime_type}\n part.body.to_s if part\n end",
... | [
"0.73712415",
"0.6731442",
"0.66277957",
"0.6621024",
"0.6607919",
"0.65985596",
"0.65846974",
"0.6584556",
"0.6584556",
"0.65630966",
"0.65624297",
"0.65365446",
"0.64888287",
"0.6478383",
"0.64722896",
"0.6421798",
"0.64011425",
"0.63659865",
"0.6355467",
"0.6313195",
"0.63... | 0.6632685 | 2 |
GET /bulletins GET /bulletins.xml | def index
@bulletins = Bulletin.paginate(:all, :order => 'created_at DESC', :per_page => 10, :page => params[:page])
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @bulletins }
format.rss { render :layout => false }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bulletins = Bulletin.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bulletins }\n end\n end",
"def show\n @bulletin = Bulletin.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { r... | [
"0.66284496",
"0.6557519",
"0.6557519",
"0.6298632",
"0.61619186",
"0.6093195",
"0.5964486",
"0.59538984",
"0.5863918",
"0.5850464",
"0.5800815",
"0.5769365",
"0.57293266",
"0.5698601",
"0.5595",
"0.5590565",
"0.55342734",
"0.55304813",
"0.5509216",
"0.5471115",
"0.54145855",... | 0.6608205 | 1 |
GET /bulletins/1 GET /bulletins/1.xml | def show
@bulletin = Bulletin.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @bulletin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bulletins = Bulletin.paginate(:all, :order => 'created_at DESC', :per_page => 10, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bulletins }\n format.rss { render :layout => false }\n end\n end",
"def index\n... | [
"0.6645446",
"0.64890033",
"0.6463182",
"0.6210962",
"0.6125897",
"0.6069543",
"0.6063016",
"0.60380477",
"0.5808617",
"0.5803943",
"0.5742981",
"0.5742924",
"0.5698566",
"0.5604115",
"0.5600329",
"0.5551532",
"0.5531302",
"0.5521861",
"0.5489326",
"0.5444433",
"0.54376364",
... | 0.68775254 | 1 |
GET /bulletins/new GET /bulletins/new.xml | def new
@bulletin = Bulletin.new
@bulletin.display_until = Time.now.since(7.days)
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @bulletin }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @bulletin = Bulletin.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bulletin }\n end\n end",
"def new\n @bulletin = Bulletin.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bull... | [
"0.7491202",
"0.7213592",
"0.69093376",
"0.68222135",
"0.6800667",
"0.659762",
"0.6539768",
"0.65195817",
"0.6463418",
"0.6432398",
"0.64222914",
"0.6385189",
"0.6368293",
"0.6367723",
"0.6367723",
"0.6363792",
"0.6342524",
"0.6328939",
"0.6327535",
"0.63085675",
"0.63073653"... | 0.62992203 | 21 |
POST /bulletins POST /bulletins.xml | def create
@bulletin = Bulletin.new(params[:bulletin])
@bulletin.user = current_user
respond_to do |format|
if @bulletin.save
flash[:notice] = 'Bulletin was successfully created.'
format.html { redirect_to(@bulletin) }
format.xml { render :xml => @bulletin, :status => :create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @bulletin = Bulletin.new(params[:bulletin])\n\n respond_to do |format|\n if @bulletin.save\n flash[:notice] = 'Bulletin was successfully created.'\n format.html { redirect_to(@bulletin) }\n format.xml { render :xml => @bulletin, :status => :created, :location => @bulle... | [
"0.6422804",
"0.6303599",
"0.5908809",
"0.58704567",
"0.5738449",
"0.5700263",
"0.56255984",
"0.5599304",
"0.5598284",
"0.5568569",
"0.55541646",
"0.54883343",
"0.54751956",
"0.5427867",
"0.5387401",
"0.53602904",
"0.534405",
"0.53253096",
"0.52775013",
"0.52527255",
"0.52447... | 0.62735605 | 2 |
PUT /bulletins/1 PUT /bulletins/1.xml | def update
@bulletin = Bulletin.find(params[:id])
respond_to do |format|
if @bulletin.update_attributes(params[:bulletin])
flash[:notice] = 'Bulletin was successfully updated.'
format.html { redirect_to(@bulletin) }
format.xml { head :ok }
else
format.html { render ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bulletin = Bulletin.find(params[:id])\n\n respond_to do |format|\n if @bulletin.update_attributes(params[:bulletin])\n format.html { redirect_to @bulletin, notice: 'Bulletin has been updated.' }\n format.json { head :no_content }\n else\n format.html { render acti... | [
"0.6555018",
"0.6178845",
"0.6121651",
"0.5831887",
"0.573428",
"0.55985796",
"0.55491835",
"0.5527941",
"0.5499113",
"0.54972196",
"0.54287016",
"0.5397702",
"0.5391171",
"0.53852654",
"0.5383255",
"0.53780705",
"0.5368072",
"0.53581154",
"0.53201336",
"0.5292849",
"0.526876... | 0.6711095 | 1 |
DELETE /bulletins/1 DELETE /bulletins/1.xml | def destroy
@bulletin = Bulletin.find(params[:id])
if (current_user != @bulletin.user)
flash[:error] = "This bulletin can only be deleted by #{@bulletin.user.login}."
redirect_to(bulletins_url)
return
end
@bulletin.destroy
respond_to do |format|
format.html { redirect_t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @bulletin = Bulletin.find(params[:id])\n @bulletin.destroy\n\n respond_to do |format|\n flash[:notice] = 'Bulletin was successfully removed.'\n format.html { redirect_to(bulletins_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bulletin = Bulletin.find... | [
"0.715154",
"0.68181133",
"0.6645186",
"0.6306096",
"0.627134",
"0.61866045",
"0.61537814",
"0.6113544",
"0.61039424",
"0.60958046",
"0.609481",
"0.60938466",
"0.60904455",
"0.6079989",
"0.6043889",
"0.6040093",
"0.6037611",
"0.6004731",
"0.6002334",
"0.5996825",
"0.599106",
... | 0.6606637 | 3 |
GET /trials/1 GET /trials/1.xml | def show
@trial = Trial.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @trial }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def show\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trial ... | [
"0.6455325",
"0.63403314",
"0.62679386",
"0.6238086",
"0.6176045",
"0.59208447",
"0.58383536",
"0.5796926",
"0.5773541",
"0.56708795",
"0.56697667",
"0.5644533",
"0.5641433",
"0.5606891",
"0.55835944",
"0.5575981",
"0.553889",
"0.55211014",
"0.55211014",
"0.55147",
"0.5509353... | 0.708527 | 0 |
GET /trials/new GET /trials/new.xml | def new
@mode = params[:mode]
@eventID = params[:event_id]
@trial = Trial.new
if !@eventID.nil?
@event = Event.find(@eventID)
@trial.event_id = @eventID
end
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @trial }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end",
"def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trial }\n end\n en... | [
"0.79213166",
"0.72461754",
"0.7164848",
"0.7125318",
"0.65755737",
"0.64915645",
"0.6489564",
"0.6454047",
"0.6454047",
"0.63882256",
"0.63846743",
"0.6348695",
"0.6348695",
"0.6348695",
"0.63227135",
"0.6318691",
"0.6307796",
"0.62801623",
"0.62801623",
"0.6264935",
"0.6260... | 0.6073742 | 60 |
POST /trials POST /trials.xml | def create
@trial = Trial.new(params[:trial])
respond_to do |format|
if @trial.save
format.html { redirect_to(@trial, :notice => 'Trial was successfully created.') }
format.xml { render :xml => @trial, :status => :created, :location => @trial }
else
format.html { render :ac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @trial = Trial.new(params[:trial])\n\n respond_to do |format|\n if @trial.save\n flash[:notice] = 'Trial was successfully created.'\n format.html { redirect_to(@trial) }\n format.xml { render :xml => @trial, :status => :created, :location => @trial }\n else\n ... | [
"0.71222913",
"0.67276937",
"0.659643",
"0.6337531",
"0.63176155",
"0.62637657",
"0.61412215",
"0.6122079",
"0.60857475",
"0.599422",
"0.59796077",
"0.5950309",
"0.59136254",
"0.5852075",
"0.58003944",
"0.57540935",
"0.5675326",
"0.5657487",
"0.5561974",
"0.5475188",
"0.54674... | 0.7127944 | 0 |
PUT /trials/1 PUT /trials/1.xml | def update
@trial = Trial.find(params[:id])
startTime = Time.zone.parse(params[:trial]["start"])
endTime = Time.zone.parse(params[:trial]["end"])
# move to model with before_save.
# See http://stackoverflow.com/questions/1424777/how-to-convert-user-input-hours-minutes-seconds
if !start... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trial = Trial.find(params[:id])\n\n respond_to do |format|\n if @trial.update_attributes(params[:trial])\n flash[:notice] = 'Trial was successfully updated.'\n format.html { redirect_to(@trial) }\n format.xml { head :ok }\n else\n format.html { render :act... | [
"0.69470036",
"0.624497",
"0.6207726",
"0.62004614",
"0.6138431",
"0.59592867",
"0.59536713",
"0.59472924",
"0.5942978",
"0.593443",
"0.5856135",
"0.5852582",
"0.58412987",
"0.580071",
"0.5787631",
"0.5785825",
"0.57271385",
"0.5714027",
"0.56873924",
"0.56532186",
"0.5603022... | 0.5184941 | 79 |
DELETE /trials/1 DELETE /trials/1.xml | def destroy
@trial = Trial.find(params[:id])
@trial.destroy
respond_to do |format|
format.html { redirect_to(trials_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @testcase = Testcase.find(params[:id])\n @testcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(testca... | [
"0.66106206",
"0.64824325",
"0.6421248",
"0.6387784",
"0.6380229",
"0.6350266",
"0.6316285",
"0.6307214",
"0.6304542",
"0.62871355",
"0.6286438",
"0.6273298",
"0.62615937",
"0.62515026",
"0.6245197",
"0.62292403",
"0.6227967",
"0.6227562",
"0.6210164",
"0.6195747",
"0.6178816... | 0.73777854 | 0 |
Converts Arel AST to SQL | def to_sql(arel, binds = [])
if arel.respond_to?(:ast)
binds = binds.dup
visitor.accept(arel.ast) do
quote(*binds.shift.reverse)
end
else
arel
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_arel_sql(value)\n case value\n when Arel::Nodes::Node, Arel::Nodes::SqlLiteral, nil\n value\n when ActiveRecord::Relation\n Arel.sql(value.spawn.to_sql)\n else\n Arel.sql(value.respond_to?(:to_sql) ? value.to_sql : value.to_s)\n end\n end",
... | [
"0.6883481",
"0.6832208",
"0.6794755",
"0.6463359",
"0.6372896",
"0.6372896",
"0.63125294",
"0.63125294",
"0.61947703",
"0.61936367",
"0.60955334",
"0.6086671",
"0.6035507",
"0.5925386",
"0.5896752",
"0.5763533",
"0.57386804",
"0.5731007",
"0.5681014",
"0.5679765",
"0.5670754... | 0.74858975 | 0 |
lista widgets segun rol | def index
widgets_per_page = 7
@search = Widget.searchlogic(params[:search])
if params[:shared] && has_role_with_hierarchy?(:registrado)
@groups = Group.all :conditions => ["id IN (?)", GroupsUsers.find(:all, :conditions => { :user_id => current_user.id }).map(&:group_id).join(',').to_i]
@widge... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widgets\n @widgets\n end",
"def extend_widget_by\n []\n end",
"def buttons; end",
"def widgets= mine_widgets\n @widgets = []\n mine_widgets.each do |widget|\n self.add_widget widget\n end\n end",
"def repaint_all_widgets\n $log.debug \" REPAINT ALL in FORM c... | [
"0.6514419",
"0.63887954",
"0.62657076",
"0.60538304",
"0.5964423",
"0.5928174",
"0.59099066",
"0.58641416",
"0.58641416",
"0.5815517",
"0.5790219",
"0.57878464",
"0.57772386",
"0.5756141",
"0.5730997",
"0.5728355",
"0.5712741",
"0.5696347",
"0.56906337",
"0.5667468",
"0.5643... | 0.0 | -1 |
muestra los datos de un widgets | def show
@widget = Widget.find(params[:id])
@rate = @widget.ratings.average :rate
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widgets\n @widgets\n end",
"def get_data()\n\t\tself.data[:control_widget][:pages_list] = Page.all\n\tend",
"def widgets\n @form.widgets\n end",
"def generate_watcher_widgets\n @dtw_all_watchers = {}\n @watchers.each { | w, wname, wdesc |\n @dtw_all_watchers[w] = g = {}\n ... | [
"0.6615757",
"0.6439246",
"0.6061024",
"0.5934188",
"0.59099364",
"0.5868256",
"0.57981014",
"0.5767239",
"0.5742729",
"0.5723292",
"0.56864184",
"0.56557876",
"0.56420666",
"0.5642029",
"0.56350464",
"0.55467135",
"0.55404645",
"0.5508373",
"0.5490617",
"0.54851305",
"0.5458... | 0.0 | -1 |
instancia un nuevo widget | def new
@widget = Widget.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget\n end",
"def widget\n end",
"def create_widget\n widget_class.new(widget_assigns)\n end",
"def add_widget widget\n self.init_widget widget\n @widgets << widget\n end",
"def create\n @placeholder = params[:placeholder]\n @page_id = params[:page_id]\n @reg_id = params[:... | [
"0.71267605",
"0.71267605",
"0.70480317",
"0.7002198",
"0.6729167",
"0.64778745",
"0.6431317",
"0.6363335",
"0.63595766",
"0.6318769",
"0.6301132",
"0.6244127",
"0.6241865",
"0.6228843",
"0.6191675",
"0.61876607",
"0.61844075",
"0.616169",
"0.6142723",
"0.6130591",
"0.6101183... | 0.7007294 | 3 |
guarda el nuevo widget | def create
@widget = Widget.new(params[:widget])
@widget.user_id = current_user.id
unless params[:image_remote_url].blank?
image = Image.create(:image_remote_url => params[:image_remote_url])
if image.save
@widget.image_id = image.id
end
else
@widget.image_id = Image.fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def widget\n end",
"def widget\n end",
"def new\n @widget = Widget.new\n end",
"def create\n @placeholder = params[:placeholder]\n @page_id = params[:page_id]\n @reg_id = params[:reg_id]\n\n # dropped from list of registered widgets\n @widget = Widget.create(:page_id => @page_id, :placeh... | [
"0.71945363",
"0.71945363",
"0.6999744",
"0.69672745",
"0.69135344",
"0.67599857",
"0.66017115",
"0.65463763",
"0.6406646",
"0.6366069",
"0.6299763",
"0.62291354",
"0.6226848",
"0.6135022",
"0.6124206",
"0.6124206",
"0.61166286",
"0.61049813",
"0.6088317",
"0.60384905",
"0.60... | 0.59909165 | 23 |
GET /program_subjects GET /program_subjects.json | def index
@program_subjects = ProgramSubject.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"tr... | [
"0.736215",
"0.70645535",
"0.68111104",
"0.6666074",
"0.65763026",
"0.6551474",
"0.6519052",
"0.6467039",
"0.64486814",
"0.64056283",
"0.64056283",
"0.63747746",
"0.6370847",
"0.6354062",
"0.6311597",
"0.6277847",
"0.62677777",
"0.62605476",
"0.62434816",
"0.6234539",
"0.6226... | 0.7629921 | 0 |
GET /program_subjects/1 GET /program_subjects/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @program_subjects = ProgramSubject.all\n end",
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).wher... | [
"0.74476856",
"0.7038781",
"0.6892394",
"0.67865413",
"0.67032015",
"0.66133296",
"0.6559538",
"0.6474515",
"0.6439594",
"0.64137393",
"0.63982975",
"0.6341981",
"0.6299294",
"0.6298523",
"0.6289756",
"0.6289756",
"0.62776214",
"0.6260726",
"0.62521076",
"0.62407154",
"0.6198... | 0.0 | -1 |
POST /program_subjects POST /program_subjects.json | def create
@program_subject = ProgramSubject.new(program_subject_params)
respond_to do |format|
if @program_subject.save
format.html { redirect_to @program_subject}
format.json { render :show, status: :created, location: @program_subject }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def program_subject_params\n params.require(:program_subject).permit(:subject_id, :program_id)\n end",
"def create\n admin_only\n @subject = Subject.new(subject_params)\n\n new_tutor_ids = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teachin... | [
"0.68007284",
"0.63677925",
"0.6340063",
"0.6224504",
"0.61976415",
"0.6151405",
"0.6105777",
"0.610286",
"0.6085287",
"0.60778415",
"0.6070735",
"0.6067865",
"0.6044012",
"0.6025982",
"0.60024166",
"0.59791267",
"0.5971155",
"0.59507114",
"0.5946593",
"0.5940144",
"0.5939809... | 0.70487547 | 0 |
PATCH/PUT /program_subjects/1 PATCH/PUT /program_subjects/1.json | def update
respond_to do |format|
if @program_subject.update(program_subject_params)
format.html { redirect_to @program_subject}
format.json { render :show, status: :ok, location: @program_subject }
else
format.html { render :edit }
format.json { render json: @program_sub... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n\n format.html { redirect_to subjects_url, :notice => 'Subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ... | [
"0.6582458",
"0.6548675",
"0.6506356",
"0.6467831",
"0.64542127",
"0.63066566",
"0.6269726",
"0.6253759",
"0.6244738",
"0.62438595",
"0.623121",
"0.6230779",
"0.6208324",
"0.62078553",
"0.62078553",
"0.6207292",
"0.6202592",
"0.6184159",
"0.6178055",
"0.6171472",
"0.61645293"... | 0.7154518 | 0 |
DELETE /program_subjects/1 DELETE /program_subjects/1.json | def destroy
@program_subject.destroy
respond_to do |format|
format.html { redirect_to program_subjects_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @subject = @client.subjects.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n flash[:notice] = 'Subject was successfully removed.' \n format.html { redirect_to(client_subjects_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n ... | [
"0.7062074",
"0.704719",
"0.6967772",
"0.6957798",
"0.694381",
"0.69383544",
"0.6863754",
"0.68282634",
"0.67759377",
"0.6747032",
"0.67415965",
"0.6725793",
"0.67231417",
"0.6720906",
"0.67201924",
"0.66761565",
"0.6673675",
"0.66730946",
"0.66601944",
"0.6649335",
"0.663438... | 0.7665464 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_program_subject
@program_subject = ProgramSubject.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def program_subject_params
params.require(:program_subject).permit(:subject_id, :program_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
A method ending with ? should return a value which can be evaluated to true or false logged_in? coerces the return value of current_user into a Boolean by use of a doublebang | def logged_in?
!!logged_in_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n !!current_user #smart way of giving the true if true and not just opposite!\n end",
"def logged_in?\n!!current_user\nend",
"def logged_in? \n # !!current_user either returning true or false without if statement\n if current_user #forcing current_user user object: true, or nil: false\... | [
"0.87165165",
"0.8681722",
"0.8669738",
"0.8624986",
"0.86247003",
"0.85802054",
"0.8564055",
"0.8564055",
"0.8564055",
"0.8564055",
"0.8564055",
"0.8564055",
"0.8525608",
"0.8512869",
"0.85013026",
"0.8474455",
"0.84658575",
"0.8465798",
"0.8465798",
"0.8465798",
"0.8465798"... | 0.832369 | 72 |
POST /questionary_choices POST /questionary_choices.json | def create
@questionary_choice = QuestionaryChoice.new(questionary_choice_params)
@questionary_item = QuestionaryItem.find(@questionary_choice.questionary_item_id)
@questionary = Questionary.find(@questionary_item.questionary_id)
@questionary_choice_value = QuestionaryChoice.where(questionary_item_id: @... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def questionary_choice_params\n params.require(:questionary_choice).permit(:content, :value, :questionary_item_id)\n end",
"def choice_params\n params.require(:choice).permit(:answer, :correct_answer)\n end",
"def question_params\n params.require(:question).permit(:question_title, :quiz_id, ... | [
"0.73659295",
"0.7085286",
"0.7035255",
"0.6902787",
"0.68564373",
"0.6838112",
"0.6814315",
"0.68092966",
"0.67487645",
"0.65926206",
"0.654797",
"0.65203476",
"0.64855915",
"0.63829464",
"0.6378975",
"0.6353414",
"0.6350093",
"0.62844646",
"0.6260822",
"0.62336046",
"0.6210... | 0.686476 | 4 |
Never trust parameters from the scary internet, only allow the white list through. | def questionary_choice_params
params.require(:questionary_choice).permit(:content, :value, :questionary_item_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6980629",
"0.67819995",
"0.67467666",
"0.67419875",
"0.67347664",
"0.65928614",
"0.6504013",
"0.6498014",
"0.64819515",
"0.64797956",
"0.64562726",
"0.64400834",
"0.6380117",
"0.6377456",
"0.63656694",
"0.6320543",
"0.63002014",
"0.62997127",
"0.629425",
"0.6293866",
"0.62... | 0.0 | -1 |
AJAX only signs and dates approvals | def sign_approval
approval = params[:approval]
approval_by = "#{approval}_by"
approval_date = "#{approval}_date"
@return[approval_by] = current_user.id
@return[approval_date] = Time.now
if @return.save
respond_to do |format|
format.js {}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approval\n @minimal_ui = true\n render :approval\n end",
"def set_admitted!\n if remote?\n update(admitted: true, start_date: Date.today.to_datetime, \n graduation_date: (Date.today + 1.month).to_datetime, remaining_mentor_sessions: 4, \n bootstrap_access: true, ruby_acce... | [
"0.57027394",
"0.57012606",
"0.56013745",
"0.5589125",
"0.5580787",
"0.5570847",
"0.55692565",
"0.55333596",
"0.5513371",
"0.5509771",
"0.5504302",
"0.5491463",
"0.5491126",
"0.5484603",
"0.5466649",
"0.54529357",
"0.5436843",
"0.54084134",
"0.5402313",
"0.53839916",
"0.53709... | 0.67093456 | 0 |
Format a rediscompliant key with the provded suffix | def key(spec)
return "site-#{self.subdomain.to_s}-#{spec.to_s}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_key(key)\n key.to_s.gsub(\"-\",\"_\")\n end",
"def key(msg_id, suffix)\n \"#{msg_id}:#{suffix}\"\n end",
"def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end",
"def default_key_format(key)\n snake(key)\n end",
"def redis_key_for(id)\n \"#{redis_... | [
"0.7417872",
"0.7334631",
"0.70628345",
"0.6863377",
"0.67810494",
"0.6658407",
"0.664943",
"0.6614822",
"0.66092443",
"0.65951586",
"0.65898085",
"0.6564258",
"0.65469575",
"0.6484256",
"0.64826936",
"0.6451375",
"0.6445364",
"0.6430679",
"0.64137995",
"0.6389247",
"0.632015... | 0.0 | -1 |
Load the last 10 messages for this site from redis, parse the JSON (redis can only store strings, all data is stored as JSON), and parse the timestamp to a proper Ruby Timeobject. Finally, reverse the list since the datastructure in redis will be sorted created_at, while we want created_at desc since we grad from head ... | def messages(limit=10)
$redis.lrange(key('messages'), 0, 10).map{|a| b = JSON.parse(a); b['date'] = Time.at(b['timestamp'].to_i/1000); b }.reverse
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def messages\n object.messages.sort_by do |message|\n message.created_at\n end\n end",
"def index\n @channel = Channel.find(params[:channel_id])\n time = params[:ts] || 2.hours.ago\n @messages = @channel.messages.created_after(time)\n\n render json: @messages\n end",
"def recentMessage... | [
"0.6328507",
"0.60578287",
"0.5992459",
"0.59653306",
"0.5943274",
"0.59150624",
"0.59007955",
"0.57885426",
"0.5663525",
"0.5659919",
"0.56576836",
"0.5641593",
"0.56395835",
"0.56072766",
"0.5606313",
"0.5592661",
"0.5545417",
"0.552405",
"0.5522367",
"0.5519333",
"0.549848... | 0.77039474 | 0 |
Do not load currently online users from Redis at the moment, since we can't render it properly. In order to keep public class API, return an empty list | def users
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def online_friends\n users = []\n OnlineStatus.online_users\n $redis.sinter(\"#{key}:friends\", \"OnlineUsers\").each do |u|\n users << User.new(u)\n end\n users\n end",
"def getAllOnlineUsers\n return false if !@usrData\n @usrData[login]\n end",
"def users\n result = Rails... | [
"0.75619996",
"0.71213156",
"0.70708853",
"0.704645",
"0.6910727",
"0.6879626",
"0.67937493",
"0.6694075",
"0.6663773",
"0.6598473",
"0.6475317",
"0.64729226",
"0.6469",
"0.6427149",
"0.63260436",
"0.631111",
"0.63037056",
"0.6290217",
"0.62752795",
"0.6209119",
"0.6197673",
... | 0.6594608 | 10 |
Calculate a random SHA1hash to use as unique identifier for this specific siteobject, globally across all versions of Talkie | def make_auth_hash
self.auth_hash = Digest::SHA1.hexdigest(self.object_id.to_s + Time.now.to_i.to_s + self.name.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end",
"def ensure_hash_id\n self.hash_id ||= unique_random_string_of_length(75 + Random.rand(26))\n end",
"def generate_hash_code\n\t\tself.hash_co... | [
"0.7028084",
"0.7001445",
"0.6901322",
"0.68140996",
"0.68140996",
"0.6785201",
"0.6756215",
"0.674534",
"0.6712797",
"0.669213",
"0.663368",
"0.6612373",
"0.6588758",
"0.65544295",
"0.64972126",
"0.6469945",
"0.6435394",
"0.64352256",
"0.6419851",
"0.6416395",
"0.6415363",
... | 0.6022468 | 83 |
Store a representation of this site in redis as a hashobject, since NodeJS will require it to access the site, validate it and route messages to it properly | def set_redis_key
$redis.hmset key('chat'),
'active', 1,
'site_id', self.id,
'user_id', self.user_id,
'site_name', self.name,
'authkey', self.auth_hash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site_data_hash; end",
"def save\n $redis.hsetnx RedisContainer, self.full_name, self.to_json\n end",
"def save\n return false if !valid?\n @id = self.class.next_id\n $redis[attr_key :url] = @url\n $redis[attr_key :description] = @description\n $redis[attr_key :score] = @sco... | [
"0.61701035",
"0.6064853",
"0.60536605",
"0.60474926",
"0.5696466",
"0.56673455",
"0.5540095",
"0.5500394",
"0.54946315",
"0.5473683",
"0.54389405",
"0.5431941",
"0.5397037",
"0.5397037",
"0.5396252",
"0.53596604",
"0.53561604",
"0.5337837",
"0.5336024",
"0.53331417",
"0.5330... | 0.58936393 | 4 |
When deleting a site, remove the representations of it from redis | def cleanup
$redis.del key('chat')
$redis.del key('messages')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n Site.delete_all \"sitename = 'lost+found'\" \n super\n end",
"def delete_site_cache\n Rails.cache.delete([\"Site\", self.id])\n end",
"def delete\n redis.del key\n end",
"def delete(site)\n\t\tputs \"Remove entry from the site store: #{site} \" if @verbose\n\t\t# Addition... | [
"0.75698173",
"0.7216383",
"0.6701341",
"0.6611811",
"0.66033286",
"0.655677",
"0.6551919",
"0.65027654",
"0.648775",
"0.6440963",
"0.641535",
"0.64116275",
"0.6404149",
"0.6400615",
"0.63683",
"0.63453174",
"0.6329273",
"0.632307",
"0.6283022",
"0.62660694",
"0.62459236",
... | 0.64969283 | 8 |
Require: Access token with PROFILE permission issued. | def raw_info
@raw_info ||= JSON.load(access_token.get('v2/profile').body)
rescue ::Errno::ETIMEDOUT
raise ::Timeout::Error
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile\n authorize @profile\n end",
"def require_access_token\n # make sure the request has been signed correctly\n verify_signature\n \n # NOTE make sure you define Controller#find_token which\n # returns an object that responds to the access_token? message\n # access_token? should retu... | [
"0.6842659",
"0.6366886",
"0.63330674",
"0.62940305",
"0.6282877",
"0.6274476",
"0.6264166",
"0.62326413",
"0.6153232",
"0.6134619",
"0.60207623",
"0.60175085",
"0.6016258",
"0.6010104",
"0.6002718",
"0.6002718",
"0.5988262",
"0.59851813",
"0.59434646",
"0.59038556",
"0.59035... | 0.0 | -1 |
GET /invoices/1 GET /invoices/1.json | def show
@invoice = Invoice.find(params[:id])
respond_to do |format|
format.html { @html = true }# show.html.erb
format.json { @html = false
render :json => @invoice }
format.pdf { @html = false
@pdf = true
kit = PDFKit.new(render_to_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n '/api/invoices'\n end",
"def index\n @invoices = @user.invoices.all\n render json: @invoices, status: :ok\n end",
"def show\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.jso... | [
"0.7970687",
"0.7758591",
"0.75787807",
"0.7569944",
"0.75485355",
"0.75110734",
"0.73802954",
"0.7339633",
"0.7339559",
"0.7298701",
"0.7200299",
"0.719593",
"0.7190167",
"0.71206474",
"0.7114775",
"0.7111116",
"0.71058434",
"0.70663965",
"0.70663965",
"0.70663965",
"0.70663... | 0.0 | -1 |
GET /invoices/new GET /invoices/new.json | def new
@invoice = Invoice.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @invoice }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n # @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end",
"def new\n @invoice = Invoice.new\n @counter = InvoiceNumbers.first\n @items = Item.find_all_by_invoice_id(@invoice.invoice_id)\n\n resp... | [
"0.8076558",
"0.79138124",
"0.76833296",
"0.7673899",
"0.75987357",
"0.7581119",
"0.75107706",
"0.7487044",
"0.747266",
"0.73870134",
"0.73668635",
"0.7349294",
"0.7348516",
"0.73028976",
"0.7251452",
"0.72335905",
"0.7225795",
"0.7178738",
"0.7175346",
"0.7160892",
"0.710089... | 0.8040652 | 1 |
POST /invoices POST /invoices.json | def create
@invoice = Invoice.new(params[:invoice])
respond_to do |format|
if @invoice.save
format.html { redirect_to @invoice, :notice => 'Invoice was successfully created.' }
format.json { render :json => @invoice, :status => :created, :location => @invoice }
else
format.h... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_invoices(invoices)\n b = Builder::XmlMarkup.new\n request_xml = b.Invoices {\n invoices.each do | invoice |\n invoice.to_xml(b)\n end\n }\n\n response_xml = http_put(@client, \"#{@xero_url}/Invoices?SummarizeErrors=false\", request_xml, {})\n\n response = ... | [
"0.7595433",
"0.7457566",
"0.73277164",
"0.7288161",
"0.72595996",
"0.7251054",
"0.7242474",
"0.7242474",
"0.7242474",
"0.7242474",
"0.7242474",
"0.7242474",
"0.72422075",
"0.7232744",
"0.71775174",
"0.71529764",
"0.7124381",
"0.711563",
"0.7105506",
"0.7038191",
"0.7022143",... | 0.7409821 | 2 |
PUT /invoices/1 PUT /invoices/1.json | def update
@invoice = Invoice.find(params[:id])
respond_to do |format|
if @invoice.update_attributes(params[:invoice])
format.html { redirect_to @invoice, :notice => 'Invoice was successfully updated.' }
format.json { head :no_content }
else
format.html { render :action => "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end",
"def update\n @invoice = Invoice.find(params[:id])\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to invoices_url, notice: 'Invoice was suc... | [
"0.71479225",
"0.7077784",
"0.7070968",
"0.7019224",
"0.7010558",
"0.696285",
"0.68827116",
"0.68441314",
"0.6803728",
"0.68000424",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67946744",
"0.67590505",
"0.... | 0.7001046 | 6 |
DELETE /invoices/1 DELETE /invoices/1.json | def destroy
@invoice = Invoice.find(params[:id])
@invoice.destroy
respond_to do |format|
format.html { redirect_to invoices_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to inv... | [
"0.79230964",
"0.78234553",
"0.7737917",
"0.7577448",
"0.75553495",
"0.75475377",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75435287",
"0.75383025",
"0.75333583",
"0.75324756",
... | 0.7888429 | 4 |
add event to system | def add_event(doc, n, *args)
# p 'Add event ' + args[1][0..199]
new_event = CalendarEvent.find_or_initialize_by_pageextsourceID(:pageextsourceID => doc.xpath("//item//id")[n].text,
:event_type => 'ce', :event_title => args[1][0..199],
:cbody => doc.xpath("//item//description")[n].text,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fAddEvent(name,event)\n @sports.addEvent(name,event)\n end",
"def add_events(new_events); end",
"def <<(add)\n @_events << add \n end",
"def add_event(args)\n this_event = get_event_object(args)\n save_event(this_event)\n events\n end",
"def add_event(event)\n @list_of_e... | [
"0.72641736",
"0.7249323",
"0.7108915",
"0.7038119",
"0.69192773",
"0.6881686",
"0.68674105",
"0.67365026",
"0.6731499",
"0.6720805",
"0.67203957",
"0.6666585",
"0.6645169",
"0.66174823",
"0.6607334",
"0.6548293",
"0.65150464",
"0.65143394",
"0.6469729",
"0.6456279",
"0.64290... | 0.0 | -1 |
parse xml feeds from given url | def xml_feed_entries(feed_url, locale, offset)
p "Feed #{feed_url}"
doc = Nokogiri::XML(open(feed_url))
doc.xpath("//item").count.times do |n|
# process dates
sdt = DateTime.parse(doc.xpath("//item//xCal:dtstart")[n].text) rescue nil
edt = doc.xpath("//item//xCal:dtend")[n].t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch\n feed_data = REXML::Document.new(open(@url, :proxy => true)).root\n parse(feed_data)\n end",
"def get_feed(url)\n source = URI.open(url, 'User-Agent' => 'Mozilla/5.0')\n feed = RSS::Parser.parse(source)\nend",
"def get_urlposts( url )\n urlposts = []\n urlcode = Digest::MD5.hexd... | [
"0.745823",
"0.72969854",
"0.7105171",
"0.7048743",
"0.6924035",
"0.6893675",
"0.68689346",
"0.67987585",
"0.6798085",
"0.67641705",
"0.6760964",
"0.6751229",
"0.6666434",
"0.66526985",
"0.66247594",
"0.6614089",
"0.6611029",
"0.6582096",
"0.65814763",
"0.65747446",
"0.649656... | 0.6243227 | 39 |
read given file with list of url feeds for a certain city | def read_feeds(fname, locale, offset)
File.foreach(fname) {|line| xml_feed_entries(line, locale, offset)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_feeds(fname)\r\n File.foreach(fname) {|line| process_feed(line.split(',')[0], line.split(',')[1], line.split(',')[2], line.split(',')[3])}\r\n end",
"def go_through_all_the_lines(url)\n list = CSV.read(url)\nend",
"def city_list(url)\n\troot = Nokogiri::HTML(open(url))\n list = root.css(\"a\").m... | [
"0.6425044",
"0.63100404",
"0.6083421",
"0.60758483",
"0.5994915",
"0.57373005",
"0.5729181",
"0.5697502",
"0.5676179",
"0.5651188",
"0.55853826",
"0.5570872",
"0.5506879",
"0.54510736",
"0.54482174",
"0.5439932",
"0.53878576",
"0.5337613",
"0.53056324",
"0.529944",
"0.529554... | 0.61258596 | 2 |
to find maximum sum of a subsequence in an array such that no consecutive elements are part of this subsequence. | def max_sum_no_consecutive(array)
return if array.size = 0
global_max = array[0]
current_max = array[0]
for i in 1..array.size - 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def maximum_value_contiguous_subsequence(array)\n len = array.length\n return array.max if all_negatives?(array)\n\n max = array[0]\n for i in (0...len)\n current_sum = 0\n for j in (i...len)\n current_sum += array[j]\n max = maximum(max, current_sum)\n end\n end\n max\nend",
"def maxSub... | [
"0.81428367",
"0.81135345",
"0.8098839",
"0.80314326",
"0.79960924",
"0.79913044",
"0.7961214",
"0.79237884",
"0.7920495",
"0.7910785",
"0.7878475",
"0.78781027",
"0.78638047",
"0.77726185",
"0.77723646",
"0.7757912",
"0.77442396",
"0.7736174",
"0.7724982",
"0.76984334",
"0.7... | 0.75983006 | 41 |
Replace this with your real tests. | def test_truth
assert true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def testing\n # ...\n end",
"def __dummy_test__\n end",
"def tests; end",
"def tests; end",
"def spec; end",
"def spec; end",
"def self_test; end",
"def self_test; end",
"def test \n end",
"def test_0_dummy\n\t\tend",
"def test\n\n end",
"def test\n end",
"def test\n end"... | [
"0.7446459",
"0.6956364",
"0.69155836",
"0.69155836",
"0.6864151",
"0.6864151",
"0.66406286",
"0.66406286",
"0.66253287",
"0.6547665",
"0.6524571",
"0.6484549",
"0.6484549",
"0.6484549",
"0.6403847",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188",
"0.6389188"... | 0.0 | -1 |
TODO: straighten out channelspecific commands...keep "current channel"? Or always specify channel? | def send_msg(msg, channel)
prefix = "PRIVMSG #{channel} :"
max_len = 255 - prefix.length
msg = msg.dup()
while(msg.length > 0)
send_irc(prefix + msg.slice!(0, max_len))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agent(channel); end",
"def channel\n return @channel\n end",
"def method_missing(name, *args, &block)\n if name =~ /(.*)_channel/\n define_send(name, $1)\n return self.send(name, args[0], args[1])\n end\n super\n end",
"def channel!\n return true unless query?\n\n... | [
"0.6894886",
"0.6801912",
"0.66846603",
"0.6628773",
"0.66205144",
"0.65637887",
"0.65595025",
"0.6475251",
"0.64672333",
"0.6459365",
"0.64548886",
"0.63962305",
"0.6380406",
"0.6307008",
"0.6289454",
"0.62707716",
"0.6262041",
"0.6258216",
"0.62577885",
"0.62419486",
"0.620... | 0.0 | -1 |
call this immediately after every load action | def count
@game = Game.find_by(id: params[:id])
@game.plays = @game.plays + 1
@game.save!
render json: {
id: @game.id,
name: @game.name,
tags: @game.tags,
user_id: @game.user_id,
description: @game.description,
published: @game.published,
plays: @game.plays
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_after_load\n end",
"def on_load\n clear_output\n end",
"def loaded()\n end",
"def on_before_load\n end",
"def onLoad\n end",
"def page_load; end",
"def on_load_success\r\n Sound.play_load\r\n fadeout_all\r\n $game_system.on_after_load\r\n SceneManager.goto(S... | [
"0.78428686",
"0.72032267",
"0.7096819",
"0.7089522",
"0.700014",
"0.6929826",
"0.68310326",
"0.67648363",
"0.67137086",
"0.67076194",
"0.66299075",
"0.66099244",
"0.66099244",
"0.66099244",
"0.65770483",
"0.65288436",
"0.6525011",
"0.6519336",
"0.64834505",
"0.6453759",
"0.6... | 0.0 | -1 |
Takes a workgroup_id as a param; finds all users for the given workgroup_id and builds an array of all nonnull email addresses | def recipient_list(workgroup)
list = Array.new
wrkgrpusrs = WorkgroupUser.find(:all, :conditions => {:workgroup_id => workgroup})
wrkgrpusrs.each do |usr|
s = User.find(:first, :conditions => {:id => usr.user_id})
list << s.email unless s.email.nil? || s.email == ""
end
if list.length < ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_list(event_id, exclude_owner = false)\n list = Array.new\n @event = Event.includes(:users).find(event_id)\n\n @event.users.where(:notification_emails => true).each do |user|\n list.push(user.email)\n end\n\n if(exclude_owner)\n list.delete(@event.owner.email)\n end\n\n retu... | [
"0.65690875",
"0.6536846",
"0.6350947",
"0.63292235",
"0.61722404",
"0.6141058",
"0.60983026",
"0.60946655",
"0.6031181",
"0.5899319",
"0.5866989",
"0.58322734",
"0.58085537",
"0.5798266",
"0.57831913",
"0.57762474",
"0.573879",
"0.5667865",
"0.5663962",
"0.5660226",
"0.56508... | 0.7484706 | 0 |
The actual dispatching (call to Participantconsume or on_workitem). No error rescuing so it might be interesting for some extension classes (like in ruoteswf). | def do_raw_dispatch(participant, msg)
workitem = Ruote::Workitem.new(msg['workitem'])
workitem.fields['dispatched_at'] = Ruote.now_to_utc_s
Ruote.participant_send(
participant, [ :on_workitem, :consume ], 'workitem' => workitem)
@context.storage.put_msg(
'dispatched',
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_dispatch(participant, msg)\n\n workitem = Ruote::Workitem.new(msg['workitem'])\n\n workitem.fields['dispatched_at'] = Ruote.now_to_utc_s\n\n participant.consume(workitem)\n\n @context.storage.put_msg(\n 'dispatched',\n 'fei' => msg['fei'],\n 'participant_name' => wor... | [
"0.7254365",
"0.67606366",
"0.6392096",
"0.63167286",
"0.62332046",
"0.62006783",
"0.5960228",
"0.5909768",
"0.58777344",
"0.5862075",
"0.58317566",
"0.5805204",
"0.5789156",
"0.5788105",
"0.57121027",
"0.56949586",
"0.56791866",
"0.56706864",
"0.5643085",
"0.56372386",
"0.56... | 0.73319495 | 0 |
The raw dispatch work, wrapped in error handling. | def do_dispatch(participant, msg)
do_raw_dispatch(participant, msg)
rescue => err
@context.error_handler.msg_handle(msg, err)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_wrapper\n begin\n yield\n rescue ::Rbt::Error::AuthError => e\n handle_auth_error(e)\n rescue ActiveRecord::RecordInvalid => e\n handle_validation_error(e)\n rescue => e\n handle_unknown_error(e)\n end\n end",
"def handle_perform_error(_e); end",... | [
"0.6736274",
"0.6677568",
"0.66726947",
"0.6387037",
"0.61667037",
"0.615136",
"0.61423355",
"0.6033918",
"0.59733474",
"0.5932416",
"0.5890863",
"0.5871338",
"0.5863382",
"0.58074576",
"0.5802453",
"0.573228",
"0.5694976",
"0.5692768",
"0.56760603",
"0.56640273",
"0.56438595... | 0.6107502 | 7 |
Wraps the call to do_dispatch in a thread. | def do_threaded_dispatch(participant, msg)
msg = Rufus::Json.dup(msg)
#
# the thread gets its own copy of the message
# (especially important if the main thread does something with
# the message 'during' the dispatch)
# Maybe at some point a limit on the number of dispatch ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dispatch(*args)\n log(:debug) { 'Dispatch message to worker.' }\n\n fetch_idle_worker.future :dispatch, args\n end",
"def do_threaded_dispatch(participant, msg)\n\n msg = Rufus::Json.dup(msg)\n #\n # the thread gets its own copy of the message\n # (especially important ... | [
"0.6915912",
"0.64858943",
"0.6360425",
"0.6345446",
"0.6345446",
"0.62442255",
"0.60998964",
"0.60484385",
"0.60381913",
"0.59455496",
"0.58819383",
"0.5870567",
"0.58300865",
"0.57905877",
"0.578899",
"0.57570386",
"0.575433",
"0.57448554",
"0.5666597",
"0.5645412",
"0.5597... | 0.65923816 | 1 |
Returns true if the participant doesn't want the consume to happen in a new Thread. | def do_not_thread?(participant, msg)
# :default => false makes participant_send return false if no method
# were found (else it would raise a NoMethodError)
Ruote.participant_send(
participant,
[ :do_not_thread, :do_not_thread?, :dont_thread, :dont_thread? ],
'workitem' => Ru... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_not_thread\n true\n end",
"def do_not_thread\n true\n end",
"def do_not_thread\n true\n end",
"def do_not_thread\n\n true\n end",
"def with_own_thread()\n true\n end",
"def thread?\n false\n end",
"def outside_control?\n\t t = thread\n\t ... | [
"0.73051304",
"0.7284774",
"0.7284774",
"0.7176104",
"0.71598685",
"0.71219903",
"0.7095138",
"0.7004165",
"0.6955303",
"0.6955303",
"0.6955303",
"0.67718035",
"0.6767691",
"0.67674726",
"0.65440184",
"0.6462838",
"0.64626557",
"0.6402666",
"0.6402666",
"0.6400784",
"0.639673... | 0.6103337 | 41 |
Instantiates the participant and calls its cancel method. | def dispatch_cancel(msg)
flavour = msg['flavour']
participant = @context.plist.instantiate(msg['participant'])
result = begin
Ruote.participant_send(
participant,
[ :on_cancel, :cancel ],
'fei' => Ruote::FlowExpressionId.new(msg['fei']),
'flavour' =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel_participant\n\n return unless @applied_workitem\n #\n # if there is an applied workitem, it means there\n # is a participant to cancel...\n\n participant = get_participant_map.lookup_participant(@participant_name)\n\n cancelitem = CancelItem.new(@applied_workitem)\n\n... | [
"0.6732078",
"0.63579875",
"0.59139234",
"0.59100014",
"0.5807894",
"0.5803919",
"0.579681",
"0.57837045",
"0.5779145",
"0.5779145",
"0.57539195",
"0.56934464",
"0.56796783",
"0.5676491",
"0.56538475",
"0.56499773",
"0.564082",
"0.5632153",
"0.5630784",
"0.5625242",
"0.559156... | 0.55420625 | 24 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.