query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /users/1 GET /users/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.722... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
redirect_back fallback_location: root_path unless current_user_admin?
@team.destroy
respond_to do |format|
format.html { redirect_back fallback_location: users_url, notice: 'User was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.78750724",
"0.77518034",
"0.7713981",
"0.7610077",
"0.747295",
"0.74073994",
"0.74073994",
"0.7369968",
"0.7346072",
"0.7340465",
"0.7328618",
"0.7309635",
"0.73095363",
"0.7306841",
"0.7297868",
"0.72917855",
"0.7291585",
"0.7289111",
"0.7284347",
"0.7250935",
"0.7250935"... | 0.0 | -1 |
Key should be unique, or latest element with that key will override previous ones. | def hash_by(key = nil, method = nil, &block)
self.inject({}) do |h, element|
if key
h[element.send(key)] = if block_given?
yield(element)
elsif method
element.send(method)
else
element
end
else # key is block and value is element
h[yi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_key_as_key\n LAST_VALUE_WINS.each {|key| @hash[key] = @hash[key].last}\n end",
"def keep(key=nil)\n if key\n @next[key] = @now[key]\n else\n @next.merge!(@now)\n end\n end",
"def key=(_); end",
"def key=(_); end",
"def unique_entries_by_(key) \n ... | [
"0.63506514",
"0.6293354",
"0.6109742",
"0.6109742",
"0.6037267",
"0.59949595",
"0.5844275",
"0.58176625",
"0.5816397",
"0.5796087",
"0.5796047",
"0.5768431",
"0.57432157",
"0.5669472",
"0.56666476",
"0.5666283",
"0.5628228",
"0.5625613",
"0.5605319",
"0.55553097",
"0.5553123... | 0.0 | -1 |
GET /espetaculos GET /espetaculos.json | def index
@espetaculos = Espetaculo.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {... | [
"0.73197955",
"0.707102",
"0.7012849",
"0.70035964",
"0.69860023",
"0.6959708",
"0.6896149",
"0.68805957",
"0.68773",
"0.6872416",
"0.68637776",
"0.68292385",
"0.68221456",
"0.6804849",
"0.67870945",
"0.6777491",
"0.67687154",
"0.6729278",
"0.6728037",
"0.6724299",
"0.6700408... | 0.69549066 | 6 |
GET /espetaculos/1 GET /espetaculos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # in... | [
"0.71828324",
"0.7129391",
"0.7080003",
"0.69654024",
"0.6957459",
"0.6928289",
"0.6901657",
"0.6865806",
"0.6858262",
"0.68564427",
"0.68108535",
"0.6796217",
"0.6796217",
"0.67897296",
"0.6789541",
"0.67799556",
"0.67792886",
"0.67768127",
"0.67747325",
"0.6771862",
"0.6754... | 0.0 | -1 |
POST /espetaculos POST /espetaculos.json | def create
@espetaculo = Espetaculo.new(espetaculo_params)
respond_to do |format|
if @espetaculo.save
format.html { redirect_to @espetaculo, notice: 'Espetaculo was successfully created.' }
format.json { render :show, status: :created, location: @espetaculo }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def troca\n @remetente = Sobrevivente.where(id: para... | [
"0.6629244",
"0.6479606",
"0.6433449",
"0.6382739",
"0.63549143",
"0.63375264",
"0.629571",
"0.62704456",
"0.6267636",
"0.62673527",
"0.62503576",
"0.62459356",
"0.62421227",
"0.6222371",
"0.62162644",
"0.6209373",
"0.61993676",
"0.6177276",
"0.6167893",
"0.6167577",
"0.61618... | 0.66372675 | 0 |
PATCH/PUT /espetaculos/1 PATCH/PUT /espetaculos/1.json | def update
respond_to do |format|
if @espetaculo.update(espetaculo_params)
format.html { redirect_to @espetaculo, notice: 'Espetaculo was successfully updated.' }
format.json { render :show, status: :ok, location: @espetaculo }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json {... | [
"0.6754576",
"0.67299086",
"0.6715537",
"0.663927",
"0.6634241",
"0.66322494",
"0.6624645",
"0.6623522",
"0.66041064",
"0.6566747",
"0.6555308",
"0.6537978",
"0.653486",
"0.65325713",
"0.6508927",
"0.6490175",
"0.6483012",
"0.64702094",
"0.6454734",
"0.64513063",
"0.64513063"... | 0.6528476 | 14 |
DELETE /espetaculos/1 DELETE /espetaculos/1.json | def destroy
@espetaculo.destroy
respond_to do |format|
format.html { redirect_to espetaculos_url, notice: 'Espetaculo was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @asignatura.destr... | [
"0.7378611",
"0.73478216",
"0.7294123",
"0.72779894",
"0.72760147",
"0.7243003",
"0.72137994",
"0.7204482",
"0.7200267",
"0.7197665",
"0.7196717",
"0.71902996",
"0.7182072",
"0.71516937",
"0.71492255",
"0.71477383",
"0.713861",
"0.71360874",
"0.7134037",
"0.7116888",
"0.71148... | 0.7135924 | 18 |
Use callbacks to share common setup or constraints between actions. | def set_espetaculo
@espetaculo = Espetaculo.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 espetaculo_params
params.require(:espetaculo).permit(:nome, :atores, :diretor, :sonoplasta, :iluminador)
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 |
Nova instancia do Banpara | def initialize(campos = {})
campos[:local_pagamento] = 'Pagar preferencialmente em agência do Banpará'
super(campos)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\n @boleto = Boleto.new\n\n end",
"def agregar_palabra\n\t\t@palabra = @bot.palabras.new\n\tend",
"def nueva\n @ciudad = Ciudad.new\n end",
"def create\n # Submit de new, crea nueva instance en DB.\n end",
"def create_api_instance\n facturama_user='prueba'\n ... | [
"0.6932435",
"0.6585127",
"0.65364414",
"0.64174217",
"0.63053",
"0.6287078",
"0.6286138",
"0.62072134",
"0.6206646",
"0.61825156",
"0.6109247",
"0.6109247",
"0.6109247",
"0.61002296",
"0.60981727",
"0.60583806",
"0.6027515",
"0.60097814",
"0.6004025",
"0.59978026",
"0.598091... | 0.0 | -1 |
Aceite Nao tem no manual, foi baseado em boleto modelo enviado pela prefeitura | def aceite
'N'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def suivre; end",
"def aplicar_efecto(objeto_espacial_generador_de_choque, objeto_espacial_receptor_de_choque)\n porcentaje_de_masa_actual = @porcentaje_de_masa\n if(porcentaje_de_masa_actual.to_s.include? \"%\")\n porcentaje_de_masa_actual.gsub!(/%/, \"\")\n end\n objeto_espacial_generador_de_c... | [
"0.59089756",
"0.57431155",
"0.5694201",
"0.5669907",
"0.56440896",
"0.5592507",
"0.5523988",
"0.5507846",
"0.5480099",
"0.54769",
"0.5471223",
"0.5437455",
"0.5409709",
"0.5408578",
"0.54035497",
"0.53992236",
"0.53588724",
"0.53509355",
"0.53457624",
"0.53361833",
"0.533191... | 0.0 | -1 |
GET /insurances GET /insurances.json | def index
init_oco if !session[:organization]
if session[:organization] != '0'
@insurances = Insurance.where(organization_id: session[:organization]).paginate(:page => params[:page], :per_page => per_page).order(sort_column + ' ' + sort_direction)
else
@insurances = Insurance.paginate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all(params = {})\n @client.make_request(:get, 'insurances', MODEL_CLASS, params)\n end",
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @life_ins... | [
"0.7403342",
"0.70758814",
"0.6451256",
"0.64166343",
"0.63968",
"0.6316312",
"0.62888956",
"0.62385476",
"0.6186712",
"0.6174553",
"0.6106109",
"0.60953295",
"0.60716",
"0.60701185",
"0.60585976",
"0.60043454",
"0.6001137",
"0.59882796",
"0.59633946",
"0.5942013",
"0.5925933... | 0.6540112 | 2 |
GET /insurances/1 GET /insurances/1.json | def show
@breadcrumb = 'read'
@insurance = Insurance.find(params[:id])
@workers = @insurance.workers.paginate(:page => params[:page], :per_page => per_page).order('worker_code')
respond_to do |format|
format.html # show.html.erb
format.json { render json: @insurance }
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end",
"def all(params = {})\n @client.make_request(:get, 'insurances', MODEL_CLASS, params)\n end",
"def show\n @insurance = load_insurance\n\n respond_to do |format|\n format.html\n format.json\n end ... | [
"0.7571588",
"0.6953954",
"0.65308404",
"0.6412268",
"0.6378631",
"0.635725",
"0.6346357",
"0.6323069",
"0.63030297",
"0.6291674",
"0.6273025",
"0.62484175",
"0.62144905",
"0.61850584",
"0.61679864",
"0.6157394",
"0.61315674",
"0.61246824",
"0.6111852",
"0.6104262",
"0.609752... | 0.60024834 | 30 |
GET /insurances/new GET /insurances/new.json | def new
@breadcrumb = 'create'
@insurance = Insurance.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @insurance }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @life_insurance = LifeInsurance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @life_insurance }\n end\n end",
"def new\n @encounter = Encounter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { rend... | [
"0.7366726",
"0.73468244",
"0.73156685",
"0.71787214",
"0.7176036",
"0.71592754",
"0.71096146",
"0.7084484",
"0.7068973",
"0.7048612",
"0.70114356",
"0.6992487",
"0.69218963",
"0.68838876",
"0.68780994",
"0.68759686",
"0.6850693",
"0.68302166",
"0.6823267",
"0.6812231",
"0.68... | 0.7853387 | 0 |
POST /insurances POST /insurances.json | def create
@breadcrumb = 'create'
@insurance = Insurance.new(params[:insurance])
@insurance.created_by = current_user.id if !current_user.nil?
respond_to do |format|
if @insurance.save
format.html { redirect_to @insurance, notice: crud_notice('created', @insurance) }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(params = {})\n wrapped_params = { insurance: params }\n @client.make_request(:post, 'insurances', MODEL_CLASS, wrapped_params)\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @inciden... | [
"0.7151013",
"0.6132172",
"0.59771764",
"0.59539306",
"0.5942133",
"0.59162223",
"0.5895912",
"0.5865056",
"0.579359",
"0.5790205",
"0.57873964",
"0.5753976",
"0.57309014",
"0.5715159",
"0.5672575",
"0.5667512",
"0.5647055",
"0.5643143",
"0.5633308",
"0.5633308",
"0.5629852",... | 0.62235224 | 1 |
PUT /insurances/1 PUT /insurances/1.json | def update
@breadcrumb = 'update'
@insurance = Insurance.find(params[:id])
@insurance.updated_by = current_user.id if !current_user.nil?
respond_to do |format|
if @insurance.update_attributes(params[:insurance])
format.html { redirect_to @insurance,
n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @interest = Interest.find(params[:id])\n \n respond_to do |format|\n if @interest.update_attributes(params[:interest])\n format.json { head :ok }\n else\n format.json { render :json => @interest.errors,\n :status => :unprocessable_entity }\n end\n end\n ... | [
"0.62293655",
"0.6171783",
"0.61701",
"0.610971",
"0.6035267",
"0.6000996",
"0.5981027",
"0.5976915",
"0.5976347",
"0.597185",
"0.5932742",
"0.5932742",
"0.5932742",
"0.5914886",
"0.58653986",
"0.5851972",
"0.58408606",
"0.58258003",
"0.5822766",
"0.5820761",
"0.5815371",
"... | 0.61889255 | 1 |
DELETE /insurances/1 DELETE /insurances/1.json | def destroy
@insurance = Insurance.find(params[:id])
respond_to do |format|
if @insurance.destroy
format.html { redirect_to insurances_url,
notice: (crud_notice('destroyed', @insurance) + "#{undo_link(@insurance)}").html_safe }
format.json { head :no_conten... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @life_insurance.destroy\n\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @life_insurance.destroy\n respond_to do |format|\n format.html { redirect_to life_insurances_url }\n ... | [
"0.71100616",
"0.7077459",
"0.70683455",
"0.6939351",
"0.6922878",
"0.6885303",
"0.68708",
"0.6869441",
"0.6843698",
"0.68238616",
"0.68226284",
"0.6805097",
"0.67878634",
"0.67263293",
"0.67127156",
"0.67000693",
"0.66888183",
"0.6681663",
"0.66482884",
"0.6630567",
"0.66302... | 0.6987206 | 3 |
Returns an array all the paintings by an artist | def paintings
Painting.all.select{|painting_instance| painting_instance.artist == self}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def artists\n paintings.map do |painting|\n painting.artist\n end\n end",
"def paintings\n Painting.all.select {|p| p.artist == self}\n end",
"def artists\n paintings.collect do |p|\n p.artist \n end\n end",
"def artists\n self.paintings.map do |painting|\n painting.a... | [
"0.827806",
"0.81666404",
"0.81208044",
"0.8116716",
"0.79862124",
"0.7891409",
"0.7891409",
"0.7891409",
"0.785834",
"0.7849424",
"0.7828021",
"0.7819714",
"0.7819714",
"0.7804246",
"0.7754258",
"0.77372795",
"0.77140296",
"0.7609196",
"0.75375074",
"0.72383255",
"0.71266925... | 0.78368473 | 10 |
Returns an array of all the galleries that an artist has paintings in | def galleries
Painting.all.map do |painting_instance|
if painting_instance.artist == self
painting_instance.gallery
end
end.compact.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def galleries\n paintings.map {|p| p.gallery}\n end",
"def galleries\n paintings.map {|painting| painting.gallery}\n end",
"def all_artists_by_gallery\n paintings = Painting.all.select { |painting| painting.gallery == self }\n # paintings.map { |painting| painting.artist }\n end",
"def ga... | [
"0.846802",
"0.8272418",
"0.82534474",
"0.82506865",
"0.82282174",
"0.8226531",
"0.8224111",
"0.8136808",
"0.8120395",
"0.8120395",
"0.8120395",
"0.8095459",
"0.8080331",
"0.8023666",
"0.7893244",
"0.75780237",
"0.756971",
"0.7534802",
"0.738552",
"0.7238986",
"0.7216759",
... | 0.86001194 | 0 |
Return an array of all cities that an artist has paintings in | def cities
Painting.all.map do |painting_instance|
if painting_instance.artist == self
painting_instance.gallery.city
end
end.compact.uniq
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_cities\n city_arr = Painting.all.select do |painting_ob|\n #binding.pry\n painting_ob.artist == self\n end\n city_arr.map do |painting_ob|\n painting_ob.gallery.city\n end\nend",
"def cities\n galleries.map {|g| g.city}\n end",
"def cities \n galleries.map{|g| g.city}.uniq\n... | [
"0.7432719",
"0.7427216",
"0.71981937",
"0.71691334",
"0.7162481",
"0.71181685",
"0.7106441",
"0.70468307",
"0.7043161",
"0.7043161",
"0.68992716",
"0.68612635",
"0.68456364",
"0.68456364",
"0.6780894",
"0.6775067",
"0.67725056",
"0.6625553",
"0.6616456",
"0.6600691",
"0.6587... | 0.8210998 | 0 |
Given the arguments of title, price and gallery, creates a new painting belonging to that artist | def create_painting(title, price, gallery)
Painting.new(title, price, gallery, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_painting(title, price, gallery) #(title, price, artist, gallery)\n Painting.new(title, price, self, gallery)\n end",
"def create_painting(title, price, gallery)\n Painting.new(title, price, self, gallery)\n end",
"def create_painting(title, price, gallery)\n Painting.new(title, price, sel... | [
"0.8097651",
"0.77111065",
"0.77111065",
"0.77111065",
"0.76426256",
"0.7638961",
"0.74456036",
"0.67176205",
"0.64623165",
"0.61592746",
"0.58460253",
"0.5822008",
"0.58090883",
"0.5790757",
"0.55937755",
"0.55582625",
"0.5497374",
"0.5484345",
"0.5483693",
"0.54761773",
"0.... | 0.76302224 | 6 |
The cycle helpers need to store the cycles in a place | def get_cycle(name)
@_cycles = Hash.new unless defined?(@_cycles)
return @_cycles[name]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_cycle\n pre_cycle\n user_cycle\n after_cycle\n end",
"def cycles\n @cycles ||= 5\n end",
"def create_cycle\r\n return if @head == nil # don't do anything if the linked list is empty\r\n\r\n # navigate to last node\r\n cursor = @head\r\n while cursor.next !... | [
"0.70813537",
"0.70438755",
"0.70073634",
"0.69749177",
"0.6947253",
"0.69368523",
"0.6887178",
"0.68850386",
"0.68850386",
"0.687054",
"0.67554075",
"0.6728516",
"0.6699966",
"0.65919924",
"0.6469022",
"0.6416157",
"0.63390726",
"0.63305223",
"0.63117033",
"0.6270181",
"0.62... | 0.6281418 | 19 |
encoding: utf8 Playing with sorting algorithms The algorithm starts at the beginning of the data set. It compares the first two elements, and if the first is greater than the second, it swaps them. It continues doing this for each pair of adjacent elements to the end of the data set. It then starts again with the first... | def bubble_sort(a)
array = a.clone
final = false
while !final
final = true
1.upto(array.length-1) do |index|
if array[index] < array[index-1]
array[index], array[index-1] = array[index-1], array[index]
final = false
end
end
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bubble_sort_by_concept_two(array)\n no_swaps = false # initiate flag to indicate when there are no more swaps being done\n\n until no_swaps\n no_swaps = true\n (0..array.length - 2).each do |i|\n # check if these two elements are out of order\n compare_result = yield array[i], array[i + 1]\n\... | [
"0.714253",
"0.68042356",
"0.6705065",
"0.6691415",
"0.66607744",
"0.6643696",
"0.66359705",
"0.6635898",
"0.66238976",
"0.66168195",
"0.66065705",
"0.65906596",
"0.65236396",
"0.6516354",
"0.651065",
"0.65013313",
"0.6481619",
"0.6475752",
"0.64713824",
"0.6465773",
"0.64616... | 0.0 | -1 |
The algorithm finds the minimum value, swaps it with the value in the first position, and repeats these steps for the remainder of the list. It does no more than n swaps, and thus is useful where swapping is very expensive. O(n^2) | def selection_sort(a)
array = a.clone
insert = 0
array.each_index do |i|
min = i
(i+1).upto(array.length-1) do |j|
if array[j] < array[min]
min = j
end
end
array[i], array[min] = array[min], array[i]
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimumSwaps(arr)\n right_pointer = arr.count - 1\n count = 0\n min_swaps = 0\n\n while count < arr.count\n arr_value = count + 1\n if (arr[count] != arr_value)\n\n while arr_value != arr[right_pointer]\n right_pointer -= 1;\n end\n\n if right_pointer != count\n arr[count... | [
"0.7286574",
"0.714893",
"0.7144403",
"0.70495",
"0.7037709",
"0.69782263",
"0.6831456",
"0.66656256",
"0.6605443",
"0.6536429",
"0.64243",
"0.6414984",
"0.63978267",
"0.638463",
"0.638463",
"0.638463",
"0.638463",
"0.638463",
"0.638463",
"0.638463",
"0.63690674",
"0.636906... | 0.0 | -1 |
Insertion sort is a simple sorting algorithm that is relatively efficient for small lists and mostly sorted lists, and often is used as part of more sophisticated algorithms. It works by taking elements from the list one by one and inserting them in their correct position into a new sorted list. In arrays, the new list... | def insertion_sort(a)
array = a
1.upto(array.length-1) do |i|
if array[i] < array[i-1]
# need to shift everything over until it isn't
i.downto(1) do |j|
if array[j] < array[j-1]
array[j], array[j-1] = array[j-1], array[j]
end
end
end
end
array
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def insertion_sort(list)\n return list if list.size < 2\n\n (1...list.length).each do |i|\n j = i - 1\n e_next = list[i]\n while j >= 0 and list[j] > e_next\n list[j + 1] = list[j]\n j -= 1\n end\n list[j + 1] = e_next\n ... | [
"0.83110815",
"0.81892693",
"0.81059515",
"0.8023113",
"0.7979286",
"0.7964282",
"0.79011476",
"0.78686905",
"0.78496915",
"0.7844344",
"0.78437966",
"0.7834382",
"0.7826539",
"0.78238064",
"0.78086495",
"0.78079605",
"0.7802118",
"0.7798398",
"0.77799296",
"0.7771913",
"0.77... | 0.79416037 | 6 |
Shellsort, also known as Shell sort or Shell's method, is an inplace comparison sort. It generalizes an exchanging sort, such as insertion or bubble sort, by starting the comparison and exchange of elements with elements that are far apart before finishing with neighboring elements. Starting with far apart elements can... | def shell_sort(a)
array = a
m = 1
while (gap = array.length / (2 ** m)) >= 1
puts "gap: #{gap}"
0.step(array.length-1, gap) do |i|
#puts "#{i}"
# insertion sort
#puts " ###{i+gap}"
(i+1).upto(i+gap-1) do |j|
#puts " #{j}"
if array[j] < array[j-1]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shell_sort(arr)\n gap = arr.size / 2\n until gap >= 1\n (0...gap).each do |i|\n j = i\n while j < arr.size\n arr[j], arr[j+gap] = arr[j+gap], arr[j] if arr[j] > arr[j+gap]\n j = j + gap\n end\n end\n gap, mod = gap.divmod(2)\n gap = mod == 0 ? gap + 1 : gap\n end\n ... | [
"0.8274053",
"0.815727",
"0.81322116",
"0.8072705",
"0.80661654",
"0.79795754",
"0.7940284",
"0.77989227",
"0.71132994",
"0.67388743",
"0.65879714",
"0.65863705",
"0.6582038",
"0.6489279",
"0.6420688",
"0.634719",
"0.63410753",
"0.6322514",
"0.63135546",
"0.6310764",
"0.63088... | 0.79475796 | 6 |
O(nlogn) but requires much (i.e. O(n)) extra space (and is therefore no better than merge sort). | def quick_sort(a)
array = a
# already sorted!
return array if array.length <= 1
pivot = array.length / 2
lower = []
higher = []
array.length.times do |i|
next if i == pivot
if array[i] >= array[pivot]
higher << array[i]
else
lower << array[i]
end
end
return... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_sort(arr)\n cr_size = 1\n while cr_size <= arr.size - 1\n left = 0\n while left < arr.size - 1\n mid = [(left + cr_size - 1), (arr.size - 1)].min\n right = if (2 * cr_size + left - 1) < (arr.size - 1)\n 2 * cr_size + left - 1\n else\n arr.size ... | [
"0.7339264",
"0.73165697",
"0.7294283",
"0.71749157",
"0.7169672",
"0.7167471",
"0.7110195",
"0.71067613",
"0.7083156",
"0.7082487",
"0.7074356",
"0.7057483",
"0.7050273",
"0.7022806",
"0.7019256",
"0.7013537",
"0.70094925",
"0.7003089",
"0.700068",
"0.6993116",
"0.6959356",
... | 0.0 | -1 |
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.user_mailer.new_user.subject | def new_user(user, password)
@user = user
@password = password
mail to: user.email, subject: "[IMD- UFRN] Nova Conta no Gerenciador de Espaço Físico"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def message_subject=(value)\n @message_subject = value\n end",
"def subject\n self['subject'] || msg['subject']\n end",
"def subject (recipient)\n subject_variables = alert_variables[:subject].dup\n subject_variables.merge!(recipient_details(recipient))\n subject = ... | [
"0.6990674",
"0.6856709",
"0.67584145",
"0.67539895",
"0.67429304",
"0.67183256",
"0.66673976",
"0.6666333",
"0.6649909",
"0.6631236",
"0.6611191",
"0.6599827",
"0.65988386",
"0.6578426",
"0.648208",
"0.648208",
"0.648208",
"0.648208",
"0.6481469",
"0.6481469",
"0.6481469",
... | 0.0 | -1 |
Redirect to '/spslo' is required for SP initiated Single Logout | def after_sign_out_path_for(_)
if session['saml_uid'] && session['saml_session_index'] && SAML_SETTINGS.idp_slo_service_url
user_saml_omniauth_authorize_path(locale: nil) + '/spslo'
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logout \n sign_out\n# render :text => \"single sign off\" and return unless params[\"from_sso\"].nil?\n redirect_to \"#{my_addr}/#{app.name}/home\"\n end",
"def sp_logout_request\n # LogoutRequest accepts plain browser requests w/o paramters\n settings = saml_settings(url_base)\n\n if s... | [
"0.7160668",
"0.7114328",
"0.71089625",
"0.7065243",
"0.70365137",
"0.7002275",
"0.652105",
"0.63999045",
"0.6385099",
"0.6297313",
"0.6290662",
"0.62903583",
"0.62686753",
"0.62686753",
"0.62686753",
"0.62686753",
"0.62686753",
"0.62625086",
"0.624771",
"0.62417823",
"0.6240... | 0.7493845 | 0 |
GET /reports GET /reports.json | def index
@reports = Report.page(params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.jso... | [
"0.7896447",
"0.78636414",
"0.77486503",
"0.7707248",
"0.7619338",
"0.7569814",
"0.75290066",
"0.74211705",
"0.73762834",
"0.73735154",
"0.73633385",
"0.7334833",
"0.733009",
"0.72732675",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.7264923",
"0.726492... | 0.689446 | 48 |
GET /reports/1 GET /reports/1.json | def show; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report(id)\n get(\"reports/#{id}\")\n end",
"def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end",
"def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n ... | [
"0.77468234",
"0.7589185",
"0.74307674",
"0.7356083",
"0.7339539",
"0.7336524",
"0.72879505",
"0.72701365",
"0.7256166",
"0.7256166",
"0.7256166",
"0.7242371",
"0.71831805",
"0.71578735",
"0.715341",
"0.7150455",
"0.7138241",
"0.7122619",
"0.7100867",
"0.7061722",
"0.70123106... | 0.0 | -1 |
POST /reports POST /reports.json | def create
@report = Report.new(report_params.merge(user_id: current_user.id))
if @report.save
redirect_to @report, notice: t("activerecord.attributes.report.created")
else
ender :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report\n @report = Report.create(reports_params)\n if @report.valid?\n render json: {}, status: :created\n else\n render json: { error: 'failed to create report' }, status: :internal_server_error\n end\n end",
"def create\n @report = Report.new(report_params)\n\n re... | [
"0.77267456",
"0.71440965",
"0.7033348",
"0.70297456",
"0.7006169",
"0.6989695",
"0.6989695",
"0.698222",
"0.6979302",
"0.6979302",
"0.6979302",
"0.6961894",
"0.6960234",
"0.695844",
"0.68224156",
"0.6808665",
"0.68054426",
"0.67791307",
"0.6777732",
"0.67731243",
"0.67679095... | 0.0 | -1 |
PATCH/PUT /reports/1 PATCH/PUT /reports/1.json | def update
@report.user = current_user
if @report.update(report_params)
redirect_to @report, notice: t("activerecord.attributes.report.updated")
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @report.update(report_params)\n format.html { redirect_to @report}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @report.errors, status: :unprocessable_entity }\n ... | [
"0.6936786",
"0.6860476",
"0.6860476",
"0.68570864",
"0.68476593",
"0.68476593",
"0.6841573",
"0.6832132",
"0.6824728",
"0.68218154",
"0.67968696",
"0.6796351",
"0.67753536",
"0.676711",
"0.6761314",
"0.67367345",
"0.67303354",
"0.67303354",
"0.67303354",
"0.67303354",
"0.673... | 0.0 | -1 |
DELETE /reports/1 DELETE /reports/1.json | def destroy
@report.destroy
redirect_to reports_url, notice: t("activerecord.attributes.report.destroyed")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @report.destroy!\n render json: {status: :ok}\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n format.html { redirect_to reports_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @report.destroy\n respond_to do |format|\n ... | [
"0.78883916",
"0.77925867",
"0.7791945",
"0.7791945",
"0.7791945",
"0.7768737",
"0.7727435",
"0.7727435",
"0.7727435",
"0.7727435",
"0.7672675",
"0.75966144",
"0.75292933",
"0.75292933",
"0.75199825",
"0.7518596",
"0.7518159",
"0.7505007",
"0.7485241",
"0.7485241",
"0.7485241... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_report
@report = Report.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def report_params
params.require(:report).permit(:title, :body)
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 |
Use symbols to avoid loading all shortcutted filters. | def filter_for(shortcut)
{
attribute_filter: [:"MundaneSearch::Filters::AttributeMatch", {}],
filter_greater_than: operator_filter(:>),
filter_less_than: operator_filter(:<),
filter_greater_than_or_equal_to: operator_filter(:>=),
filter_less_than_or_equal_to:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_symbols\n s = Symbols.new(@filtered)\n pro = s.process_labels\n @filtered = s.translate_symbols(pro)\n process\n end",
"def symbols() @symbols end",
"def symbols; end",
"def clear_symbols(*symbols)\n [BusScheme.current_scope, BusScheme::SYMBOL_TABLE].compact.map{ |scope| symbols.m... | [
"0.7036925",
"0.6237597",
"0.61471754",
"0.61041725",
"0.6094397",
"0.6040069",
"0.59871346",
"0.59117705",
"0.59117705",
"0.58749574",
"0.5871395",
"0.58564013",
"0.5844829",
"0.58248305",
"0.5777203",
"0.5653244",
"0.5630441",
"0.5563246",
"0.55531335",
"0.55163527",
"0.549... | 0.51245904 | 49 |
Declares which content models will be included with the model EXAMPLE: has_content :articles, :tips | def has_yaml_content(*args)
include HasYamlContent::InstanceMethods
#get the already loaded content modules
content_types = custom_content_types
args.each do |arg|
#load content model
if arg.is_a?(Symbol)
#singularize content model and append to array
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_content_model\n add_relationship(:has_model, \"info:fedora/hull-cModel:examPaper\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:compoundContent\")\n add_relationship(:has_model, \"info:fedora/hydra-cModel:commonMetadata\")\n end",
"def set_content\n @content = @slide.conte... | [
"0.6334754",
"0.6129015",
"0.6087126",
"0.60795563",
"0.5967125",
"0.58907115",
"0.5809402",
"0.5793399",
"0.5793399",
"0.5793399",
"0.5793399",
"0.5782194",
"0.5782194",
"0.5782194",
"0.5782194",
"0.5782194",
"0.5782194",
"0.5782194",
"0.57793635",
"0.57523406",
"0.5708118",... | 0.6385777 | 0 |
short cut to get all content_types | def content_types
self.class.custom_content_types
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_types\n type.children.select { |child| child.class == ContentType }\n end",
"def content_types\n return @content_types\n end",
"def content_types\n self.values.collect do |hash|\n (hash || {})['type']\n end.compact\n end",
"def content_typ... | [
"0.82932085",
"0.80205816",
"0.79431593",
"0.79315645",
"0.75378376",
"0.7463109",
"0.72879255",
"0.7283435",
"0.7252349",
"0.7223778",
"0.6832146",
"0.6768432",
"0.65115404",
"0.65114963",
"0.650651",
"0.6479295",
"0.63892066",
"0.6328243",
"0.6278252",
"0.625154",
"0.624693... | 0.7325148 | 6 |
returns an array (YamlContentBaseArray) of all the content objects (one YamlContentBase instance if it isn't plural). | def get_content(model_name)
@_content ||= {}
# return content if it has already been memoized
return @_content[model_name] unless @_content[model_name].nil?
#get class of content model we are trying to get content for
model = get_content_model(model_name)
if is_plural?... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_contents()\n contents = self.content.flatten.map do |c|\n case c\n when Eddy::Models::Loop::Repeat then c.all_contents()\n when Eddy::Models::Loop::Base then c.all_contents()\n when Eddy::Models::Segment then c\n else raise Eddy::Errors... | [
"0.7165808",
"0.6887904",
"0.6463056",
"0.640376",
"0.6349051",
"0.6312852",
"0.6306193",
"0.6258356",
"0.625145",
"0.6201269",
"0.62003624",
"0.61289096",
"0.611967",
"0.60478806",
"0.60248977",
"0.6024005",
"0.6021868",
"0.60194016",
"0.6017341",
"0.60012347",
"0.5997141",
... | 0.56774175 | 49 |
Gets the content model class | def get_content_model(model_name)
model_hash = content_types.select{|x| x[:name] == model_name}.first
return model_hash[:class_name].nil? ? model_name.constantize : model_hash[:class_name].constantize
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model_class\n return @model_class || self.class.model_class\n end",
"def class\n @model.class\n end",
"def set_content_model\n @content_model_class_name = self.class.name.gsub(/Controller/,'').singularize.constantize\n end",
"def model_class\n self.class.const_g... | [
"0.7543149",
"0.7474377",
"0.72985125",
"0.72675735",
"0.70565087",
"0.70486283",
"0.69520867",
"0.69487506",
"0.69052047",
"0.69052047",
"0.6850171",
"0.68262625",
"0.68163633",
"0.68129766",
"0.6802389",
"0.6782626",
"0.6760645",
"0.67597884",
"0.67597884",
"0.6722085",
"0.... | 0.7724374 | 0 |
Checks to see if the association is plural or singular | def is_plural?(model_name)
model_hash = content_types.select{|x| x[:name] == model_name}.first
return model_hash[:plural]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plural?\n self.class.pluralized || false\n end",
"def plural?\n self.plural_head\n end",
"def plural?\n self == self.pluralize\n end",
"def plural?\n !@msgid_plural.nil?\n end",
"def plural?\n @msgid_plural != nil\n end",
"def uncountable?\n singular_table_n... | [
"0.77525496",
"0.74685425",
"0.7435193",
"0.7232097",
"0.72101504",
"0.7073882",
"0.70722836",
"0.6970622",
"0.6837027",
"0.657962",
"0.65337664",
"0.64684737",
"0.6419915",
"0.63317204",
"0.629669",
"0.62274164",
"0.6205158",
"0.61565197",
"0.6146051",
"0.61436284",
"0.61135... | 0.66041344 | 9 |
Converts an object of this instance into a database friendly value. | def mongoize
return if values.blank?
values.map { |value| value.mongoize }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_to_dynamo_value(object_value); object_value; end",
"def cast_value\n value.mongoize\n end",
"def convert_to_object_value(dynamo_value); dynamo_value; end",
"def to_mongo_value\n h = {}\n self.class.column_names.each {|iv|\n val = read_attribute(iv)\n h[iv] ... | [
"0.6693649",
"0.66611433",
"0.6586885",
"0.6584254",
"0.6357532",
"0.62361926",
"0.6231476",
"0.6201285",
"0.61927533",
"0.61496985",
"0.61056703",
"0.61056703",
"0.6097344",
"0.609666",
"0.608981",
"0.6082601",
"0.6079731",
"0.6045964",
"0.6021976",
"0.6007313",
"0.598294",
... | 0.0 | -1 |
Takes any possible object and converts it to how it would be stored in the database. | def mongoize(object)
return nil if object.nil?
case object
when self
object.mongoize
when Array
demongoize(object).mongoize
else
object
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert(object); end",
"def convert\n self.class.convert(object)\n end",
"def convert\n return unless should_convert?\n\n object_magic = MagicObjects.get_magic(object)\n {\n _magic: object_magic\n }\n end",
"def demongoize(object)\n object\n end",
"... | [
"0.81272006",
"0.7871279",
"0.70423317",
"0.6989946",
"0.68704975",
"0.68297803",
"0.6824049",
"0.6801315",
"0.6746827",
"0.6736552",
"0.6703407",
"0.669389",
"0.66761917",
"0.66558206",
"0.66486794",
"0.66148937",
"0.66136605",
"0.6544325",
"0.6544325",
"0.6541866",
"0.65310... | 0.63054633 | 39 |
Show the full list of categories | def index; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_categories\n Category.all.each.with_index(1) {|x, i| puts \"#{i}. #{x.name}\"} #Scraper.categories.each.with_index(1) {|category, i| puts \"#{i}. #{category[0]}\"}\n puts \"select the number of the category you would like to browse or type 'exit'\"\n end",
"def category_lister\n Category.... | [
"0.7697334",
"0.7669039",
"0.76590073",
"0.76012456",
"0.7576922",
"0.75511366",
"0.7516861",
"0.7489365",
"0.7463017",
"0.74333066",
"0.74317175",
"0.74208283",
"0.73960096",
"0.73619294",
"0.732566",
"0.7315982",
"0.7304643",
"0.730288",
"0.730288",
"0.730288",
"0.730288",
... | 0.0 | -1 |
Update the order of the categories This is called by the Nestable JS code whenever the user drags around the order of the categories. | def order
# This will already have been deserialized by Rails, and is thus likely to
# be an array (though maybe a Hash if there's only one of them).
new_order = params[:order]
new_order = [new_order] if new_order.is_a?(Hash)
# Loop the roots and make them roots, then recursively set thei... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort\n section = Section.find(params[:section_id])\n categories = section.categories\n categories.each do |category|\n category.position = params['category'].index(category.id.to_s) + 1\n category.save\n end\n render :nothing => true\n end",
"def camaleon_category_order_on_list_cate... | [
"0.6584422",
"0.6371153",
"0.62728024",
"0.6264131",
"0.626053",
"0.62382644",
"0.60091114",
"0.59790504",
"0.5962407",
"0.582009",
"0.5813241",
"0.5813241",
"0.5769764",
"0.57682264",
"0.5711186",
"0.5660341",
"0.56225234",
"0.5621562",
"0.55066544",
"0.5427976",
"0.54192454... | 0.5757854 | 14 |
Show the details of an individual category | def show
@category = Documents::Category.find(params[:id])
render layout: false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @category = @item.category\n end",
"def show # display one category\n @category = Category.find(params[:id])\n end",
"def show\n @category = Category.find(params[:category_id])\n end",
"def show\n @category = Category.find(params[:id])\n end",
"def show\n @category = ... | [
"0.79321426",
"0.7852637",
"0.7715413",
"0.77126575",
"0.7693542",
"0.7693542",
"0.7614634",
"0.75701904",
"0.7492496",
"0.7393042",
"0.7386335",
"0.7377195",
"0.73524606",
"0.73068535",
"0.7292557",
"0.7274844",
"0.72538275",
"0.7251925",
"0.7207638",
"0.72055984",
"0.717810... | 0.7041066 | 29 |
Show the category creation form | def new
@journals = journal_list
@category = Documents::Category.new
render layout: false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def htmlcreate\n @category = Category.new(category_params)\n if @category.save\n flash[:success] = t('admin.categories.create.created')\n redirect_to admin_categories_path\n else\n render 'new'\n end\n end",
"def create\n @category_form_url = forum_categories_path\n resp... | [
"0.7819558",
"0.7788304",
"0.77093476",
"0.77029514",
"0.764286",
"0.75418794",
"0.7522999",
"0.74815714",
"0.7454076",
"0.74234504",
"0.7395623",
"0.7371044",
"0.7371044",
"0.73696023",
"0.7360548",
"0.7360548",
"0.7360548",
"0.7360548",
"0.7360548",
"0.7360548",
"0.7360548"... | 0.0 | -1 |
Create a new category | def create
category = Documents::Category.create(category_params)
if category.save
redirect_to categories_path
else
redirect_to categories_path, alert: I18n.t('admin.categories.validation_error')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uhook_create_category\n category = ::Category.new(params[:category])\n category.locale = current_locale\n category\n end",
"def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend",
"def cre... | [
"0.81160194",
"0.79922956",
"0.79185677",
"0.7793888",
"0.7780137",
"0.76504683",
"0.7639943",
"0.7604499",
"0.7575602",
"0.7570226",
"0.7570197",
"0.7563525",
"0.7563525",
"0.7531577",
"0.7520709",
"0.7518989",
"0.7510849",
"0.75061625",
"0.75061625",
"0.75061625",
"0.750616... | 0.78885597 | 3 |
Show the edit form for an existing category | def edit
@journals = journal_list
@category = Documents::Category.find(params[:id])
render layout: false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@category = Category.find(params[:id])\n\tend",
"def edit\n\t\t@category = Category.find(params[:id])\n\tend",
"def edit\n @category = Category.find(params[:id])\n end",
"def edit\n @category = Category.find(params[:id])\n end",
"def edit\n @category = Category.find(params[... | [
"0.83586824",
"0.83586824",
"0.83143604",
"0.82791364",
"0.82552385",
"0.82552385",
"0.821831",
"0.82134056",
"0.8122081",
"0.8110967",
"0.7894507",
"0.77133536",
"0.76443094",
"0.75298023",
"0.7527637",
"0.7417307",
"0.73672897",
"0.7328644",
"0.72957647",
"0.72689146",
"0.7... | 0.65123755 | 77 |
Update the parameters of an existing category | def update
category = Documents::Category.find(params[:id])
category.update!(category_params)
redirect_to categories_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @category.update(category_params)\n end",
"def update\n Category.update(params[:category].keys, params[:category].values)\n\n redirect_to admin_ads_path\n end",
"def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n ... | [
"0.7718946",
"0.7666295",
"0.76174384",
"0.7557798",
"0.75098485",
"0.7487584",
"0.72935927",
"0.7286536",
"0.72782093",
"0.7273553",
"0.7273553",
"0.7253039",
"0.722008",
"0.71962404",
"0.7191206",
"0.7124601",
"0.7100617",
"0.70849836",
"0.70849836",
"0.70797753",
"0.702397... | 0.7105396 | 16 |
Delete an individual category | def destroy
category = Documents::Category.find(params[:id])
category.destroy
redirect_to categories_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_category(category)\n data.delete_category(category)\n end",
"def destroy\n @category.delete\n end",
"def remove_category category_name\r\n delete category_name\r\n end",
"def destroy\n @category.destroy\n end",
"def delete_category id\n\t\t\t\t\tFreshdesk::Api::Client.del... | [
"0.8705136",
"0.8388428",
"0.8312891",
"0.8121466",
"0.8097138",
"0.79967153",
"0.797505",
"0.794454",
"0.7801204",
"0.77812016",
"0.7749321",
"0.76878387",
"0.76784784",
"0.766632",
"0.7646991",
"0.76065975",
"0.75989985",
"0.75985354",
"0.75846106",
"0.75823075",
"0.7581975... | 0.7862209 | 8 |
Whitelist acceptable category parameters | def category_params
params.require(:documents_category).permit(:name, journals: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def category_params\n params[:category][:related_category_ids].reject! { |c| c.empty? } if params[:category][:related_category_ids]\n params[:category][:related_by_category_ids].reject! { |c| c.empty? } if params[:category][:related_by_category_ids]\n params[:category][:suggested_category_ids].reject! { |... | [
"0.65918785",
"0.6520349",
"0.65130043",
"0.65064466",
"0.64219385",
"0.63662845",
"0.632107",
"0.6259186",
"0.62589496",
"0.6247059",
"0.62397075",
"0.62171",
"0.6213012",
"0.6188303",
"0.6176929",
"0.6173933",
"0.61540216",
"0.6151966",
"0.61365944",
"0.6126754",
"0.6120913... | 0.0 | -1 |
Take the given hash and category, and set its children as appropriate | def set_children_for(category, hash)
if hash['children']
hash['children'].each do |ch|
child = Documents::Category.find(ch['id'])
child.parent = category
child.save
set_children_for(child, ch)
end
else
# Can't remove children, so nil out the p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_categories(product)\n categories = value('category').split('&')\n\n categories.each do |category_string|\n category_string.strip!\n subcategories = category_string.split('>')\n parent_id = self.root_category.id\n subcategories.each do |category_url_key|\n cate... | [
"0.6269093",
"0.60685337",
"0.60029465",
"0.6001196",
"0.58774406",
"0.5875418",
"0.5862771",
"0.586245",
"0.58206314",
"0.57982236",
"0.5791305",
"0.5769516",
"0.5747947",
"0.5711258",
"0.56724143",
"0.5650478",
"0.5640234",
"0.55902344",
"0.5530768",
"0.55278486",
"0.552538... | 0.80368084 | 0 |
Return a list of all journals that can be added to a category | def journal_list
ret = []
offset = 0
loop do
result = RLetters::Solr::Connection.search(
q: '*:*',
def_type: 'lucene',
rows: 1,
'facet.count': '100',
'facet.offset': offset.to_s
)
break unless result.facets
facets = r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meal_categories\n # API EXAMPLE: https://www.themealdb.com/api/json/v1/1/list.php?c=list\n content = api_call('list.php?c=list')\n validate(content)\n content\n end",
"def list\n @journals = Journal.all\n end",
"def all_categories\n end",
"def categories\n add_to_query re... | [
"0.6265461",
"0.6119854",
"0.5893255",
"0.57891095",
"0.57691133",
"0.5765748",
"0.57305646",
"0.56753606",
"0.56537646",
"0.56356764",
"0.56098264",
"0.5582014",
"0.5564689",
"0.5553399",
"0.5544319",
"0.55430347",
"0.5523176",
"0.55040956",
"0.5494935",
"0.548374",
"0.54791... | 0.0 | -1 |
Turns this transaction into a Hash that can be sent via soap to the provider | def to_hash
AchClient::ICheckGateway::CompanyInfo.build.to_hash.merge({
APIMethod: 'ProcessCheck',
Amount: amount,
RoutingNumber: routing_number.to_s,
AccountNumber: account_number.to_s,
AccountType: AchClient::ICheckGateway::AccountTypeTransformer
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hash\n [additional_details, blockchain, fee_priority, network, recipients, total_transaction_amount, transaction_id, transaction_request_status, transaction_type, unit, wallet_id].hash\n end",
"def hash_transactions\n tx_ids = transactions.map do |tx|\n tx.id\n end\n Digest::SHA256.hexd... | [
"0.70527416",
"0.69201714",
"0.68898565",
"0.6725102",
"0.6654561",
"0.6654561",
"0.66157824",
"0.66122144",
"0.6568209",
"0.6562143",
"0.64774346",
"0.64721733",
"0.64656335",
"0.6452008",
"0.64132833",
"0.64132833",
"0.6396862",
"0.637934",
"0.63736504",
"0.6348656",
"0.633... | 0.0 | -1 |
GET /challenges GET /challenges.xml | def index
@challenges = Challenge.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @challenges }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.haml\n format.json { render json: @challenges }\n end\n end",
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render... | [
"0.6803577",
"0.6728107",
"0.67091334",
"0.6674856",
"0.6674856",
"0.6674856",
"0.6674856",
"0.6667852",
"0.6463627",
"0.6413808",
"0.63771206",
"0.6290307",
"0.6281759",
"0.6229143",
"0.6097002",
"0.6093464",
"0.60923636",
"0.6045768",
"0.5998104",
"0.58445114",
"0.5817884",... | 0.7461396 | 0 |
GET /challenges/1 GET /challenges/1.xml | def show
if request.xhr?
id = params[:ch_id]
@challenge = Challenge.find(id)
request.format = :json
else
@challenge = Challenge.find(params[:id])
end
respond_to do |format|
format.html { render :action => "index" }# show.html.erb
format.xml... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @challenges }\n end\n end",
"def show\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.x... | [
"0.7383117",
"0.6794552",
"0.6505099",
"0.6436051",
"0.6373914",
"0.6373914",
"0.6373914",
"0.6373914",
"0.63658637",
"0.6233001",
"0.6081488",
"0.60770935",
"0.60567075",
"0.6035317",
"0.5991589",
"0.5967523",
"0.5966801",
"0.59262055",
"0.5905739",
"0.5901013",
"0.5893256",... | 0.5465374 | 40 |
GET /challenges/new GET /challenges/new.xml | def new
@challenge = Challenge.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @challenge }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @challenge = Challenge.new\n @charities = Charity.find(:all, :order => :name)\n @sponsors = Sponsor.find(:all, :order => :name)\n @activities = Activity.find(:all, :order => :name)\n @tags = Tag.find(:all, :order => :name)\n respond_to do |format|\n format.html # new.html.erb\n ... | [
"0.69985414",
"0.69382435",
"0.68544227",
"0.68544227",
"0.68544227",
"0.6798342",
"0.6798342",
"0.6664263",
"0.6553692",
"0.65018755",
"0.65003836",
"0.6500273",
"0.6492642",
"0.64552945",
"0.6454501",
"0.6451231",
"0.644716",
"0.64124626",
"0.6405961",
"0.6402187",
"0.63948... | 0.7550485 | 0 |
POST /challenges POST /challenges.xml | def create
@challenge = Challenge.new(params[:challenge])
respond_to do |format|
if @challenge.save
flash[:notice] = 'Challenge was successfully created.'
format.html { redirect_to(@challenge) }
format.xml { render :xml => @challenge, :status => :created, :location => @challenge ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @challenges = Challenge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @challenges }\n end\n end",
"def new\n @challenge = Challenge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xm... | [
"0.6130845",
"0.6104952",
"0.599289",
"0.5959405",
"0.59540683",
"0.5828759",
"0.5825292",
"0.57907087",
"0.5732005",
"0.57133687",
"0.5711412",
"0.5680116",
"0.5673288",
"0.56070834",
"0.56000197",
"0.5578913",
"0.5567122",
"0.5557702",
"0.5557702",
"0.55560833",
"0.55448914... | 0.6457111 | 0 |
PUT /challenges/1 PUT /challenges/1.xml | def update
@challenge = Challenge.find(params[:id])
respond_to do |format|
if @challenge.update_attributes(params[:challenge])
flash[:notice] = 'Challenge was successfully updated.'
format.html { redirect_to(@challenge) }
format.xml { head :ok }
else
format.html { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n expose Challenge.update(@oauth_token, params[:challenge_id].strip,\n params[:data])\n end",
"def update\n @challenge ||= Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, not... | [
"0.61307466",
"0.59746647",
"0.59345686",
"0.59345686",
"0.5857802",
"0.57398766",
"0.5711691",
"0.56959635",
"0.56398433",
"0.56285036",
"0.5594382",
"0.55895764",
"0.5561022",
"0.55583876",
"0.55583876",
"0.55583876",
"0.55583876",
"0.55583876",
"0.5556457",
"0.55464333",
"... | 0.63591146 | 1 |
DELETE /challenges/1 DELETE /challenges/1.xml | def destroy
@challenge = Challenge.find(params[:id])
@challenge.destroy
respond_to do |format|
format.html { redirect_to(challenges_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n #REQUIRES: existence of contest with :id\n #MODIFIES: the database\n #EFFECTS: deletes the information in the database of the contest with :id\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to(contests_url) }\n forma... | [
"0.6849034",
"0.67672354",
"0.67376816",
"0.67376816",
"0.67376816",
"0.67259276",
"0.67171764",
"0.6706058",
"0.6705198",
"0.6659304",
"0.664068",
"0.66222394",
"0.66201735",
"0.6579831",
"0.6557695",
"0.64986295",
"0.6492962",
"0.64544207",
"0.64317",
"0.64219475",
"0.64219... | 0.74575585 | 1 |
Fetch new IP Address from first_ip and index function | def fetch_ip_address(first_ip, i)
array = first_ip.split('.')
change = (array.first 3).push(array[-1].to_i + i)
new_ip = ""
for i in change
new_ip += "." + i.to_s
end
return new_ip[1..-1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_assigned\n Ip.find(:first, :conditions => \n ['address_i > ? AND service = ? and network_id is not null', self.address_i, self.service], :order => 'address_i asc')\n end",
"def next_ip\n\t\t@ip_pos += 1\n\t\t@ip_pos = 0 if @ip_pos >= @arry_ips.length\n\tend",
"def index\n \n @ip_jo... | [
"0.66371566",
"0.6596373",
"0.61871666",
"0.6172259",
"0.616404",
"0.6148115",
"0.6028361",
"0.6011428",
"0.59186774",
"0.5909313",
"0.58690965",
"0.58351237",
"0.5819356",
"0.58111376",
"0.5806595",
"0.57783914",
"0.57451355",
"0.57383895",
"0.57373255",
"0.571526",
"0.56981... | 0.6818389 | 0 |
Public Methods callseq: Kconv.kconv(str, out_code, in_code = Kconv::AUTO) Convert str to out_code. out_code and in_code are given as constants of Kconv. Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want to decode them, use NKF.nkf. | def kconv(str, out_code, in_code = AUTO)
opt = '-'
case in_code
when ::NKF::JIS
opt << 'J'
when ::NKF::EUC
opt << 'E'
when ::NKF::SJIS
opt << 'S'
when ::NKF::UTF8
opt << 'W'
when ::NKF::UTF16
opt << 'W16'
end
case out_code
when ::NKF::JIS
opt ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def toutf8(str)\n ::NKF::nkf('-wm', str)\n end",
"def normalize!(string, options = {})\n unify_voiced_katakana!(string)\n normalize_charwid... | [
"0.6672627",
"0.6035137",
"0.60225886",
"0.58952147",
"0.58342874",
"0.583078",
"0.5820545",
"0.5608768",
"0.5592635",
"0.5587364",
"0.5504262",
"0.5501117",
"0.54515433",
"0.54430974",
"0.5441092",
"0.53811884",
"0.5379602",
"0.53480047",
"0.53326887",
"0.53311425",
"0.53265... | 0.81049734 | 0 |
Encode to callseq: Kconv.tojis(str) > string Convert str to ISO2022JP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('jxm0', str). | def tojis(str)
::NKF::nkf('-jm', str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tojis; Kconv.tojis(self) end",
"def toutf8(str)\n ::NKF::nkf('-wm', str)\n end",
"def tosjis; Kconv.tosjis(self) end",
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def kconv(str, out_co... | [
"0.708227",
"0.6755341",
"0.66166526",
"0.6570429",
"0.64216846",
"0.63408977",
"0.6247393",
"0.615389",
"0.61476034",
"0.60412407",
"0.6033712",
"0.60058874",
"0.5984637",
"0.5964849",
"0.59043354",
"0.5874124",
"0.5853941",
"0.5785717",
"0.5740667",
"0.57272464",
"0.5718444... | 0.76257074 | 0 |
callseq: Kconv.toeuc(str) > string Convert str to EUCJP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('exm0', str). | def toeuc(str)
::NKF::nkf('-em', str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def toeuc; Kconv.toeuc(self) end",
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def toutf8; Kconv.toutf8(self) end",
"def to_chi... | [
"0.62796515",
"0.62690276",
"0.62589365",
"0.6027342",
"0.5979895",
"0.5930107",
"0.5883229",
"0.5879415",
"0.5860001",
"0.58266497",
"0.57717115",
"0.57717115",
"0.5756651",
"0.5754821",
"0.57196504",
"0.5695234",
"0.567629",
"0.56717855",
"0.5644566",
"0.56382644",
"0.55991... | 0.6082589 | 3 |
callseq: Kconv.tosjis(str) > string Convert str to Shift_JIS Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('sxm0', str). | def tosjis(str)
::NKF::nkf('-sm', str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tojis(str)\n ::NKF::nkf('-jm', str)\n end",
"def tosjis; Kconv.tosjis(self) end",
"def tojis; Kconv.tojis(self) end",
"def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > 0x7f) ? 1 : 0\n hi +... | [
"0.7633478",
"0.72962385",
"0.7130548",
"0.6998048",
"0.69295764",
"0.65437055",
"0.6470854",
"0.62177044",
"0.61156046",
"0.5964748",
"0.5874158",
"0.58657634",
"0.5723059",
"0.5618021",
"0.55948216",
"0.55146575",
"0.5369005",
"0.5367491",
"0.5343318",
"0.52747214",
"0.5229... | 0.64277506 | 7 |
callseq: Kconv.toutf8(str) > string Convert str to UTF8 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('wxm0', str). | def toutf8(str)
::NKF::nkf('-wm', str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def toutf8; Kconv.toutf8(self) end",
"def to_utf8(str)\n if RUBY_VERSION == \"1.8.7\"\n str\n else\n str.force_encoding(Encoding::UTF_8.name)\n end\n end",
"def to_utf8(str)\n str.encode(Encoding::UTF_8)\n en... | [
"0.8075774",
"0.7412787",
"0.67929983",
"0.67686206",
"0.67330045",
"0.6707624",
"0.6656892",
"0.655789",
"0.6537718",
"0.6502155",
"0.64538467",
"0.6434924",
"0.63885677",
"0.63417566",
"0.6299238",
"0.6287334",
"0.62757605",
"0.6227602",
"0.61906576",
"0.61903065",
"0.61630... | 0.77158505 | 1 |
callseq: Kconv.toutf16(str) > string Convert str to UTF16 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('w16xm0', str). | def toutf16(str)
::NKF::nkf('-w16m', str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end",
"def toutf16; Kconv.toutf16(self) end",
"def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.up... | [
"0.8049237",
"0.78257257",
"0.7342039",
"0.7328037",
"0.7024019",
"0.64593583",
"0.62446725",
"0.61012155",
"0.59815633",
"0.58657616",
"0.5748576",
"0.56195813",
"0.5603677",
"0.5586325",
"0.5581748",
"0.5555502",
"0.55537474",
"0.5509358",
"0.54509634",
"0.5442488",
"0.5406... | 0.86275566 | 0 |
guess callseq: Kconv.guess(str) > integer Guess input encoding by NKF.guess2 | def guess(str)
::NKF::guess(str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess_old(str)\n ::NKF::guess1(str)\n end",
"def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n results[index] = :h\n elsif @code.include? char\n results[index] = :n\n else\n ... | [
"0.7673906",
"0.64907783",
"0.6242254",
"0.62359",
"0.6129248",
"0.61051196",
"0.6074401",
"0.607052",
"0.59913135",
"0.59260213",
"0.5920192",
"0.58827853",
"0.5854205",
"0.5852523",
"0.5802686",
"0.579727",
"0.5737099",
"0.571667",
"0.5707337",
"0.5700339",
"0.568195",
"0... | 0.7727014 | 0 |
callseq: Kconv.guess_old(str) > integer Guess input encoding by NKF.guess1 | def guess_old(str)
::NKF::guess1(str)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guess(str)\n ::NKF::guess(str)\n end",
"def guess_encoding(guesser = CharDet)\n Encoding.find(guesser.detect(self, :silent => true)[\"encoding\"])\n end",
"def score_string(guess)\n results = Array.new()\n guess.split('').each_with_index do |char, index|\n if char == @code[index]\n... | [
"0.73427606",
"0.6043232",
"0.60032916",
"0.59891504",
"0.5946261",
"0.59267485",
"0.58515054",
"0.5780548",
"0.56909466",
"0.55836755",
"0.5577254",
"0.55177957",
"0.55114967",
"0.5471276",
"0.54660636",
"0.54580706",
"0.54511774",
"0.54375833",
"0.5425494",
"0.54016185",
"0... | 0.81876945 | 0 |
isEncoding callseq: Kconv.iseuc(str) > obj or nil Returns whether input encoding is EUCJP or not. Note don't expect this return value is MatchData. | def iseuc(str)
RegexpEucjp.match( str )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isutf8;\tKconv.isutf8(self) end",
"def is_utf8?\n case encoding\n when Encoding::UTF_8, Encoding::US_ASCII\n valid_encoding?\n when Encoding::ASCII_8BIT\n dup.force_encoding(Encoding::UTF_8).valid_encoding?\n else\n false\n end\n end",
"def utf8?\n return true if e... | [
"0.69005686",
"0.64844155",
"0.64839894",
"0.64839894",
"0.6385234",
"0.6375801",
"0.6375801",
"0.6300701",
"0.62573624",
"0.62573624",
"0.61445403",
"0.61025894",
"0.60882515",
"0.60882515",
"0.6062549",
"0.60594136",
"0.60585016",
"0.60305655",
"0.5958203",
"0.5911284",
"0.... | 0.62073314 | 10 |
callseq: Kconv.issjis(str) > obj or nil Returns whether input encoding is Shift_JIS or not. Note don't expect this return value is MatchData. | def issjis(str)
RegexpShiftjis.match( str )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issjis;\tKconv.issjis(self) end",
"def tojis(str)\n ::NKF::nkf('-jm', str)\n end",
"def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > 0x7f) ? 1 : 0\n hi += (lo >= 0x9e) ? 1 : 0\n lo -= (lo >... | [
"0.7661919",
"0.6343163",
"0.6321212",
"0.59379035",
"0.58789",
"0.5490069",
"0.52220505",
"0.4881004",
"0.47428605",
"0.46546423",
"0.46505144",
"0.4622918",
"0.46080738",
"0.46080738",
"0.45883483",
"0.4574256",
"0.4567638",
"0.45228842",
"0.44611442",
"0.44537628",
"0.4451... | 0.8358608 | 0 |
callseq: Kconv.isutf8(str) > obj or nil Returns whether input encoding is UTF8 or not. Note don't expect this return value is MatchData. | def isutf8(str)
RegexpUtf8.match( str )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isutf8;\tKconv.isutf8(self) end",
"def valid_utf8?(str)\n valid_utf8_bson?(str)\n end",
"def is_utf8?\n case encoding\n when Encoding::UTF_8, Encoding::US_ASCII\n valid_encoding?\n when Encoding::ASCII_8BIT\n dup.force_encoding(Encoding::UTF_8).valid_encoding?\n else\n fa... | [
"0.80969024",
"0.78433543",
"0.78011835",
"0.76702",
"0.766819",
"0.7629463",
"0.7629463",
"0.7285058",
"0.7136782",
"0.6962411",
"0.67771316",
"0.66091025",
"0.64248896",
"0.6385777",
"0.63589907",
"0.62616825",
"0.62520456",
"0.61481845",
"0.61409163",
"0.6046982",
"0.60469... | 0.80582535 | 1 |
to Encoding callseq: Stringtojis > string Convert self to ISO2022JP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('jxm0', str). | def tojis; Kconv.tojis(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tojis(str)\n ::NKF::nkf('-jm', str)\n end",
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def toutf8(str)\n ::NKF::nkf('-wm', str)\n end",
"def decode_b(str)\n str.gsub!(/=\\?ISO-20... | [
"0.72973675",
"0.6658342",
"0.65902394",
"0.65656745",
"0.6443691",
"0.6428121",
"0.64044416",
"0.6237717",
"0.60328895",
"0.6001594",
"0.59991425",
"0.5940418",
"0.59331274",
"0.59236026",
"0.591415",
"0.58946717",
"0.5888195",
"0.5881566",
"0.5857376",
"0.5840343",
"0.58389... | 0.6933535 | 1 |
callseq: Stringtoeuc > string Convert self to EUCJP Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('exm0', str). | def toeuc; Kconv.toeuc(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def to_katakana(src)\n src\n .gsub(\"わ゙\",\"ヷ\")\n .gsub(\"い゙\",\"ヸ\")\n .gsub(\"え゙\",\"ヹ\")\n .gsub(\"を゙\",\"ヺ\")\n .tr(\"ぁ-ゖゝゞゟ\",\"ァ-ヶヽヾヿ\")\nend",
"def to_chinese_text!\n possible = SUPPORTED_CHINESE_ENCODINGS.select do |encoding|\n ... | [
"0.63241917",
"0.6312091",
"0.62795883",
"0.62537575",
"0.6230468",
"0.61383516",
"0.61236346",
"0.61236346",
"0.6008206",
"0.6007853",
"0.60051024",
"0.5998348",
"0.5972655",
"0.595269",
"0.5906833",
"0.58974916",
"0.5888481",
"0.5876529",
"0.58731574",
"0.58645785",
"0.5827... | 0.588238 | 17 |
callseq: Stringtosjis > string Convert self to Shift_JIS Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('sxm0', str). | def tosjis; Kconv.tosjis(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tojis(str)\n ::NKF::nkf('-jm', str)\n end",
"def tojis; Kconv.tojis(self) end",
"def issjis(str)\n RegexpShiftjis.match( str )\n end",
"def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > ... | [
"0.72155315",
"0.6884079",
"0.6802869",
"0.6474498",
"0.64476514",
"0.6105865",
"0.6050587",
"0.6046315",
"0.5992964",
"0.59074646",
"0.5477976",
"0.5462061",
"0.54438055",
"0.5395735",
"0.5376171",
"0.5365735",
"0.53073335",
"0.52386487",
"0.5180197",
"0.51758",
"0.5140072",... | 0.6861021 | 2 |
callseq: Stringtoutf8 > string Convert self to UTF8 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('wxm0', str). | def toutf8; Kconv.toutf8(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_utf8(str)\n return Kconv.toutf8(str.strip)\n end",
"def toutf8(str)\n ::NKF::nkf('-wm', str)\n end",
"def to_utf8(str)\n str.encode(Encoding::UTF_8)\n end",
"def to_utf8(str)\n str.to_s.encode('utf-8', invalid: :replace, undef: :replace)\n end",
"def to_utf8(str)\n ... | [
"0.75941664",
"0.7314398",
"0.70990163",
"0.7065679",
"0.6982743",
"0.69763625",
"0.6861917",
"0.676637",
"0.67141926",
"0.6713495",
"0.6670982",
"0.66073817",
"0.66073817",
"0.6589444",
"0.6526584",
"0.6509584",
"0.6489961",
"0.6470899",
"0.6459954",
"0.6458987",
"0.63925165... | 0.7179808 | 2 |
callseq: Stringtoutf16 > string Convert self to UTF16 Note This method decode MIME encoded string and convert halfwidth katakana to fullwidth katakana. If you don't want it, use NKF.nkf('w16xm0', str). | def toutf16; Kconv.toutf16(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def toutf16(str)\n ::NKF::nkf('-w16m', str)\n end",
"def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end",
"def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\",... | [
"0.8252426",
"0.7897078",
"0.7360288",
"0.71693677",
"0.68734056",
"0.65230435",
"0.6292066",
"0.62168086",
"0.620718",
"0.59250987",
"0.58182025",
"0.5809964",
"0.5806715",
"0.5794393",
"0.5748428",
"0.5742194",
"0.5692082",
"0.56716526",
"0.5657539",
"0.56498486",
"0.563709... | 0.7502621 | 2 |
is Encoding callseq: Stringiseuc > obj or nil Returns whether self's encoding is EUCJP or not. Note don't expect this return value is MatchData. | def iseuc; Kconv.iseuc(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def isutf8;\tKconv.isutf8(self) end",
"def encoding_found; end",
"def encoding_found; end",
"def found_encoding; end",
"def found_encoding; end",
"def is_utf8?\n ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)\n end",
"def utf8?\n return true if encoding.n... | [
"0.69117785",
"0.6713687",
"0.6713687",
"0.67017657",
"0.67017657",
"0.6518641",
"0.6391397",
"0.6391397",
"0.622906",
"0.622906",
"0.6096197",
"0.605986",
"0.60394746",
"0.5907816",
"0.5902572",
"0.5824572",
"0.5808337",
"0.57507926",
"0.57357484",
"0.57344484",
"0.57199407"... | 0.0 | -1 |
callseq: Stringissjis > obj or nil Returns whether self's encoding is Shift_JIS or not. Note don't expect this return value is MatchData. | def issjis; Kconv.issjis(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def issjis(str)\n RegexpShiftjis.match( str )\n end",
"def sjis_to_jis(sjis)\n hi = (sjis >> 8) & 0xff\n lo = sjis & 0xff\n return lo if hi == 0\n hi -= (hi<=0x9f) ? 0x71 : 0xb1\n hi = hi * 2 + 1\n lo -= (lo > 0x7f) ? 1 : 0\n hi += (lo >= 0x9e) ? 1 : 0\n lo -= (lo >= 0x9e) ? 0x7d : 0x1f\n return hi ... | [
"0.78617245",
"0.63576937",
"0.6075019",
"0.5898598",
"0.5733153",
"0.5017433",
"0.4953141",
"0.4953141",
"0.4833311",
"0.4797285",
"0.47745046",
"0.47745046",
"0.4661776",
"0.46436983",
"0.46217874",
"0.45365956",
"0.44326475",
"0.44192865",
"0.43909281",
"0.43902507",
"0.43... | 0.7414598 | 1 |
callseq: Stringisutf8 > obj or nil Returns whether self's encoding is UTF8 or not. Note don't expect this return value is MatchData. | def isutf8; Kconv.isutf8(self) end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_utf8?\n ActiveSupport::Multibyte::Handlers::UTF8Handler.consumes?(self)\n end",
"def utf8?\n return true if encoding.nil?\n encoding == \"UTF-8\"\n end",
"def utf8?\n return true if encoding.nil?\n encoding == \"UTF-8\"\n ... | [
"0.7808475",
"0.77118534",
"0.77118534",
"0.7521071",
"0.73302364",
"0.7279393",
"0.7240737",
"0.692308",
"0.69070244",
"0.67988724",
"0.6774854",
"0.66129094",
"0.6494309",
"0.63954467",
"0.6335002",
"0.63066363",
"0.6240951",
"0.62139845",
"0.61998117",
"0.61885583",
"0.617... | 0.77797395 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_subject
@subject = Subject.find params[:subject_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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def manual_params
params.require(:manual).permit(:name, :name_ukr, :subject, :file)
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 |
TODO Implement me correctly | def opinion_poll(*args)
options = args.extract_options!.symbolize_keys
poll_identifier = args.pop
waiting_time = waiting_time()
Rails.logger.debug { "Poll identifier: #{poll_identifier.inspect}" }
Rails.logger.debug { "Other options: #{options.inspect}" }
Rails.logger.debug { "opinion_user: #{opinion... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def suivre; end",
"def formation; end",
"def refutal()\n end",
"def verdi; end",
"def operations; end",
"def operations; end",
"def identify; end",
... | [
"0.748555",
"0.66358423",
"0.65836436",
"0.63902575",
"0.63902575",
"0.63902575",
"0.63902575",
"0.6268702",
"0.622426",
"0.61125827",
"0.6030002",
"0.5969891",
"0.5969891",
"0.5967723",
"0.591067",
"0.58784556",
"0.58784556",
"0.58782244",
"0.5856519",
"0.5846037",
"0.584603... | 0.0 | -1 |
Whether the poll should be displayed. | def opinion_show_poll?
begin
!opinion_user.nil?
rescue NoMethodError
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def none?\n self.display_on == \"none\"\n end",
"def displayed?; end",
"def visible?\n @visible\n end",
"def visible?\n @visible\n end",
"def visible?\n\t\t\t@visible\n\t\tend",
"def visible?\n end",
"def visible?; \n\t\t@visible = true if @visible == nil\n\t\t@visible\n\tend",
"... | [
"0.6828312",
"0.6826389",
"0.67114335",
"0.67114335",
"0.6707115",
"0.66168153",
"0.65816414",
"0.6580757",
"0.6567434",
"0.6566592",
"0.654277",
"0.6489286",
"0.64805996",
"0.64805996",
"0.64805996",
"0.64805996",
"0.64422774",
"0.6438991",
"0.6374206",
"0.6372065",
"0.63672... | 0.7540485 | 0 |
Create new favorite for current customer | def create
fav_params = params.require(:favorite).permit(:content_id, :content_type)
@favorite = Favorite.new(fav_params)
@favorite.customer_id = current_person.user.id
@favorite.save
redirect_to request.referer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite\n\t\tclient = Client.find(params[:client_id])\n\t\tfavorite = Favorite.new(client_id: params[:client_id])\n\t\tcurrent_user.customer.favorites ||= []\n\t\tcurrent_user.customer.favorites << favorite\n\t\tredirect_to root_path, notice: \"Company added to favorites\"\n\tend",
"def add_favorite options... | [
"0.8271767",
"0.7489527",
"0.7459689",
"0.7435058",
"0.7305186",
"0.72869235",
"0.7279919",
"0.7273035",
"0.7238405",
"0.72163254",
"0.71911955",
"0.71271384",
"0.70735866",
"0.7070294",
"0.70605356",
"0.70605356",
"0.70395124",
"0.70105875",
"0.70036817",
"0.69478494",
"0.69... | 0.78577256 | 1 |
Check favorite belongs to current user | def correct_customer
@favorite = Favorite.find(params[:id])
current_person.user == @favorite.customer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite?\n\t is_favorite_of User.current_user\n\tend",
"def favorite_check user, img\n user.favorites.each do |fav|\n if fav.image_id == img.id\n return true\n end\n end\n\n return false\n end",
"def favorited_by?(user)\n favorites.where(user_id: user.id).e... | [
"0.8453774",
"0.82673335",
"0.8195808",
"0.81470245",
"0.8144753",
"0.81447154",
"0.80925196",
"0.80844986",
"0.8079686",
"0.80769765",
"0.80205786",
"0.7855721",
"0.78540003",
"0.78469074",
"0.78279215",
"0.77443",
"0.7705194",
"0.7701029",
"0.76561046",
"0.7635864",
"0.7606... | 0.66795194 | 63 |
Reduce the land mass images generated from the Google Map tiles into tiles comprising of the square 2x2 of the parent tile. For example, 4 tiles from zoom level 2 will be used to create one tile at zoom level 1 This script assumes that all tiles at the maximum zoom level exist Option hash :limit_to => allows maximum nu... | def start(*options)
limit_to = options[0][:limit_to].to_s if ( (options.length > 0) && (options[0].instance_of?(Hash)) )
overwrite = options[0].keys.include?(:overwrite) if ( (options.length > 0) && (options[0].instance_of?(Hash)) )
update_log_every = 100
tiles_processed = 0
tiles_limit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false)\n land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels)\n \n # exit if file already exists\n return false if (!overwrite && File.exists?(land_mass_tile_path))\n \n begin\n # build up square ... | [
"0.71161556",
"0.61068445",
"0.6008391",
"0.5891905",
"0.58417696",
"0.5748425",
"0.56101924",
"0.55432343",
"0.55327004",
"0.53978735",
"0.5359074",
"0.5253409",
"0.5205672",
"0.5189787",
"0.5148607",
"0.513522",
"0.51283264",
"0.5098436",
"0.509807",
"0.5092467",
"0.5091319... | 0.63503176 | 1 |
Build land mass image from Google Map image Returns true if image created | def build_reduced_land_mass_image(x, y, zoom, accuracy_pixels, overwrite = false)
land_mass_tile_path = LandMassTile.tile_path(x, y, zoom, accuracy_pixels)
# exit if file already exists
return false if (!overwrite && File.exists?(land_mass_tile_path))
begin
# build up square of 4 childre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_image(lat, long, width=500, height=400)\n \"http://maps.google.com/maps/api/staticmap?zoom=16&size=#{width}x#{height}&markers=#{lat},#{long}&sensor=false\"\n end",
"def map_image location, width=500, height=275, zoom=15\n image_tag(\"http://maps.googleapis.com/maps/api/staticmap?center=#{location.... | [
"0.65212107",
"0.6318531",
"0.60746366",
"0.6005758",
"0.5996662",
"0.59701306",
"0.59648114",
"0.58217037",
"0.5816226",
"0.57740957",
"0.57737017",
"0.57700574",
"0.5730569",
"0.5672069",
"0.5645524",
"0.5635373",
"0.56217074",
"0.55699897",
"0.5561187",
"0.55515546",
"0.55... | 0.64696825 | 1 |
get x,y tiles for all tiles at maximum zoom level 1 down to zoom level 0 (1 tile) | def get_tiles
tiles = []
accuracy_pixels_config = AppConfig.gmap_accuracy
(0...AppConfig.gmap_max_zoom).reverse_each do |zoom|
tiles_across = 2**zoom
# the accuracy will go down by half at each zoom level with a floor of 1 i.e. 8 => 4, 7 => 2, 6 => 1, 5 => 1, 4 => 1
accuracy_pixels = (accu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def google_tile(tx, ty, zoom)\n [tx, (2**zoom - 1) - ty]\n end",
"def tile_bounds(tx, ty, zoom)\n min_x, min_y = pixels_to_meters(tx * @tile_size, ty * @tile_size, zoom)\n max_x, max_y = pixels_to_meters((tx + 1) * @tile_size, (ty + 1) * @tile_size, zoom)\n [min_x, min_y, max_x, max_y]\n ... | [
"0.7280654",
"0.70180815",
"0.6971471",
"0.68322015",
"0.68322015",
"0.6829012",
"0.6770443",
"0.6716278",
"0.670656",
"0.6472291",
"0.6470912",
"0.64243317",
"0.6414456",
"0.639209",
"0.639209",
"0.623337",
"0.6219596",
"0.6210064",
"0.6206513",
"0.62036145",
"0.61381966",
... | 0.78720015 | 0 |
blow away any existing state, when next used to fetch events from mingle will crawl all the way back to time zero | def reset
@entry_cache.clear
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keep_going; end",
"def times_walked_to(state); end",
"def ack_changes\n @queries.each { |query| query[:current_state] = query[:event_state] }\n end",
"def stale_state\n end",
"def take_while( & block )\n \n load_parent_state\n \n return super\n\n end",
"def next_event\n retur... | [
"0.61940235",
"0.5989247",
"0.5892048",
"0.58775",
"0.57524645",
"0.574811",
"0.56952465",
"0.56202465",
"0.560294",
"0.560268",
"0.560268",
"0.55705076",
"0.55705076",
"0.5558158",
"0.55566275",
"0.5553874",
"0.5528348",
"0.55066186",
"0.5484289",
"0.5484289",
"0.5472873",
... | 0.0 | -1 |
fetch the latest events from mingle, i.e., the ones not previously seen | def fetch_latest
page = page_with_latest_entries
most_recent_new_entry = page.entries.first
last_fetched_entry = @entry_cache.latest
last_fetched_entry_seen = false
next_entry = nil
while !last_fetched_entry_seen && page
page.entries.each do |entry|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1... | [
"0.69378966",
"0.65406334",
"0.65316015",
"0.6414879",
"0.6306085",
"0.63015455",
"0.6299658",
"0.6170858",
"0.6140629",
"0.61404777",
"0.60318124",
"0.6023001",
"0.6018623",
"0.6009017",
"0.59951764",
"0.5986453",
"0.59799767",
"0.5959122",
"0.5954312",
"0.59327245",
"0.5920... | 0.5576948 | 66 |
returns all previously fetched entries; can be used to reprocess the events for, say, various historical analyses | def all_fetched_entries
@entry_cache.all_entries
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def entries\n @entries ||= each_entry.to_a\n end",
"def fetch_entries\n entries.inject([]){ |all, entry| all << entry << addendas[entry] }.flatten.compact\n end",
"def fetch_previous_entries\n batch_id = BatchRegistries.where(replay_name: @current_package.title).first.id\n BatchEn... | [
"0.6893237",
"0.68743587",
"0.6513726",
"0.64541024",
"0.6300125",
"0.6283504",
"0.6253153",
"0.62425214",
"0.62035984",
"0.61733747",
"0.616701",
"0.6162796",
"0.6152221",
"0.6124355",
"0.6108532",
"0.60980844",
"0.6086168",
"0.60857993",
"0.6068412",
"0.6057965",
"0.6057965... | 0.7192802 | 0 |
GET /events GET /events.json | def index
@events = Event.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}... | [
"0.83372355",
"0.8240056",
"0.79437226",
"0.7928057",
"0.7768322",
"0.7741097",
"0.76704425",
"0.7665877",
"0.7659134",
"0.76427555",
"0.76214844",
"0.7616007",
"0.7616007",
"0.76134557",
"0.75691116",
"0.7523018",
"0.7489189",
"0.7481164",
"0.7470412",
"0.74423337",
"0.74405... | 0.0 | -1 |
GET /events/1 GET /events/1.json | def show
@event = Event.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use... | [
"0.75029767",
"0.74019474",
"0.7361382",
"0.7348975",
"0.73475033",
"0.7338018",
"0.7317425",
"0.72875094",
"0.72813755",
"0.7246173",
"0.72317284",
"0.7219172",
"0.7219172",
"0.7218839",
"0.7218839",
"0.721464",
"0.7204848",
"0.71989256",
"0.7196662",
"0.71925515",
"0.719221... | 0.0 | -1 |
POST /events POST /events.json | def create
@event = Event.new(event_params)
respond_to do | format |
if @event.save
if(params.require(:event).key?("tags"))
tags = Tag.find(params.require(:event)['tags'])
else
tags = Tag.find_by(name: "Other") # Set default tag if none was selected
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def crea... | [
"0.7714071",
"0.7611226",
"0.76028967",
"0.7541319",
"0.7444731",
"0.73206913",
"0.73138195",
"0.728203",
"0.7251226",
"0.7235907",
"0.7235907",
"0.7215051",
"0.71682763",
"0.7150409",
"0.7126664",
"0.7118896",
"0.7117831",
"0.71162695",
"0.70964044",
"0.70907074",
"0.7083036... | 0.0 | -1 |
private PATCH/PUT /events/1 PATCH/PUT /events/1.json | def update
respond_to do |format|
if @event.update(event_params)
format.html { redirect_to @event, notice: 'Event was successfully updated.' }
format.json { render :show, status: :ok, location: @event }
else
format.html { render :edit }
format.json { render json: @event.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.7537089",
"0.73692966",
"0.72826266",
"0.72365457",
"0.7201157",
"0.71830827",
"0.7149663",
"0.7108273",
"0.7076145",
"0.7076145",
"0.7012079",
"0.70069283",
"0.69886845",
"0.6897466",
"0.68738306",
"0.6866166",
"0.6844737",
"0.6843305",
"0.68402004",
"0.68402004",
"0.6834... | 0.6687046 | 95 |
DELETE /events/1 DELETE /events/1.json | def destroy
@event.destroy
respond_to do |format|
format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_... | [
"0.7693181",
"0.7687918",
"0.7687918",
"0.7687918",
"0.76818216",
"0.75862354",
"0.7569196",
"0.7561378",
"0.7541531",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.7541216",
"0.754035",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.