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 |
|---|---|---|---|---|---|---|
will be used to delete a user, such as if a user wishes to deactivate their account | def delete_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_user\n client.delete(user)\n end",
"def delete_user(username, removehome=false)\n\t\t\tend",
"def delete_user_account\n # delete their favorites before deleting user\n User.all.destroy(current_user.id)\n puts \"\n Your account have been... | [
"0.8191414",
"0.7789789",
"0.7783149",
"0.77630633",
"0.7757436",
"0.768398",
"0.76836765",
"0.7661089",
"0.76607484",
"0.7652249",
"0.7634516",
"0.76338947",
"0.76324135",
"0.76161224",
"0.7584978",
"0.75597817",
"0.75314146",
"0.7500002",
"0.74910367",
"0.74800104",
"0.7453... | 0.8476807 | 0 |
will be used to verify a users credentials, and will return a JWT for the user if their login details match all 'protected' routes will need to provide the JWT as part of the 'Authorise' request header | def get_token
# Get the user by email
user = User.find_by_email(params[:email])
# return unauthorized if the user was not found
if !user
render json: { error: 'unauthorized' }, status: :unauthorized
return
end
# if the user is not authenticate... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_jwt_token\n begin\n if request.format.json?\n token = request.headers['Authorization'].split(' ').last\n decoded_token = JWT.decode token, nil, false\n @current_user = User.find(decoded_token[0][\"user_id\"])\n head :unauthorized if request.headers['Authorization'].ni... | [
"0.72924423",
"0.7147291",
"0.712556",
"0.7077887",
"0.7058313",
"0.7051835",
"0.70056665",
"0.6960114",
"0.6951509",
"0.6866897",
"0.6863795",
"0.68238354",
"0.67974824",
"0.67844856",
"0.6775467",
"0.6764032",
"0.6751671",
"0.67219275",
"0.66949487",
"0.6686087",
"0.6674039... | 0.68379414 | 11 |
Increment free variables by some ammount `diff` | def inc_frees(diff, bindings = 0)
case kind
when :variable
term > bindings ? variable(term + diff) : self
when :abstraction
lamb?(term) ? abstraction(term.inc_frees(diff, bindings + 1)) : self
when :application
t = lamb?(term) ? term.inc_frees(diff, bindings) : term
v = lamb?(var... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def increment_variable(variable)\n variable + 1\nend",
"def increase_used\n self[:numUsed] += 1\n end",
"def increment_locals\n @locals += 1\n end",
"def change_variables_for_next_pass\n @number_of_drop_points /= 2\n @number_of_passes -= 1\n @min_particles = (@min_particles * ... | [
"0.5549165",
"0.5541273",
"0.5483545",
"0.5437615",
"0.5427295",
"0.5423658",
"0.54213583",
"0.53785366",
"0.5280514",
"0.5277281",
"0.5227812",
"0.5197543",
"0.5171393",
"0.51705515",
"0.51648337",
"0.51643175",
"0.5159084",
"0.5158267",
"0.5153508",
"0.51436687",
"0.5133039... | 0.66467375 | 0 |
Uploaded file's original filename. | def original_filename
@file_representation[:filename]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_filename\n File.basename(@file_path)\n end",
"def original_filename\n instance_read(:file_name)\n end",
"def original_filename\n @original_filename ||= path.basename.to_s\n end",
"def original_filename\n @file_representation.original_filename\n end",
"de... | [
"0.88953227",
"0.88283604",
"0.8813295",
"0.87119585",
"0.8686778",
"0.8662243",
"0.86576515",
"0.86576515",
"0.86523056",
"0.8628842",
"0.8590669",
"0.85738146",
"0.8551599",
"0.8551599",
"0.8551599",
"0.83746755",
"0.8369981",
"0.8332452",
"0.82551104",
"0.8085044",
"0.8082... | 0.8786661 | 3 |
Uploaded file's original filename. | def original_filename
@file_representation.original_filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def original_filename\n File.basename(@file_path)\n end",
"def original_filename\n instance_read(:file_name)\n end",
"def original_filename\n @original_filename ||= path.basename.to_s\n end",
"def original_filename\n @file_representation[:filename]\n end",
"def filen... | [
"0.88953227",
"0.88283604",
"0.8813295",
"0.8786661",
"0.8686778",
"0.8662243",
"0.86576515",
"0.86576515",
"0.86523056",
"0.8628842",
"0.8590669",
"0.85738146",
"0.8551599",
"0.8551599",
"0.8551599",
"0.83746755",
"0.8369981",
"0.8332452",
"0.82551104",
"0.8085044",
"0.80829... | 0.87119585 | 4 |
GET /compras_documentos/1 GET /compras_documentos/1.xml | def show
@compras_documento = ComprasDocumento.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @compras_documento }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @documentos = @externo.documentos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @documentos }\n... | [
"0.72842306",
"0.7190113",
"0.69935495",
"0.67841583",
"0.6644506",
"0.6539707",
"0.6424536",
"0.6416476",
"0.6405318",
"0.63751894",
"0.63437814",
"0.6341101",
"0.63102317",
"0.62860775",
"0.62806046",
"0.62789804",
"0.62789804",
"0.62691355",
"0.6262259",
"0.62507",
"0.6249... | 0.71126646 | 2 |
GET /compras_documentos/new GET /compras_documentos/new.xml | def new
@compras_documento = ComprasDocumento.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @compras_documento }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @documento = Documento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @documento }\n end\n end",
"def new\n @documento = @externo.documentos.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { rend... | [
"0.7812566",
"0.76513314",
"0.75844675",
"0.7437444",
"0.7381589",
"0.7320871",
"0.7290362",
"0.72753036",
"0.7270858",
"0.72307825",
"0.7184112",
"0.71125215",
"0.71051455",
"0.7077941",
"0.7071166",
"0.70449865",
"0.69779944",
"0.6971657",
"0.6970932",
"0.6941613",
"0.69254... | 0.7642796 | 2 |
POST /compras_documentos POST /compras_documentos.xml | def create
@compras_documento = ComprasDocumento.new(params[:compras_documento])
@compras_documento.usuario_created = current_user.id
@compras_documento.unidade_created = current_unidade.id
respond_to do |format|
if @compras_documento.save
if @compras_documento.compra_id != nil
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @documento = @externo.documentos.build(params[:documento])\n\n respond_to do |format|\n if @documento.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to [@externo,@documento] }\n format.xml { render :xml => @documento, :status => :created, :locati... | [
"0.70248157",
"0.69009435",
"0.68630505",
"0.6741744",
"0.6738639",
"0.6731042",
"0.66983294",
"0.6612138",
"0.6604443",
"0.6563561",
"0.65353256",
"0.65304834",
"0.6522927",
"0.6511357",
"0.64986014",
"0.6460695",
"0.64498615",
"0.6440778",
"0.6380325",
"0.6369773",
"0.63457... | 0.64787686 | 15 |
PUT /compras_documentos/1 PUT /compras_documentos/1.xml | def update
@compras_documento = ComprasDocumento.find(params[:id])
@compras_documento.usuario_updated = current_user.id
@compras_documento.unidade_updated = current_unidade.id
respond_to do |format|
if @compras_documento.update_attributes(params[:compras_documento])
if @compras_documento.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @documento = @externo.documentos.find(params[:id])\n\n respond_to do |format|\n if @documento.update_attributes(params[:documento])\n flash[:notice] = 'ATUALIZADO COM SUCESSO.'\n format.html { redirect_to[@externo,@documento] }\n format.xml { head :ok }\n else\n ... | [
"0.6762354",
"0.675465",
"0.66712004",
"0.6611909",
"0.6601368",
"0.6576542",
"0.656344",
"0.6511294",
"0.6509285",
"0.6478077",
"0.646427",
"0.64544326",
"0.6426126",
"0.64131874",
"0.6377355",
"0.6359871",
"0.6356925",
"0.62818384",
"0.6263878",
"0.6258381",
"0.6223982",
... | 0.6433612 | 12 |
DELETE /compras_documentos/1 DELETE /compras_documentos/1.xml | def destroy
@compras_documento = ComprasDocumento.find(params[:id])
@compras_documento.destroy
respond_to do |format|
if @compras_documento.compra_id != nil
format.html { redirect_to "/compras/#{@compras_documento.compra_id}/compras_documento" }
else
format.html { redirect_to c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @documento = Documento.find(params[:id])\n @documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentos_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @documento = @externo.documentos.find(params[:id])\n @documento.destroy\n\n ... | [
"0.7484434",
"0.7434054",
"0.7239122",
"0.7210972",
"0.71791565",
"0.7151865",
"0.709496",
"0.7018728",
"0.7005521",
"0.69660735",
"0.695491",
"0.6918522",
"0.6918522",
"0.68777925",
"0.68710613",
"0.68710417",
"0.6858849",
"0.6858849",
"0.6858849",
"0.6848052",
"0.684665",
... | 0.6792205 | 25 |
GET /event_posts GET /event_posts.json | def index
@event_posts = EventPost.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @posts = Post.all\n @event = Event.find(params[:event_id])\n end",
"def posts\n Post.all_for_event(self.id)\n end",
"def index\n @post_events = PostEvent.all\n end",
"def index\n @eventposts = Eventpost.all\n end",
"def show\n @event = EventPost.find(params[:id])\n\n re... | [
"0.74123436",
"0.7215129",
"0.72067577",
"0.7195737",
"0.7039519",
"0.6962382",
"0.66383684",
"0.6515115",
"0.6442167",
"0.64408344",
"0.63945496",
"0.6393314",
"0.63710403",
"0.6361255",
"0.6359237",
"0.6342642",
"0.6330668",
"0.6326079",
"0.6319781",
"0.63134193",
"0.630975... | 0.7403192 | 1 |
GET /event_posts/1 GET /event_posts/1.json | def show
@event_comment = @event_post.event_comments.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @posts = Post.all\n @event = Event.find(params[:event_id])\n end",
"def index\n @event_posts = EventPost.all\n end",
"def show\n @event = EventPost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n ... | [
"0.7445876",
"0.7254312",
"0.7234473",
"0.7053251",
"0.70279646",
"0.7017798",
"0.67883515",
"0.6461561",
"0.632076",
"0.62969536",
"0.628229",
"0.6228146",
"0.62175405",
"0.62142724",
"0.6203137",
"0.6182557",
"0.6148361",
"0.6142455",
"0.61343396",
"0.61239254",
"0.61201197... | 0.0 | -1 |
POST /event_posts POST /event_posts.json | def create
@event_post = current_user.event_posts.build(event_post_params)
respond_to do |format|
if @event_post.save
format.js
format.html { redirect_to @event_post.event, notice: 'Your post was successfully created.' }
format.json { render :show, status: :created, locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @eventpost = Eventpost.new(eventpost_params)\n\n respond_to do |format|\n if @eventpost.save\n format.html { redirect_to @eventpost, notice: 'Eventpost was successfully created.' }\n format.json { render :show, status: :created, location: @eventpost }\n else\n form... | [
"0.6979177",
"0.6942771",
"0.6850472",
"0.65609884",
"0.65381825",
"0.65250134",
"0.65165114",
"0.6479541",
"0.64596075",
"0.6377163",
"0.6319733",
"0.62798434",
"0.6242681",
"0.6240578",
"0.6240031",
"0.62388444",
"0.6233159",
"0.62155783",
"0.6190026",
"0.61804366",
"0.6179... | 0.71388155 | 0 |
PATCH/PUT /event_posts/1 PATCH/PUT /event_posts/1.json | def update
respond_to do |format|
if @event_post.update(event_post_params)
format.html {}
format.json {}
else
format.html { render :edit }
format.json { render json: @event_post.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @event = EventPost.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event_post])\n track_activity @event\n format.html { redirect_to @event, notice: 'Event post was successfully updated.' }\n format.json { head :no_content }\n else... | [
"0.69557065",
"0.6854546",
"0.6645488",
"0.6599957",
"0.65928274",
"0.65907013",
"0.6555504",
"0.6547869",
"0.65405756",
"0.6519422",
"0.6460488",
"0.64364046",
"0.64364046",
"0.64310735",
"0.63595486",
"0.6353727",
"0.63362044",
"0.6315794",
"0.63124394",
"0.6309914",
"0.627... | 0.7193881 | 0 |
DELETE /event_posts/1 DELETE /event_posts/1.json | def destroy
@event_post.destroy
respond_to do |format|
format.html { redirect_to event_posts_url, notice: 'Event post was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @post_event.destroy\n respond_to do |format|\n format.html { redirect_to post_events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = EventPost.find(params[:id])\n @event.destroy\n track_activity @event\n respond_to do |format|\n fo... | [
"0.7631631",
"0.7600324",
"0.744993",
"0.73267686",
"0.72293437",
"0.72293437",
"0.72293437",
"0.7223502",
"0.71704185",
"0.71423584",
"0.711156",
"0.7109485",
"0.70961267",
"0.70930606",
"0.7084034",
"0.70735717",
"0.7068795",
"0.704391",
"0.7040844",
"0.703047",
"0.7030255"... | 0.73932755 | 3 |
Use callbacks to share common setup or constraints between actions. | def set_event_post
@event_post = EventPost.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 event_post_params
params.require(:event_post).permit(:content, :image, :event_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_search
@search = Search.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 |
Only allow a trusted parameter "white list" through. | def search_params
params.require(:search).permit(:result_no, :generate_no, :last_result_no, :last_generate_no, :e_no, :sub_no, :main_no, :i_no, :i_name, :value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
:nodoc: Creates an object with the unique device ID uid and adds it to the IP Connection ipcon. | def initialize(uid, ipcon)
super uid, ipcon
@api_version = [2, 0, 0]
@response_expected[FUNCTION_SET_STATE] = RESPONSE_EXPECTED_FALSE
@response_expected[FUNCTION_GET_STATE] = RESPONSE_EXPECTED_ALWAYS_TRUE
@response_expected[FUNCTION_SET_MONOFLOP] = RESPONSE_EXPECTED_FALSE
@response... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def identify(uid)\n @uid = uid\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def assign_id\n self.uid = service.mint unless new_record? && uid.present?\n self.id = service.hash(uid)\n end",
"def uid=(p0) en... | [
"0.5804981",
"0.5727679",
"0.5727679",
"0.5633277",
"0.558878",
"0.5519263",
"0.5497217",
"0.54126775",
"0.5361758",
"0.53073925",
"0.5304207",
"0.5294118",
"0.5260985",
"0.5237576",
"0.52204907",
"0.5206876",
"0.5171104",
"0.5141454",
"0.5102074",
"0.50959855",
"0.5094049",
... | 0.0 | -1 |
Sets the state of the relays, true means on and false means off. For example: (true, false) turns relay 1 on and relay 2 off. If you just want to set one of the relays and don't know the current state of the other relay, you can get the state with BrickletDualRelayget_state or you can use BrickletDualRelayset_selected_... | def set_state(relay1, relay2)
send_request(FUNCTION_SET_STATE, [relay1, relay2], '? ?', 0, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_monoflop(relay, state, time)\n send_request(FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 0, '')\n end",
"def lights_on(bool)\n if bool == true\n @lights = true\n end\n if bool == false\n @lights = false\n end\n end",
"def set_selected_state(relay, state)\n s... | [
"0.625356",
"0.62107843",
"0.6208044",
"0.5989883",
"0.59472734",
"0.56523764",
"0.5623492",
"0.5563686",
"0.5517462",
"0.54832906",
"0.5477973",
"0.54697466",
"0.54687476",
"0.54515016",
"0.5406506",
"0.5371659",
"0.53466696",
"0.53438705",
"0.53327674",
"0.53152263",
"0.529... | 0.7133116 | 0 |
Returns the state of the relays, true means on and false means off. | def get_state
send_request(FUNCTION_GET_STATE, [], '', 2, '? ?')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relay_on?(relay_number, bank_number)\n relay_status(relay_number, bank_number) == 1\n end",
"def lightsOn?\n return @lightsOn\n end",
"def lights_on?\n @lights\n end",
"def lights?\n @lights\n end",
"def on?\n state[\"on\"]\n end",
"def enabled?(index)\n index = check_index... | [
"0.7259359",
"0.6964504",
"0.6868728",
"0.668283",
"0.65718246",
"0.6492665",
"0.6442903",
"0.63752097",
"0.63171804",
"0.62516916",
"0.6250214",
"0.6119261",
"0.5960057",
"0.59354025",
"0.589524",
"0.58819693",
"0.5867151",
"0.5830984",
"0.58001",
"0.57857955",
"0.5782366",
... | 0.0 | -1 |
The first parameter can be 1 or 2 (relay 1 or relay 2). The second parameter is the desired state of the relay (true means on and false means off). The third parameter indicates the time (in ms) that the relay should hold the state. If this function is called with the parameters (1, true, 1500): Relay 1 will turn on an... | def set_monoflop(relay, state, time)
send_request(FUNCTION_SET_MONOFLOP, [relay, state, time], 'C ? L', 0, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def turn_on #turn the power on\n @power = true\n end",
"def turn_on!\n @turned_off = false\n end",
"def turn_on!\n set_power!(:on)\n end",
"def switch_light_off\n puts \"*** switch_light_off\"\n true\nend",
"def turn_on\n 'If the thermocycler is off, toggle the power switch in t... | [
"0.617944",
"0.61634886",
"0.61589164",
"0.6141129",
"0.61017627",
"0.60441023",
"0.6036752",
"0.602842",
"0.60258853",
"0.5951103",
"0.59432447",
"0.5889653",
"0.58228284",
"0.5814409",
"0.57596827",
"0.56815344",
"0.5642242",
"0.5600759",
"0.5549706",
"0.55426365",
"0.55047... | 0.7565251 | 0 |
Returns (for the given relay) the current state and the time as set by BrickletDualRelayset_monoflop as well as the remaining time until the state flips. If the timer is not running currently, the remaining time will be returned as 0. .. versionadded:: 1.1.1~(Plugin) | def get_monoflop(relay)
send_request(FUNCTION_GET_MONOFLOP, [relay], 'C', 9, '? L L')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remaining_time()\n return @total_time_units - @done_time_units\n end",
"def get_relay_time_swam\r\n Timing.new( @summary.relays.time_swam )\r\n end",
"def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predic... | [
"0.56807774",
"0.5673507",
"0.5646284",
"0.5557036",
"0.5549236",
"0.5381925",
"0.5310962",
"0.52435213",
"0.5217639",
"0.521542",
"0.5170319",
"0.51165926",
"0.50816923",
"0.5063534",
"0.5055943",
"0.50375235",
"0.5010582",
"0.49985668",
"0.49973458",
"0.49858415",
"0.498321... | 0.0 | -1 |
Sets the state of the selected relay (1 or 2), true means on and false means off. The other relay remains untouched. .. versionadded:: 2.0.0~(Plugin) | def set_selected_state(relay, state)
send_request(FUNCTION_SET_SELECTED_STATE, [relay, state], 'C ?', 0, '')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_state(relay1, relay2)\n send_request(FUNCTION_SET_STATE, [relay1, relay2], '? ?', 0, '')\n end",
"def toggle(index)\n index = check_index(index)\n if index.nonzero?\n relay = @relays[index]\n relay.toggle\n else\n @relays[1..-1].map(&:toggle)\n end\n en... | [
"0.707843",
"0.6119009",
"0.6034439",
"0.5995724",
"0.5972366",
"0.5958121",
"0.5882",
"0.58684576",
"0.58546305",
"0.58010656",
"0.57793075",
"0.5775271",
"0.5760486",
"0.5751905",
"0.5689979",
"0.56860685",
"0.5679877",
"0.5599112",
"0.5587938",
"0.5561873",
"0.5530352",
... | 0.6760885 | 1 |
Returns the UID, the UID where the Bricklet is connected to, the position, the hardware and firmware version as well as the device identifier. The position can be 'a', 'b', 'c' or 'd'. The device identifiers can be found :ref:`here `. .. versionadded:: 2.0.0~(Plugin) | def get_identity
send_request(FUNCTION_GET_IDENTITY, [], '', 25, 'Z8 Z8 k C3 C3 S')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id; Common.device_id(@handle); end",
"def uid() end",
"def card_uid\n buffer = PN532::DataBuffer.new\n\n resp = PN532.read_passive_target(\n pn_struct,\n buffer,\n PN532::MIFARE_ISO14443A,\n 1000\n )\n\n return if resp == PN532::STATUS_ERROR\n... | [
"0.58673203",
"0.5556567",
"0.55500466",
"0.5529604",
"0.5478734",
"0.5474052",
"0.54090244",
"0.539724",
"0.53527284",
"0.53338677",
"0.5295119",
"0.5282964",
"0.5272574",
"0.5269902",
"0.52697664",
"0.52697664",
"0.52697664",
"0.52697664",
"0.52636653",
"0.5255903",
"0.5239... | 0.0 | -1 |
Registers a callback with ID id to the block block. | def register_callback(id, &block)
callback = block
@registered_callbacks[id] = callback
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(id, &block)\n ref = __get id\n return ref.__getobj__ if ref && ref.weakref_alive?\n item = block.call\n return nil unless item\n __register id, item\n end",
"def add_callback(&block)\n @blocks << block\n end",
"def insert_callback(&block)\n @callbacks <... | [
"0.682143",
"0.6817086",
"0.6737418",
"0.6575714",
"0.65541935",
"0.6424136",
"0.6340888",
"0.61910623",
"0.61722",
"0.6161434",
"0.61123073",
"0.6048635",
"0.5999481",
"0.5982739",
"0.5982739",
"0.5962141",
"0.59317553",
"0.59183306",
"0.58524287",
"0.5841108",
"0.58352077",... | 0.888232 | 3 |
Encode all values in metadata to string. Add a tag useragent, value is bosh. | def encode_metadata(metadata)
ret = {}
metadata.each do |key, value|
ret[key] = value.to_s
end
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def meta_encode(meta)\n Base64.encode64(Marshal.dump(meta))\n end",
"def encode_meta_string meta_string\n return meta_string.gsub(\" \", \"%20\") if meta_string\n end",
"def to_meta_tag_options(host = nil)\n meta_tags = { 'title' => title,\n 'description'... | [
"0.6549652",
"0.58930427",
"0.5833551",
"0.572064",
"0.5703122",
"0.5629708",
"0.5561263",
"0.5491635",
"0.5474367",
"0.54631585",
"0.5450796",
"0.5435239",
"0.54273546",
"0.5426336",
"0.5421933",
"0.53911436",
"0.53893733",
"0.53242016",
"0.53168243",
"0.52912736",
"0.528707... | 0.61704695 | 1 |
Exclude private fields from JSON response Avoids a bug in overriding as_json | def serializable_hash(*)
excludes = ['id', 'created_at', 'updated_at', 'from_searcher', 'searcher_key']
output = super.except(*excludes)
output.merge!(search_data) if search_data
# Flatten the extra data fields into output
return output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end",
"def as_json(options={})\n options[:except] ||= @@secure_fields\n super(options)\n end",
"def as_json(options={})\n\toptions[:except] ||= [:id, :chat_id]\n super\n end",
"def as_json(options = {})\n s... | [
"0.7547529",
"0.7547529",
"0.7067083",
"0.69373065",
"0.69286764",
"0.6926737",
"0.6926737",
"0.6926737",
"0.6870955",
"0.68596756",
"0.6810947",
"0.67936015",
"0.6693697",
"0.6679298",
"0.6673226",
"0.6670926",
"0.6670926",
"0.6670926",
"0.66369015",
"0.65861493",
"0.6580729... | 0.0 | -1 |
Default render method for stubbing | def render
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render\n raise NotImplementedError\n end",
"def render\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end",
"def render\n raise NotImplementedError\n end",
"def render\n # To be implemented.\n end",
"def render; end",
"def render; ... | [
"0.75116163",
"0.75017637",
"0.74772114",
"0.7452836",
"0.7431413",
"0.7431413",
"0.7431413",
"0.7431413",
"0.7431413",
"0.7409792",
"0.73901254",
"0.73381704",
"0.7331085",
"0.7329641",
"0.73155075",
"0.73062736",
"0.72223884",
"0.7195161",
"0.7179297",
"0.7179297",
"0.71684... | 0.74401766 | 6 |
GET /prices GET /prices.json | def index
# Apply the search control filter.
# Note: `like` method here is not built-in Rails scope. You need to define it by yourself.
# prices_scope = Prices.filter(params[:filter]) if params[:filter]
prices_scope = Price.titlesearch(params[:filter])
# prices_scope = Price.test
#prices_scope = P... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prices (currency='TWD')\n get '/prices/' + currency\n end",
"def all_prices\n request :public, :get, :price\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"... | [
"0.80564815",
"0.77720714",
"0.76444083",
"0.72519267",
"0.70290756",
"0.6973986",
"0.6957951",
"0.6957951",
"0.6945947",
"0.68906116",
"0.68681437",
"0.68139243",
"0.6794792",
"0.67822266",
"0.6773225",
"0.6700103",
"0.6700103",
"0.66755867",
"0.663799",
"0.6625985",
"0.6583... | 0.0 | -1 |
GET /prices/1 GET /prices/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prices (currency='TWD')\n get '/prices/' + currency\n end",
"def index\n @prices = Price.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prices }\n end\n end",
"def all_prices\n request :public, :get, :price\n end",
"... | [
"0.7621762",
"0.7437597",
"0.7303527",
"0.71403337",
"0.71403337",
"0.69267607",
"0.67967314",
"0.67550594",
"0.67269796",
"0.6697352",
"0.66963404",
"0.66812456",
"0.6677576",
"0.660229",
"0.6595571",
"0.65896916",
"0.65401906",
"0.6519044",
"0.6515281",
"0.65081286",
"0.648... | 0.0 | -1 |
POST /prices POST /prices.json | def create
@price = Price.new(price_params)
respond_to do |format|
if @price.save
format.html { redirect_to @price, notice: 'Price was successfully created.' }
format.json { render :show, status: :created, location: @price }
else
format.html { render :new }
format.js... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @price = @product.prices.new(price_params)\n\n respond_to do |format|\n if @price.save\n format.html { redirect_to product_path(@product), notice: 'Price was successfully created.' }\n format.json { render :show, status: :created, location: @price }\n else\n format... | [
"0.6758727",
"0.6671163",
"0.661703",
"0.65310246",
"0.6393697",
"0.6382712",
"0.6361112",
"0.6352605",
"0.62328905",
"0.62057966",
"0.62012786",
"0.6175537",
"0.6149828",
"0.609677",
"0.6066074",
"0.6056079",
"0.6053568",
"0.60419023",
"0.6027343",
"0.602302",
"0.60228527",
... | 0.66013044 | 3 |
PATCH/PUT /prices/1 PATCH/PUT /prices/1.json | def update
respond_to do |format|
if @price.update(price_params)
format.html { redirect_to @price, notice: 'Price was successfully updated.' }
format.json { render :show, status: :ok, location: @price }
else
format.html { render :edit }
format.json { render json: @price.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @price = Price.find(params[:id])\n\n respond_to do |format|\n if @price.update_attributes(params[:price])\n format.html { redirect_to @price, notice: 'Price was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.68183875",
"0.6725799",
"0.66991216",
"0.6592012",
"0.65293276",
"0.6500171",
"0.64391524",
"0.6431323",
"0.6420737",
"0.6416639",
"0.6364143",
"0.6360122",
"0.6344635",
"0.63351184",
"0.63148826",
"0.62910634",
"0.6284592",
"0.6263354",
"0.6263354",
"0.6260487",
"0.625999... | 0.66301733 | 4 |
DELETE /prices/1 DELETE /prices/1.json | def destroy
@price.destroy
respond_to do |format|
format.html { redirect_to prices_url, notice: 'Price was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @price = Price.find(params[:id])\n @price.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_prices_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @price = Price.find(params[:id])\n @price.destroy\n\n respond_to do |format|\n ... | [
"0.7504078",
"0.74464357",
"0.7217968",
"0.7199815",
"0.7192116",
"0.71596193",
"0.7101763",
"0.7083725",
"0.7006563",
"0.7005089",
"0.6980195",
"0.697681",
"0.6962729",
"0.69536346",
"0.69244254",
"0.6905986",
"0.6859065",
"0.68336815",
"0.6833351",
"0.6830753",
"0.6824863",... | 0.7145088 | 8 |
Use callbacks to share common setup or constraints between actions. | def set_price
@price = Price.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 price_params
params.require(:cost).permit(:title, :description, :price1, :price2, :price_category_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
I don't feel comfortable doing for in yet this solution is amazing though. | def bubble_sort(arr)
for i in 0...arr.length
sorted = true
#right here we are establishing that we will loop
#remove 1 from length
#also remove however many iterations we are on from length
#ex i = 0, length - 0 - 1, || i = 2, length - 2 - 1
#genius solution.
for k in 0...(arr.length - i - 1)
#this is the ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def through; end",
"def probers; end",
"def schubert; end",
"def offences_by; end",
"def implemented_in; end",
"def terpene; end",
"def each_identity; end",
"def from; end",
"def from; end",
"def from; end",
"def from; end",
"def intensifier; end",
"def specie; end",
... | [
"0.590407",
"0.5747837",
"0.5633793",
"0.5431199",
"0.53738886",
"0.5366144",
"0.53607833",
"0.53597975",
"0.5251813",
"0.5251813",
"0.5251813",
"0.5251813",
"0.52501816",
"0.5227344",
"0.5227344",
"0.5227344",
"0.5227344",
"0.52249527",
"0.5186591",
"0.5174813",
"0.5174813",... | 0.0 | -1 |
CHECK IF A USER CAN EDIT A USER OBJECT | def editable_by? editor=nil
return true if((editor)&&(self==editor))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def can_edit?(obj)\n return true if obj.user_id == user_id || is_admin?\n false\n end",
"def can_edit?(object)\n false\n end",
"def can_edit?(user)\n user && self.creator_id == user.id\n end",
"def can_edit?(obj)\n can_do?(:edit, obj)\n end",
"def editable_by?(user)\n \tuser && user =... | [
"0.8222855",
"0.79140794",
"0.7865083",
"0.78444153",
"0.78228146",
"0.78202444",
"0.7812076",
"0.7812076",
"0.7812076",
"0.77937585",
"0.77408284",
"0.7701788",
"0.76778686",
"0.7669581",
"0.76001376",
"0.76001376",
"0.7579023",
"0.7554536",
"0.7554536",
"0.7504465",
"0.7494... | 0.0 | -1 |
, :except => [ :index ] | def index
@equipment = Equipment.find(:all, :conditions=>"parent_id IS NULL")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index_corruption?; end",
"def set_noindex\n @noindex = true\n end",
"def index_disabled\n @index_disabled ||= false\n end",
"def index?\n false\n end",
"def index\n set_excuses\n end",
"def index_valid?\n false\n end",
"def index\n super\n end",
"def index\n ... | [
"0.7026084",
"0.6986104",
"0.69570976",
"0.6952897",
"0.6856829",
"0.6852181",
"0.6831336",
"0.6732212",
"0.66909766",
"0.6683072",
"0.6680076",
"0.66540486",
"0.664732",
"0.66243863",
"0.6614692",
"0.66012156",
"0.65785044",
"0.6528516",
"0.6489338",
"0.6474558",
"0.6474558"... | 0.0 | -1 |
Previous edition relative to a specified edition | def previous_to( edition )
for_request( edition.fund_request ).
select { |e| e.perspective == edition.previous_perspective }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def previous_revision\n get_revision('PREVIOUS_REVISION')\n end",
"def previous_revision\n self.class.find_by(\n revisable_original_id: revisable_original_id,\n revisable_number: revisable_number - 1\n )\n end",
"def previous_revision\n self.class.fin... | [
"0.7346634",
"0.6803471",
"0.6760724",
"0.6659707",
"0.6659087",
"0.6633459",
"0.6625799",
"0.6606327",
"0.659489",
"0.6507191",
"0.6409449",
"0.6407633",
"0.6407633",
"0.63958347",
"0.63920677",
"0.6391958",
"0.63914436",
"0.6341538",
"0.6297877",
"0.6279752",
"0.6279752",
... | 0.80291563 | 0 |
Next edition relative to a specified edition | def next_to( edition )
for_request( edition.fund_request ).
select { |e| e.perspective == edition.next_perspective }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next\n offering.admin_phases.find(:first, :conditions => ['sequence > ?', self.sequence], :order => 'sequence')\n end",
"def next_revision\n self.class.find(:first, :conditions => {:revisable_original_id => revisable_original_id, :revisable_number => revisable_number + 1})\n end",
"def next... | [
"0.6294248",
"0.6186164",
"0.6176889",
"0.61229956",
"0.59551847",
"0.59259546",
"0.58812386",
"0.5810488",
"0.5781902",
"0.56876326",
"0.5671345",
"0.56602144",
"0.56579214",
"0.5625506",
"0.56200194",
"0.56188136",
"0.559",
"0.559",
"0.55770576",
"0.55766535",
"0.55318695",... | 0.7476216 | 0 |
Builds the next edition of the item for the request skips build if an existing new record exists or if the last perspective is present | def populate_for_fund_request( request )
return if proxy_association.owner.node.blank?
last = for_request( request ).last
if last.blank? || ( last.persisted? && last.perspective != FundEdition::PERSPECTIVES.last )
next_edition = build_next_for_fund_request( request )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_next_for_fund_request(request, attributes = {})\n last_edition = for_request( request ).last\n if last_edition.blank?\n next_perspective = FundEdition::PERSPECTIVES.first\n elsif last_edition.new_record?\n raise ActiveRecord::ActiveRecordError, 'Last edition is new.'\n e... | [
"0.6865117",
"0.580889",
"0.5265324",
"0.5231899",
"0.5107338",
"0.5086329",
"0.5084593",
"0.50482285",
"0.5001001",
"0.4968869",
"0.49540588",
"0.49224153",
"0.4884013",
"0.48664707",
"0.47954133",
"0.47760865",
"0.47264993",
"0.46853185",
"0.46199143",
"0.45905724",
"0.4559... | 0.5867387 | 1 |
Build the next edition of the item for specified request optionally applies attributes by mass assignment raises exceptions if last edition is new record or final perspective | def build_next_for_fund_request(request, attributes = {})
last_edition = for_request( request ).last
if last_edition.blank?
next_perspective = FundEdition::PERSPECTIVES.first
elsif last_edition.new_record?
raise ActiveRecord::ActiveRecordError, 'Last edition is new.'
elsif last_e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_for_fund_request( request )\n return if proxy_association.owner.node.blank?\n last = for_request( request ).last\n if last.blank? || ( last.persisted? && last.perspective != FundEdition::PERSPECTIVES.last )\n next_edition = build_next_for_fund_request( request )\n end\n e... | [
"0.596459",
"0.4944696",
"0.49235618",
"0.4906882",
"0.48893237",
"0.48786107",
"0.48637503",
"0.48575515",
"0.48503843",
"0.4847671",
"0.48154417",
"0.48154148",
"0.47856122",
"0.47789678",
"0.4778537",
"0.4766727",
"0.47443247",
"0.47426438",
"0.47422382",
"0.47188455",
"0.... | 0.6861849 | 0 |
What types of nodes can this item be created as? | def allowed_nodes
if is_root?
Node.with_root_fund_items_for( fund_grant ).under_limit
else
Node.with_child_fund_items_for( parent ).under_limit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def node_type; end",
"def node_type; end",
"def node_type() ; info[:node_type] ; end",
"def node_type() ; info[:node_type] ; end",
"def nodetype() @records.get_data(GRT_NODETYPE); end",
"def type(node, type); end",
"def allowed_type?(parent_node); end",
"def node_t... | [
"0.7359207",
"0.7359207",
"0.68875355",
"0.68875355",
"0.67358387",
"0.67306846",
"0.65509075",
"0.6452093",
"0.64437354",
"0.64402324",
"0.6429888",
"0.6418183",
"0.63723135",
"0.630903",
"0.624943",
"0.6223998",
"0.61258245",
"0.6110383",
"0.6110383",
"0.6110383",
"0.610536... | 0.0 | -1 |
Has the item been appended to the fund_request? it is appended if the item is new or if the item is not associated with any other actionable request (e.g. is not in process or released) | def appended_to_fund_request?( fund_request )
return true if new_record? || fund_requests.actionable.empty?
false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item_request(item)\n if(@item_requests.has_key?(item.id))\n #error\n else\n @item_requests[item.id]=item\n end\n end",
"def exceeds_appendable_quantity_limit_for_fund_request?( fund_request )\n return false unless fund_request.fund_request_type.appendable_quantity_limit... | [
"0.6673359",
"0.6539331",
"0.6287184",
"0.6287184",
"0.6263654",
"0.6229652",
"0.62077993",
"0.60347855",
"0.60187894",
"0.6009811",
"0.5990149",
"0.5986825",
"0.5956559",
"0.5948704",
"0.59051657",
"0.59019804",
"0.5901243",
"0.58991027",
"0.5886017",
"0.58735573",
"0.583954... | 0.7817037 | 0 |
Will inclusion of the item in a fund request exceed the appendable_quantity_limit for that request? | def exceeds_appendable_quantity_limit_for_fund_request?( fund_request )
return false unless fund_request.fund_request_type.appendable_quantity_limit
return true if ( fund_request.fund_items.appended.where { id != my { id } }.length ==
fund_request.fund_request_type.appendable_quantity_limit )
false
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quantity_max_available_for_amend\n quantity + quantity_rejected\n end",
"def item_quantity_sufficient?(request, item_name)\n\t\titem = Item.find_by(:unique_name => item_name)\n\t\titem.quantity - request.quantity >= 0\n\tend",
"def have_enough_items_to_trade?\n fetch_inventory\n\n is_valid = ... | [
"0.738018",
"0.71192634",
"0.7036202",
"0.65268964",
"0.640893",
"0.6408888",
"0.64020467",
"0.6328899",
"0.6265301",
"0.6224492",
"0.61919683",
"0.61688876",
"0.6160565",
"0.61487836",
"0.6126256",
"0.609585",
"0.60855657",
"0.60581315",
"0.6039194",
"0.60303",
"0.60207313",... | 0.86142814 | 0 |
Set the initial position to which the item should be assigned | def initialize_nested_position
return true if position
last_position = if is_root?
fund_grant.fund_items.maximum( :position )
else
siblings.maximum( :position ) || parent.position
end
self.position = ( last_position.blank? ? 1 : ( last_position + 1 ) )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_initial_position\n self.position = (Category.minimum(:position) || 0) - 1\n end",
"def set_initial_position\n if self.class.count == 0\n self.position = 0\n elsif self.position == nil\n self.position = self.class.last.position + 1\n end\n end",
"def reset\n set InitialPosit... | [
"0.7892782",
"0.7589124",
"0.7144677",
"0.7112911",
"0.6944343",
"0.69170874",
"0.68070835",
"0.67787653",
"0.6748439",
"0.66368526",
"0.65848154",
"0.65574116",
"0.65244126",
"0.6446084",
"0.6437722",
"0.63899946",
"0.6349686",
"0.6348279",
"0.63395274",
"0.631963",
"0.63025... | 0.5739152 | 65 |
Clear space for item if the item occurs before the end of an existing list, move the existing items of same or later position down a space to make room for the item | def clear_for_new_position
end_of_list = fund_grant.fund_items.maximum( :position )
unless end_of_list && end_of_list < position
fund_grant.fund_items.where { |i| i.id != id }.
where { |i| i.position >= position }.update_all(
'fund_items.position = fund_items.position + 1' )
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_bottom\n # return unless in_list?\n acts_as_list_class.transaction do\n decrement_positions_on_lower_items if in_list?\n assume_bottom_position\n end\n end",
"def remove_from_list\n return unless in_list?\n decrement_positions_on_lower_items\n set_... | [
"0.6925803",
"0.68752515",
"0.6859408",
"0.6842613",
"0.6792464",
"0.6700894",
"0.65362537",
"0.651771",
"0.6501707",
"0.64661944",
"0.6461388",
"0.6411236",
"0.6375571",
"0.6323133",
"0.63218236",
"0.63218236",
"0.6228493",
"0.62059724",
"0.62028813",
"0.6200284",
"0.6184777... | 0.6730055 | 5 |
Set the title automatically TODO: flexible_budgets: should use requestor title in latest requestor edition editionsupplied title from first edition, if available node name if nothing else is available | def set_title
if fund_editions.first && fund_editions.first.title?
self.title ||= fund_editions.first.title
elsif node
self.title ||= node.name
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_title\n unless self.title\n if self.parent\n if last_untitled_page = self.parent.children.where(:title => /Untitled /i).asc(:title).last\n last_untitled_number = last_untitled_page.title.split(\" \").last.to_i\n self.title = \"Untitled #{last_untitled_number+1}\"\... | [
"0.75861806",
"0.69527143",
"0.6914972",
"0.68496585",
"0.6817401",
"0.6817041",
"0.6798695",
"0.6789915",
"0.6787211",
"0.6787211",
"0.6787211",
"0.6787211",
"0.6787211",
"0.6787211",
"0.6787211",
"0.67522573",
"0.6737825",
"0.6727337",
"0.6709191",
"0.670564",
"0.66787255",... | 0.82292074 | 0 |
rubocop:enable Metrics/AbcSize, Metrics/MethodLength rubocop:disable Metrics/AbcSize | def display_board(brd)
system 'clear' || system('cls')
puts "You're a #{PLAYER_MARKER}. Computer is #{COMPUTER_MARKER}."
puts ""
puts " | |"
puts " #{brd[1]} | #{brd[2]} | #{brd[3]}"
puts " | |"
puts "-----+-----+-----"
puts " | |"
puts " #{brd[4]} | #{brd[5]} | #{brd... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def schubert; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def offences_by; end",
"def custom; end",
"def custom; end",
"def strate... | [
"0.758622",
"0.6330317",
"0.62138844",
"0.62138844",
"0.6145009",
"0.6131304",
"0.61081856",
"0.61081856",
"0.61081856",
"0.61081856",
"0.5959351",
"0.5880678",
"0.5880678",
"0.5876503",
"0.5822341",
"0.58221203",
"0.58100563",
"0.5760032",
"0.5760032",
"0.57409763",
"0.57064... | 0.0 | -1 |
Given an array of integers, find the longest increasing subsequence General: Given an array of integers, find the longest increasing sunsequence from index 0 to N Question: How can the longest increasing subsequence from 0 to N be derived from sub problems? lis(n) == lis(n1) + 1 || lis(n1) if n == 0, then single elemen... | def length_of_lis(nums)
return 0 if nums.length < 1
lis(nums, nums.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def longest_increasing_subsequence(nums) len = nums.length\n return len if len < 2\n\n# After calculating lis for each index, take a max by 1 value equal to max, go backwards on lis array, and every time we find an element equal to max, we add that element to result and decrement max by 1. Hereby we'll get the i... | [
"0.83411896",
"0.8179752",
"0.8132787",
"0.79229605",
"0.7919517",
"0.78228766",
"0.738718",
"0.7293407",
"0.712803",
"0.7089715",
"0.70351833",
"0.6877302",
"0.68327355",
"0.6823029",
"0.67420554",
"0.6740293",
"0.6737215",
"0.67077035",
"0.66854197",
"0.66734177",
"0.665671... | 0.0 | -1 |
Returns 5 but should return 6 Without new_start | def length_of_lis(nums)
return 0 if nums.length < 1
lis(nums, nums.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_num\n return @start_num\n end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def started_at; end",
"def starting_position; end",
"def range_start; range.first; end",
... | [
"0.6498494",
"0.62276554",
"0.62276554",
"0.62276554",
"0.62276554",
"0.62276554",
"0.61685586",
"0.591233",
"0.585486",
"0.5792788",
"0.5788331",
"0.57797825",
"0.57797825",
"0.57797825",
"0.57086575",
"0.57086575",
"0.5706595",
"0.5689017",
"0.56293654",
"0.56140476",
"0.56... | 0.0 | -1 |
Returns 7 but should return 6 Solved with top down recursion | def length_of_lis(nums)
return 0 if nums.length < 1
lis(nums, nums.length - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recursive_solution\n\n end",
"def problem_76a\n num = 100\n solve = lambda do |a,off,max|\n n = 0\n while a[off] < max && (a.length-off) >= 2 \n a[off] += a.pop\n n += 1\n n += solve.call(a.dup,off+1,a[off]) if a.length - off > 1\n end\n n\n end\n puts 1 + solve.call([1] * n... | [
"0.74056697",
"0.68049955",
"0.6682945",
"0.65033454",
"0.64979064",
"0.64976966",
"0.64202046",
"0.6375029",
"0.63368994",
"0.6296057",
"0.62693423",
"0.6260209",
"0.6239373",
"0.62296873",
"0.6212325",
"0.61674386",
"0.61578196",
"0.61232597",
"0.60684466",
"0.60598695",
"0... | 0.0 | -1 |
def admin_user redirect_to(root_path) unless current_user.admin? end def author_user redirect_to(root_path) unless current_user.author? end | def authorized_for_roles(*args)
# From: http://stackoverflow.com/a/6076035/999973
# args.any? { |role_name| ROLES.include? role_name }
# ROLES = %w[admin moderator editor author banned] in user model
# calling it:
# before_filter(only: [:edit, :update, :destroy]) {|c| c.authorized_for_roles "admin"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_author_is_admin\n unless current_author_is_admin?\n redirect_to :root\n end \n end",
"def admin_user\n redirect_to(root_url) unless current_doctor.admin?\n end",
"def admin_user\n \t\tredirect_to(root_url) unless current_user.admin?\n \tend",
"... | [
"0.8698087",
"0.8196446",
"0.81855965",
"0.81782746",
"0.8167919",
"0.8162342",
"0.815617",
"0.81475824",
"0.81470525",
"0.81470525",
"0.81375223",
"0.8135391",
"0.8133054",
"0.8132356",
"0.8118663",
"0.81146836",
"0.81077284",
"0.8107158",
"0.8107158",
"0.8094437",
"0.809430... | 0.0 | -1 |
State transition tables end reduce 0 omitted | def _reduce_1(val, _values, result)
result = Form.new(val[1], val[2])
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transitions; end",
"def closure! \n cstart = new_state\n cend = new_state\n\n add_transition(cstart, cend, \"\")\n add_transition(cend, cstart, \"\")\n\n add_transition(cstart, @start, \"\")\n @final.keys.each { |key| add_transition(key, cend, \"\")}\n\n set_start(cstart)\n... | [
"0.64042956",
"0.6064393",
"0.60386634",
"0.6007729",
"0.5946686",
"0.59351325",
"0.59351325",
"0.5909589",
"0.58873314",
"0.58676314",
"0.58676314",
"0.57807076",
"0.5779571",
"0.5710219",
"0.56961817",
"0.5655912",
"0.55736065",
"0.55026084",
"0.54936284",
"0.5481873",
"0.5... | 0.0 | -1 |
reduce 4 omitted reduce 5 omitted reduce 6 omitted | def _reduce_7(val, _values, result)
result = Question.new(val[0], val[1], val[3])
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_612(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_555(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_13(val, _values, result); end",
"def _reduce_76(val, _values, result); en... | [
"0.6818555",
"0.6806433",
"0.67547685",
"0.67465675",
"0.67465675",
"0.6727161",
"0.6711653",
"0.67037594",
"0.66950166",
"0.6688207",
"0.6688207",
"0.66830105",
"0.6677798",
"0.66764134",
"0.6663124",
"0.6657237",
"0.66568774",
"0.6653745",
"0.6646821",
"0.6646255",
"0.66448... | 0.0 | -1 |
reduce 14 omitted reduce 15 omitted | def _reduce_16(val, _values, result)
result = IfElse.new(val[2], val[4], [])
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_13(val, _values, result); end",
"def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_608(val, _values, result)\n ... | [
"0.6916333",
"0.6750319",
"0.6737945",
"0.6720206",
"0.6710822",
"0.67082006",
"0.66855466",
"0.66711605",
"0.6669401",
"0.6669401",
"0.66661143",
"0.66630083",
"0.66630083",
"0.66547567",
"0.66547567",
"0.665443",
"0.66518587",
"0.6613117",
"0.6613117",
"0.6605229",
"0.65978... | 0.0 | -1 |
reduce 30 omitted reduce 31 omitted | def _reduce_32(val, _values, result)
result = Variable.new(val[0])
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_218(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n\n result\nend",
"def _reduce_600(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_240(val... | [
"0.6859167",
"0.6826351",
"0.6812044",
"0.68034565",
"0.68034565",
"0.67997366",
"0.67800254",
"0.6725342",
"0.6725342",
"0.6666657",
"0.66428095",
"0.6639294",
"0.6637859",
"0.6637859",
"0.66367567",
"0.6626914",
"0.6622855",
"0.6612226",
"0.66017354",
"0.6597918",
"0.659225... | 0.0 | -1 |
reduce 33 omitted reduce 34 omitted reduce 35 omitted | def _reduce_36(val, _values, result)
result = IntegerLiteral.new(val[0].to_i)
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_603(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_13(val, _values, result); end",
"def _reduce_612(val, _values, result)\n result = nil\n \n result\nend",
"def _reduce_239(val, _values, result)\n ... | [
"0.71805805",
"0.71482",
"0.7147014",
"0.71458936",
"0.71224475",
"0.711246",
"0.71013975",
"0.70917195",
"0.70836014",
"0.70818025",
"0.70716274",
"0.7069701",
"0.7069701",
"0.70634544",
"0.70634544",
"0.7061777",
"0.7053141",
"0.7046775",
"0.70428056",
"0.7042688",
"0.70415... | 0.0 | -1 |
Pass the user, model, and attributes to the Hyrax integration class to cause it to persist the work. returns [Boolean] true if the works saved, false if it failed | def update_work
actor_stack.update
rescue StandardError => e
message = "failed to update work #{@work.pid}, #{e.message}"
Rails.logger.error message
raise StandardError, message
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n create_or_update\n return true\n end",
"def save\n if valid?\n persist!\n true\n else\n false\n end\n end",
"def save\n\t\tif valid?\n\t\t\tpersist!\n\t\t\ttrue\n\t\telse\n\t\t\tfalse\n\t\tend\n\tend",
"def save\n valid? && create.succ... | [
"0.6704775",
"0.656983",
"0.6556548",
"0.64414346",
"0.6403705",
"0.63791716",
"0.6374523",
"0.63672054",
"0.6366797",
"0.63653654",
"0.63579756",
"0.63493365",
"0.6307142",
"0.6303115",
"0.6281325",
"0.6230885",
"0.618112",
"0.61641973",
"0.61586785",
"0.6157696",
"0.6146567... | 0.0 | -1 |
GET /quality_lot_dimensions GET /quality_lot_dimensions.json | def index
@quality_lot = QualityLot.find(params[:quality_lot_id]) if params[:quality_lot_id]
@quality_lot = QualityLot.first unless @quality_lot
if @quality_lot
@item_revision = @quality_lot.item_revision
@item = @item_revision.item
@quality_lot_dimensions = @quality_lot.quality_lot_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quality_lot_gauge_dimen... | [
"0.763097",
"0.73385185",
"0.705288",
"0.6992427",
"0.6798831",
"0.6643002",
"0.65645295",
"0.6487171",
"0.63755256",
"0.61849064",
"0.6166006",
"0.60581857",
"0.60032064",
"0.5988454",
"0.597907",
"0.59620553",
"0.59153765",
"0.5851881",
"0.5826852",
"0.5818153",
"0.58102256... | 0.6288466 | 9 |
GET /quality_lot_dimensions/1 GET /quality_lot_dimensions/1.json | def show
@quality_lot = QualityLot.find(params[:quality_lot_id])
@quality_lot_dimension = QualityLotDimension.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @quality_lot_dimension }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @quality_lot_gauge_dimen... | [
"0.7866159",
"0.7323249",
"0.72754633",
"0.678074",
"0.6677671",
"0.6532979",
"0.63966745",
"0.62658894",
"0.6260101",
"0.6233839",
"0.62229717",
"0.6154199",
"0.6148192",
"0.6123306",
"0.58745277",
"0.58683234",
"0.5849903",
"0.5834672",
"0.5832953",
"0.57633215",
"0.5655219... | 0.7542818 | 1 |
GET /quality_lot_dimensions/new GET /quality_lot_dimensions/new.json | def new
@quality_lot = QualityLot.find(params[:quality_lot_id])
@quality_lot_dimension = QualityLotDimension.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @quality_lot_dimension }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @quality_lot_gauge_dimension }\n en... | [
"0.82305825",
"0.74285114",
"0.7266256",
"0.7078049",
"0.6706061",
"0.6673668",
"0.66056544",
"0.65792596",
"0.64068013",
"0.63966006",
"0.6370285",
"0.63694465",
"0.6352887",
"0.63468724",
"0.6333016",
"0.62411",
"0.62346464",
"0.6212395",
"0.61858827",
"0.6182094",
"0.61729... | 0.8379747 | 0 |
POST /quality_lot_dimensions POST /quality_lot_dimensions.json | def create
@quality_lot = QualityLot.find(params[:quality_lot_id])
@quality_lot.process_quality_lot_dimensions(params)
redirect_to quality_lot_dimensions_path(quality_lot_id: @quality_lot.id), notice: 'Dimension analysis was successfully updated.'
# respond_to do |format|
# if @quality_lot_dimens... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @quality_lot_gauge_dimension }\n en... | [
"0.72270644",
"0.7086172",
"0.69018424",
"0.65324116",
"0.64410394",
"0.6355682",
"0.6264447",
"0.6222486",
"0.61100054",
"0.61070657",
"0.59373945",
"0.593205",
"0.5797282",
"0.5785218",
"0.57224166",
"0.5716649",
"0.56462324",
"0.56429994",
"0.548075",
"0.5437717",
"0.53985... | 0.7129375 | 1 |
PUT /quality_lot_dimensions/1 PUT /quality_lot_dimensions/1.json | def update
@quality_lot = QualityLot.find(params[:quality_lot_id])
@quality_lot_dimension = QualityLotDimension.find(params[:id])
respond_to do |format|
if params[:status]
@quality_lot_dimension.update_attributes(:lot_dimension_status => params[:status])
format.html { redirect_to qual... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n\n respond_to do |format|\n if @quality_lot_gauge_dimension.update_attributes(params[:quality_lot_gauge_dimension])... | [
"0.7536797",
"0.7000694",
"0.69945556",
"0.6856468",
"0.6850526",
"0.67950416",
"0.6779693",
"0.64692694",
"0.64550036",
"0.61088675",
"0.6104248",
"0.6089927",
"0.6043676",
"0.60094786",
"0.59892553",
"0.5933007",
"0.5794864",
"0.5745288",
"0.57134765",
"0.5678914",
"0.56643... | 0.7119435 | 1 |
DELETE /quality_lot_dimensions/1 DELETE /quality_lot_dimensions/1.json | def destroy
@quality_lot = QualityLot.find(params[:quality_lot_id])
@quality_lot_dimension = QualityLotDimension.find(params[:id])
@quality_lot_dimension.destroy
respond_to do |format|
format.html { redirect_to quality_lot_dimensions_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n @quality_lot_gauge_dimension.destroy\n\n respond_to do |format|\n format.html { redirect_to quality_lot_gauge_... | [
"0.7953087",
"0.7153633",
"0.69179016",
"0.6641285",
"0.66231316",
"0.66231316",
"0.659151",
"0.6584411",
"0.6528674",
"0.65099823",
"0.6478625",
"0.64655393",
"0.6426819",
"0.6349855",
"0.6338209",
"0.63315964",
"0.63118404",
"0.63049626",
"0.6298825",
"0.6282755",
"0.627464... | 0.797036 | 0 |
Returns the motion's text and organization ID. | def to_s
"#{text} in #{organization_id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def convert_project_lifecycle_text_to_id\n end",
"def convert_project_lifecycle_text_to_id\n end",
"def id\n return @doc.xpath('//mets:metsHdr/@ID').to_s\n end",
"def text_id\n \"#{name} (##{id})\"\n end",
"def org_id\n query('select id from Organization').first['Id']\n end",
"def l... | [
"0.57678056",
"0.57678056",
"0.56768745",
"0.5631916",
"0.56147546",
"0.5605972",
"0.5534939",
"0.54790026",
"0.54790026",
"0.54790026",
"0.54790026",
"0.54790026",
"0.5468812",
"0.54342246",
"0.54000205",
"0.53688383",
"0.536005",
"0.53408724",
"0.5333681",
"0.53187644",
"0.... | 0.54587674 | 13 |
Feed with arrays of elements or an array of arrays | def write(data)
raise CSVStream::InsufficientDataError unless data.is_a?(Array)
wrapper = data[0].is_a?(Array) ? data : [data]
wrapper.each {|r| write_row(r) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def double_array(array)\n # your code here\nend",
"def double_array(array)\n array + array\nend",
"def array_converter(*args)\n \nend",
"def converted_arrays; end",
"def mutliplied(array)\nend",
"def double_array(array)\n array.concat(array)\nend",
"def maybe_array(x)\n x.is_a?(Array) ? x ... | [
"0.6256712",
"0.6217894",
"0.6201681",
"0.61709726",
"0.6120129",
"0.6067496",
"0.5908904",
"0.59037846",
"0.58896476",
"0.58791673",
"0.58756363",
"0.585804",
"0.585804",
"0.585804",
"0.5843499",
"0.5818627",
"0.5818627",
"0.57995766",
"0.5791711",
"0.57841295",
"0.57841295"... | 0.0 | -1 |
We really just act as a simple wrapper to MimeMultipart; any hash passed to the constructor will just have all its keys executed as methods, with the value providing the arguments. | def initialize(part = nil, parent = nil)
@part = (part or MimeMultipart.new)
@parent = parent
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(params = {})\n @multipart_params = []\n push_params(params)\n end",
"def multipart; end",
"def initialize(*args, &block)\n @body = nil\n @body_raw = nil\n @separate_parts = false\n @text_part = nil\n @html_part = nil\n @errors = nil\n @header = nil... | [
"0.6513265",
"0.6253452",
"0.59814453",
"0.5774561",
"0.5648088",
"0.56059676",
"0.551833",
"0.55105144",
"0.54971707",
"0.5481614",
"0.54381675",
"0.5351936",
"0.53316957",
"0.5328809",
"0.5324354",
"0.5296389",
"0.52862567",
"0.5241019",
"0.5220914",
"0.5216543",
"0.5208724... | 0.6056284 | 2 |
Return an array of all the body parts we contain. | def body_parts
@part.getCount.times.map do |index|
part = @part.getBodyPart(index)
next(BodyPart.new(part, self)) \
unless @message.is_a?(javax.mail.Multipart)
Multipart.new(part, self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parts\n body.parts\n end",
"def each\n\t parts = body_parts.map { |p| \n\t\tp.multipart? ? p.body_parts : p }\n\t parts.flatten.compact.each { |p| yield(p) }\n\tend",
"def getBody\n body = \"\"\n @body.each { |part| body << part }\n body\n ensure\n @body.close... | [
"0.8467909",
"0.7086113",
"0.70332974",
"0.70114386",
"0.69979364",
"0.6873797",
"0.67206925",
"0.66673833",
"0.6449501",
"0.6436773",
"0.6422981",
"0.63793004",
"0.63691294",
"0.63613605",
"0.6353424",
"0.6326936",
"0.6322898",
"0.6316454",
"0.6267641",
"0.62663263",
"0.6253... | 0.7801687 | 1 |
Implement each so we can mixin Enumerable. Note that we go a little farther here, and iterate not only over all our body parts, but over any multiparts that we contain. | def each
parts = body_parts.map { |p|
p.multipart? ? p.body_parts : p }
parts.flatten.compact.each { |p| yield(p) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n body_parts = self.body.respond_to?(:each) ? self.body : [self.body]\n return body_parts.to_enum unless block_given?\n body_parts.each { |part| yield(part) }\n end",
"def each_body\n return enum_for(__method__) unless block_given?\n\n unless @message.body.parts.empty?\n ... | [
"0.8111117",
"0.72547966",
"0.7120561",
"0.7028146",
"0.6977434",
"0.6785194",
"0.6695813",
"0.66903794",
"0.6668575",
"0.6619129",
"0.661046",
"0.66077685",
"0.66065997",
"0.6517624",
"0.64752245",
"0.64598596",
"0.6413362",
"0.640923",
"0.6398528",
"0.6334554",
"0.63109654"... | 0.8467186 | 0 |
Return the first text/plain part that either we contain, or one of our subparts containes. | def text
find { |b| b.content_type == 'text/plain' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_main_body_text_part\n leaves = get_attachment_leaves\n \n # Find first part which is text/plain\n leaves.each do |p|\n if p.content_type == 'text/plain'\n return p\n end\n end\n\n # Otherwise first part which is any sort of text... | [
"0.7448058",
"0.686103",
"0.6430346",
"0.63679",
"0.63483596",
"0.5994547",
"0.58878225",
"0.5872928",
"0.5728889",
"0.56997514",
"0.5686194",
"0.5670221",
"0.56315744",
"0.5595898",
"0.5556531",
"0.55434483",
"0.553989",
"0.55378395",
"0.54846495",
"0.53583413",
"0.5352327",... | 0.608586 | 5 |
Return the first text/plain part that either we contain, or one of our subparts containes. | def html
find { |b| b.content_type == 'text/html' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_main_body_text_part\n leaves = get_attachment_leaves\n \n # Find first part which is text/plain\n leaves.each do |p|\n if p.content_type == 'text/plain'\n return p\n end\n end\n\n # Otherwise first part which is any sort of text... | [
"0.7448332",
"0.6861972",
"0.64305604",
"0.63674134",
"0.6347576",
"0.6086314",
"0.59950125",
"0.588592",
"0.58722234",
"0.5729238",
"0.56994164",
"0.5686181",
"0.5670716",
"0.5630335",
"0.5593379",
"0.5554867",
"0.55430835",
"0.55384415",
"0.5536382",
"0.54852784",
"0.535800... | 0.0 | -1 |
Return the object that we wrap. | def to_java
@part
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _wrapped_object\n @wrapped_object\n end",
"def wrap(object); end",
"def object\n __getobj__\n end",
"def object\n @object ||= build_object\n end",
"def real_object\n result = self\n while result.respond_to?(:__getobj__)\n result = result.__ge... | [
"0.7654869",
"0.7608781",
"0.73587066",
"0.73172367",
"0.72370434",
"0.7234966",
"0.7078202",
"0.70432204",
"0.70412517",
"0.7002412",
"0.69885",
"0.69431937",
"0.6934043",
"0.6814582",
"0.6789427",
"0.67307806",
"0.6598237",
"0.65845627",
"0.65560675",
"0.6550809",
"0.651117... | 0.0 | -1 |
Returns true if this is a multipart message. Which it is, kind of obviously. We use this to walk down the body part tree, and search for all multiparts, including those contained in other body parts. | def multipart?
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multipart?\n message.multipart?\n end",
"def multipart?\n has_content_type? ? !!(main_type =~ /^multipart$/i) : false\n end",
"def multipart?\n @multipart\n end",
"def multipart?\n @multipart\n end",
"def multipart?\n http.headers[\"content-type\"] =~ /^multipart/... | [
"0.82424015",
"0.8002223",
"0.79256123",
"0.79256123",
"0.7851281",
"0.77617556",
"0.7536597",
"0.73876053",
"0.7154713",
"0.70896345",
"0.68411595",
"0.65667903",
"0.6351556",
"0.62989664",
"0.6061745",
"0.6019447",
"0.5866134",
"0.58124024",
"0.58046645",
"0.57911825",
"0.5... | 0.7291185 | 8 |
Hand unknown method calls off to the Multpart that we're building. :nodoc: | def method_missing(name, *args, &block)
if(@part.respond_to?(name))
@part.send(name, *args, &block)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def method_missing(*rest) end",
"def method_missing(undefined_meth_yet,*args,&block)\n \"#{self.class.to_s} doesn't know how to perform :#{undefined_meth_yet}\"\n end",
"def methods() end",
"def method_missing(wh,*therest)\n # xxx internal methods must be protected at some point\n end",
"de... | [
"0.59536374",
"0.58546",
"0.58446425",
"0.5842382",
"0.5819541",
"0.581128",
"0.5805126",
"0.5790394",
"0.5738329",
"0.5738329",
"0.5720041",
"0.56623834",
"0.5662265",
"0.5660806",
"0.5647993",
"0.56258464",
"0.5607884",
"0.559651",
"0.5595326",
"0.55921197",
"0.55773056",
... | 0.6456871 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_run
@run = Run.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 |
Only allow a trusted parameter "white list" through. | def run_params
params.fetch(:run, {}).permit(:distance_in_meters, :time_in_seconds)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
extension_config do |config| config.gem 'someawesomegem config.after_initialize do run_something end end See your config/routes.rb file in this extension to define custom routes | def activate
Page.send :include, SiteTags
Page.class_eval do
def url_with_redirect
if self.redirect.blank?
url_without_redirect
else
if self.redirect =~ /^system_name:(.+)$/
Page.current_site.pages.find_by_system_name($1).try(:url)
els... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_routes; end",
"def external_routes; end",
"def after_initialize\n super\n extension_loader.activate_extensions # also calls initialize_views\n TrustyCms::Application.config.add_controller_paths(extension_loader.paths(:controller))\n TrustyCms::Application.config.add_eager_load_pa... | [
"0.68989867",
"0.6578558",
"0.61058104",
"0.59448814",
"0.5879361",
"0.58668154",
"0.577842",
"0.5656001",
"0.5628797",
"0.5614278",
"0.5596756",
"0.55758095",
"0.5575509",
"0.55584806",
"0.5542649",
"0.552976",
"0.552976",
"0.552976",
"0.552976",
"0.552976",
"0.552976",
"0... | 0.0 | -1 |
ex: Mapel.list() ex: Mapel.list('Orientation', true) pass false as second argument, if you want an unparsed result | def list(type = 'list', parse = true)
new.with_command("convert -list", type).run.to_list(parse)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_list; end",
"def parse_list; end",
"def list(*) end",
"def cmd_list argv\n setup argv\n type = @hash['type']\n response = @api.list(type)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n return response\n end... | [
"0.6124334",
"0.6124334",
"0.5998783",
"0.590723",
"0.589753",
"0.5897277",
"0.58849365",
"0.58849365",
"0.58849365",
"0.5762808",
"0.5762808",
"0.5762808",
"0.5762808",
"0.5762808",
"0.5566375",
"0.5549172",
"0.55454314",
"0.5543635",
"0.5530285",
"0.552749",
"0.54940456",
... | 0.56463623 | 14 |
Crops an image to specified dimensions. More information on ImageMagick's crop option: | def crop(*args)
with_command %(-crop "#{Geometry.new(*args).to_s(true)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_crop(image, crop, x, y, width, height)\n require 'RMagick'\n # load in the original image\n old_image = Magick::Image::read(self.send(image).path).first\n # crop it at the desired position\n new_image = old_image.crop(x.to_i, y.to_i, width.to_i, height.to_i, true)\n # scal... | [
"0.7882866",
"0.7752633",
"0.7614631",
"0.75192016",
"0.74880123",
"0.7345305",
"0.72107583",
"0.71403223",
"0.7089931",
"0.70726573",
"0.7040655",
"0.70216227",
"0.7017795",
"0.69386625",
"0.6933989",
"0.69147307",
"0.6871932",
"0.68109804",
"0.6801706",
"0.67706144",
"0.676... | 0.68849075 | 16 |
Sets the current gravity suggestion to given type. Values for type incule: NorthWest, North, NorthEast, West, Center, East, SouthWest, South, SouthEast Call `convert list gravity` to get a complete list of gravity settings available in your ImageMagick installation. More information on ImageMagick's gravity option: | def gravity(type = :center)
with_command "-gravity #{type}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gravity\n @gravity ||= {\n :new => Magick::NorthWestGravity,\n :n => Magick::NorthGravity,\n :ne => Magick::NorthEastGravity,\n :w => Magick::WestGravity,\n :c => Magick::CenterGravity,\n :e => Magick::EastGravity,\n :sw => Magick::SouthWestGravit... | [
"0.69430786",
"0.61274844",
"0.61191565",
"0.5768479",
"0.5713417",
"0.5590179",
"0.558481",
"0.5484391",
"0.52429533",
"0.51683575",
"0.5113136",
"0.5085801",
"0.50557095",
"0.497735",
"0.49571475",
"0.49391598",
"0.49391598",
"0.48276368",
"0.47938088",
"0.47643125",
"0.475... | 0.74809605 | 0 |
Grayscales an image More information on ImageMagick's type option: | def grayscale
with_command "-type Grayscale"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monochrome! \n\t\treturn @image = @image.quantize(2, Magick::GRAYColorspace) \n\tend",
"def grayscale?(input)\n # By testing the average saturation of the image we can guess if it's\n # grayscale (then the saturation is 0)\n # Source: http://www.imagemagick.org/discourse-server/viewtopic.php?t=19580... | [
"0.64873403",
"0.6396964",
"0.63619745",
"0.631291",
"0.6239603",
"0.62063074",
"0.61445946",
"0.60557264",
"0.60141814",
"0.59374493",
"0.5894452",
"0.58714396",
"0.5840886",
"0.58171266",
"0.58149695",
"0.57691634",
"0.5754812",
"0.5754812",
"0.57418954",
"0.5739813",
"0.56... | 0.72847635 | 0 |
Automatically rotates an image with EXIF Orientation. If the EXIF profile was previously stripped, orient will do nothing. More information on ImageMagick's autoorient option: | def orient
with_command "-auto-orient"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fix_exif_rotation\n manipulate! do |img|\n img.tap(&:auto_orient)\n end\n end",
"def auto_orient\n manipulate! do |image|\n o = image.get('exif-Orientation').to_i rescue nil\n o ||= image.get('exif-ifd0-Orientation').to_i rescue 1\n case o\n when 1\n ... | [
"0.8206351",
"0.8138618",
"0.80653",
"0.79041314",
"0.78959423",
"0.78953254",
"0.78772426",
"0.7578777",
"0.7578777",
"0.7578777",
"0.74567825",
"0.72823143",
"0.7246726",
"0.71714157",
"0.67969763",
"0.60846704",
"0.5969426",
"0.59193856",
"0.59041274",
"0.58472234",
"0.581... | 0.567981 | 22 |
Sets the quality level of the output image More information on ImageMagick's quality option: | def quality(level)
with_command "-quality #{level}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def quality(percent)\n manipulate! do |image|\n @_format_opts = { :quality => percent } if jpeg? || @_format=='jpeg'\n image\n end\n end",
"def quality(percentage)\n manipulate! do |img|\n img.write(current_path){ self.quality = percentage }\n img = yield(img) if blo... | [
"0.7396235",
"0.72684634",
"0.72193515",
"0.72193515",
"0.72193515",
"0.7164679",
"0.71531737",
"0.70526665",
"0.68784595",
"0.6876762",
"0.6765605",
"0.67562836",
"0.6739347",
"0.6729917",
"0.6728",
"0.6579835",
"0.65276515",
"0.6504431",
"0.6351739",
"0.6189953",
"0.6119216... | 0.7627964 | 0 |
Resets the virtual canvas metadata on the image. More information on ImageMagick's repage option: | def repage
with_command "+repage"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset\n @victory = false\n @win = false\n drawFromPixmap\n end",
"def facesvg_reset\n # Delete the cut path layout\n su_operation(RESET_LAYOUT) { profile().reset() }\n end",
"def reset_analyzer filename, dpi, result, upstream\n @raw_barcode = []\n @raw_marked_votes = []\n @filenam... | [
"0.57261693",
"0.5711067",
"0.56535584",
"0.55181575",
"0.53331935",
"0.5262935",
"0.5260882",
"0.525407",
"0.52429676",
"0.5228124",
"0.5109432",
"0.5102005",
"0.5100683",
"0.5075843",
"0.5075418",
"0.5068929",
"0.506546",
"0.5052952",
"0.5035975",
"0.5019512",
"0.50169617",... | 0.50805724 | 13 |
Rotates in degree an image. More information on ImageMagick's repage option: | def rotate(*args)
with_command %(-rotate "#{Geometry.new(*args)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_image(image)\n\nend",
"def rotate\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.rotate(90)\n img.write('public' + @photo.attachment_url)\n end",
"def rotate angle\n position = \"#{@placement[:s]}x#{@placement[:s]}+#{... | [
"0.76442593",
"0.7495484",
"0.7255284",
"0.6816631",
"0.674952",
"0.6710009",
"0.658619",
"0.65758514",
"0.65279466",
"0.6526519",
"0.6443855",
"0.6398452",
"0.6381135",
"0.636623",
"0.63539064",
"0.6328167",
"0.63150066",
"0.62684226",
"0.6186576",
"0.6106853",
"0.6074465",
... | 0.54292536 | 75 |
Resizes an image to given geometry args. More information on ImageMagick's resize option: | def resize(*args)
with_command %(-resize "#{Geometry.new(*args)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize!(*args)\n width, height = Geometry.new(*args).dimensions\n resize(\"#{width}x#{height}^\").crop(width, height).repage\n end",
"def resize(geometry)\n load_image.change_geometry(geometry) do |width, height, img|\n img.resize(width, height).to_blob\n end\n end",
"def cal... | [
"0.77620083",
"0.73484635",
"0.7286564",
"0.68454236",
"0.6842924",
"0.680071",
"0.66248906",
"0.6622546",
"0.66033185",
"0.6602279",
"0.6578353",
"0.655884",
"0.6542969",
"0.6410318",
"0.63997155",
"0.6379183",
"0.63751346",
"0.6348665",
"0.6328892",
"0.6314978",
"0.6303767"... | 0.8145896 | 0 |
Resizes and crops an image to dimensions specified in geometry args. Performs resize + crop + repage | def resize!(*args)
width, height = Geometry.new(*args).dimensions
resize("#{width}x#{height}^").crop(width, height).repage
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resize(geometry)\n load_image.change_geometry(geometry) do |width, height, img|\n img.resize(width, height).to_blob\n end\n end",
"def calc_resize(geometry) \n EasyImgUtils.calc_resize(info()[:geometry], geometry)\n end",
"def cropped_thumbnail(geometry)\n ow,oh = @original_width,@o... | [
"0.7203347",
"0.7129815",
"0.69046795",
"0.68353516",
"0.67901284",
"0.677786",
"0.6737917",
"0.6736323",
"0.6727196",
"0.6671293",
"0.65994245",
"0.65776896",
"0.65503955",
"0.644788",
"0.6426271",
"0.64255637",
"0.6349746",
"0.6341081",
"0.6319899",
"0.62874347",
"0.6270343... | 0.77157605 | 0 |
Scales an image to given geometry args, which is faster than resizing. More information on ImageMagick's scale option: | def scale(*args)
with_command %(-scale "#{Geometry.new(*args)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scaleimage **opts\n Vips::Image.scale self, **opts\n end",
"def resize!(*args)\n width, height = Geometry.new(*args).dimensions\n resize(\"#{width}x#{height}^\").crop(width, height).repage\n end",
"def scale(*args)\n r = Rect.new x, y, w, h\n r.resolution = r.resolution... | [
"0.7126979",
"0.6675131",
"0.66123146",
"0.6600342",
"0.6505771",
"0.64442384",
"0.6427452",
"0.62439567",
"0.62399864",
"0.622639",
"0.61640245",
"0.610299",
"0.6077654",
"0.60533935",
"0.59600455",
"0.5928978",
"0.5926956",
"0.5910849",
"0.587483",
"0.5863172",
"0.5828009",... | 0.7969744 | 0 |
Removes any profiles or comments from the image, including EXIF metadata. | def strip
with_command "-strip"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_exif_metadata\r\n manipulate! do |img|\r\n img.strip\r\n img = yield(img) if block_given?\r\n img\r\n end\r\n end",
"def remove_picture\n res = system(remove_picture_cmd(info.file))\n\n raise Aur::Exception::FailedOperation, \"strip #{info.file}\" unless res\n end",
... | [
"0.72541374",
"0.69353384",
"0.6867175",
"0.6264846",
"0.62648183",
"0.624263",
"0.61900455",
"0.61407655",
"0.609815",
"0.60701805",
"0.6008387",
"0.59263605",
"0.59250736",
"0.58490825",
"0.5832897",
"0.5806744",
"0.57722443",
"0.5760244",
"0.5707588",
"0.5696612",
"0.56798... | 0.0 | -1 |
Sets the output path. | def to(path)
with_command path.inspect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def output_path=(path)\n @output_path = path\n end",
"def set_output_dir(x)\n return self if @output_dir\n\n @output_dir = x\n @output_dir_abs = File.is_absolute?(@output_dir)\n if @project_dir\n @output_dir_relPath = File.rel_from_to_project(@project_dir, @output_dir)\... | [
"0.8578433",
"0.75993156",
"0.75934875",
"0.7235826",
"0.7085552",
"0.6974304",
"0.69532275",
"0.6905064",
"0.6801481",
"0.67647386",
"0.6670535",
"0.6626863",
"0.6599668",
"0.65467817",
"0.65285814",
"0.6509667",
"0.6433509",
"0.64184576",
"0.6341023",
"0.63292426",
"0.62816... | 0.0 | -1 |
Returns a hash of image informations | def to_info_hash
return {} if @output.empty?
meta = @output.split(" ")
# Count backwards as an image's path may contain a space
{
path: meta[0..-9].join(" "),
format: meta[-8],
dimensions: meta[-7].split("x").map(&:to_i),
depth: meta... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def image_hash; end",
"def hash\n @real.hash ^ @image.hash\n end",
"def digest\n image.ident\n end",
"def image_hash\n @image_hash ||= begin\n image_meta = page[\"image\"]\n\n case image_meta\n when Hash\n { \"path\" => nil }.merge!(image_meta)\n ... | [
"0.82882744",
"0.7758575",
"0.74094856",
"0.6960077",
"0.6960077",
"0.68426937",
"0.6841768",
"0.68366253",
"0.6788887",
"0.6616592",
"0.6616592",
"0.6545267",
"0.6545267",
"0.6545267",
"0.6545267",
"0.6545267",
"0.6545267",
"0.6545267",
"0.6509699",
"0.6466182",
"0.64358026"... | 0.6230615 | 41 |
Converts EXIF data into a hash of values. | def to_exif_hash
return {} if @output.empty?
meta = @output.scan(/exif:([^=]+)=([^\n]+)/)
Hash[meta]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exif_data\n @exif_data ||= Hash.new.tap do |data|\n begin\n if (timestamp = (image.get_exif_by_entry('DateTime').first.last || image.get_exif_by_entry('DateTimeOriginal').first.last))\n # Replace colons and forward slashes in the first (date) portion of the strin... | [
"0.76112944",
"0.7257757",
"0.69320154",
"0.6670386",
"0.6247826",
"0.6222548",
"0.6123986",
"0.60499275",
"0.59585917",
"0.5901919",
"0.58878756",
"0.58878756",
"0.58518845",
"0.5815606",
"0.57294005",
"0.5726302",
"0.57071453",
"0.570217",
"0.56966054",
"0.5636725",
"0.5595... | 0.73122776 | 1 |
verify that processing the minimal string version works | def test_new_creates_something
@response = MnemeAPIResponse.new(@@empty_response)
refute_nil @response, "get object"
refute_nil @@testFileDir, "locate test file directory"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend",
"def supports_standard_conforming_strings?\n true\n end",
"def test_canonical\n verify(\n 'bb7a81900001041200000001... | [
"0.68228614",
"0.6708201",
"0.6568103",
"0.6506539",
"0.64677674",
"0.6465657",
"0.6426164",
"0.64235574",
"0.63803345",
"0.63246894",
"0.6309137",
"0.62609226",
"0.62609226",
"0.62541896",
"0.623609",
"0.6234594",
"0.6212738",
"0.61876595",
"0.6160443",
"0.61598825",
"0.6153... | 0.0 | -1 |
verify can read json from a file. | def test_get_mneme_json_data_todolms
file_name = "studenta"
file_name = IO.read("#{@@testFileDir}/todolms/mneme/#{file_name}.json")
refute_nil file_name, "find test file"
jsonA = JSON.parse(file_name)
refute_nil jsonA, "check that file contents are understood as json"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_json(filename)\n begin\n File.open(filename, \"r\" ) do |f|\n JSON.load(f)\n end\n rescue Errno::ENOENT, TypeError => e\n puts \"You must supply a valid filename: #{e.message}\"\n exit\n end\nend",
"def load_json(filename); end",
"def read_from_json\n JSON.parse File.new(@filepa... | [
"0.70662004",
"0.6966004",
"0.6962796",
"0.689399",
"0.6817242",
"0.6800524",
"0.67177147",
"0.6701635",
"0.6635728",
"0.66076106",
"0.6591531",
"0.6538809",
"0.6457666",
"0.6455933",
"0.64201134",
"0.64107597",
"0.64060915",
"0.63853085",
"0.63795406",
"0.6375658",
"0.636745... | 0.6644474 | 8 |
FILTERING filtering check published has been published | def test_filter_mneme_assignment_published_and_open
assign_hash = {
'published' => true,
'openDate' => 0,
'closeDate' => @mock_today_epoch
}
r = MnemeAPIResponse.filter_out_irrelevant_assignments(assign_hash, 0)
refute_nil r, "accepted published open assignment"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter_publications(collection=Publication)\n query = publication_query(collection)\n query.apply_where\n end",
"def published_or_not\n self.published = (self.published_at <= Time.now and self.unpublished_at >= Time.now) ? 1 : 0\n end",
"def get_feed_filters\n filters = self.filters.to_h.reje... | [
"0.6846517",
"0.6781937",
"0.67088485",
"0.6588893",
"0.65465266",
"0.6518676",
"0.65012753",
"0.6493447",
"0.6475007",
"0.6475007",
"0.64733696",
"0.6439079",
"0.6435736",
"0.6423431",
"0.64177054",
"0.6392496",
"0.634781",
"0.63470864",
"0.63470864",
"0.63470864",
"0.634708... | 0.0 | -1 |
filtering check open date | def test_filter_mneme_assignment_open_in_past
assign_hash = {
'published' => true,
'openDate' => @mock_today_epoch - 1000,
'closeDate' => @mock_today_epoch
}
r = MnemeAPIResponse.filter_out_irrelevant_assignments(assign_hash, @mock_today_epoch)
refute_nil r, "keep open date in pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n return start_date <= Time.now.to_date && end_date >= Time.now.to_date\n end",
"def open_entry?\n opened_at <= DateTime.now.to_date && closed_at >= DateTime.now.to_date\n end",
"def trucks_open_today\n trucks = self.class.get_truck_data\n date = self.class.get_time\n\n trucks_tod... | [
"0.6105158",
"0.6064726",
"0.6034221",
"0.5994401",
"0.59916866",
"0.59739727",
"0.5913719",
"0.58677316",
"0.58636796",
"0.58556265",
"0.58326393",
"0.5790065",
"0.57663715",
"0.5745732",
"0.5716099",
"0.5701238",
"0.56816596",
"0.56470156",
"0.56453454",
"0.5618221",
"0.561... | 0.58909 | 7 |
filtering check close date | def test_filter_mneme_assignment_close_date_future
assign_hash = {
'published' => true,
'openDate' => 0,
'closeDate' => @mock_today_epoch*2
}
r = MnemeAPIResponse.filter_out_irrelevant_assignments(assign_hash, 0)
logger.debug "#{__method__}: #{__LINE__}: filter mneme: r "+r.ins... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_date(event)\n ((event.start_date-Time.now)< 259146.01469397545)\n end",
"def closing_stock\n closing_stock_on_date(Time.zone.now.to_date, nil)\n end",
"def on_sale\n all.select {|event| (event.starts..event.ends) === (@date_for_test || Date.today)}\n end",
"def out_of_date\n ... | [
"0.6602783",
"0.61347187",
"0.60008633",
"0.595625",
"0.5942803",
"0.5905435",
"0.58782655",
"0.58463866",
"0.5765143",
"0.57302064",
"0.57133955",
"0.56976885",
"0.5640427",
"0.5559634",
"0.55535036",
"0.55500335",
"0.5537729",
"0.55266476",
"0.55073684",
"0.54875356",
"0.54... | 0.6082064 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.