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 |
|---|---|---|---|---|---|---|
Check features accessability by user roles layout = false | def check_features
case params[:action]
when "index"
current_features.include?('employee_index') ? true : invalid_features
when "export"
current_features.include?('employee_export') ? true : invalid_features
when "new"
current_features.include?('employee_new') ? true : invalid_features
when "edit"
current_features.include?('employee_edit') ? true : invalid_features
when "delete_multiple"
current_features.include?('employee_delete') ? true : invalid_features
when "show"
current_features.include?('employee_detail') ? true : invalid_features
when "multiple_user"
current_features.include?('employee_user') ? true : invalid_features
# Mutasi
when "mutasi"
current_features.include?('mutation_index') ? true : invalid_features
# Formasi
when "formasi"
current_features.include?('formation_index') ? true : invalid_features
# Status
when "status"
current_features.include?('status_index') ? true : invalid_features
end
# return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index?\n true\n # (user.has_role? :admin) #|| user.has_role?(:manager, user.current_carpool)\n end",
"def user_permissions\n if user_signed_in? && (current_user.is_logistics? || current_user.is_clerical? || current_user.is_vendor? || current_user.is_customer?)\n authorize! :edit, Element\n ... | [
"0.642603",
"0.6305384",
"0.6298318",
"0.6273126",
"0.627094",
"0.62016237",
"0.61997676",
"0.617463",
"0.6156184",
"0.6156184",
"0.6131549",
"0.6123154",
"0.6123154",
"0.6123154",
"0.6106814",
"0.61007965",
"0.6100072",
"0.6097083",
"0.6087729",
"0.6082595",
"0.607315",
"0... | 0.5768533 | 82 |
GET /concours/1 GET /concours/1.json | def show
@concour = Concour.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @concour }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: ... | [
"0.71807873",
"0.7075411",
"0.6916728",
"0.68180037",
"0.6766265",
"0.6689935",
"0.66793555",
"0.6613579",
"0.66061854",
"0.6552564",
"0.6549525",
"0.65319645",
"0.65319645",
"0.65094155",
"0.6501679",
"0.64778686",
"0.6463269",
"0.64346296",
"0.6431546",
"0.6428482",
"0.6364... | 0.7657464 | 0 |
GET /concours/new GET /concours/new.json | def new
@concour = Concour.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @concour }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @cour... | [
"0.7918491",
"0.7762175",
"0.76122934",
"0.754688",
"0.754688",
"0.7362016",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.73605585",
"0.7318002",
"0.7312092",
"0.7298482",
"0.72905046",
"0.728... | 0.8288533 | 0 |
POST /concours POST /concours.json | def create
@concour = Concour.new(params[:concour])
respond_to do |format|
if @concour.save
format.html { redirect_to @concour, notice: 'Concour was successfully created.' }
format.json { render json: @concour, status: :created, location: @concour }
else
format.html { render action: "new" }
format.json { render json: @concour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @court = Court.new(params[:court])\n\n respond_to do |format|\n if @court.save\n format.html { redirect_to @court, notice: 'Court was successfully created.' }\n format.json { render json: @court, status: :created, location: @court }\n else\n format.html { render ac... | [
"0.6688883",
"0.6647614",
"0.66131425",
"0.66131425",
"0.66074276",
"0.65594465",
"0.6469018",
"0.63950187",
"0.63767606",
"0.6312913",
"0.62881964",
"0.6249809",
"0.6102423",
"0.60316855",
"0.6008786",
"0.6007588",
"0.6005086",
"0.5997847",
"0.59795296",
"0.59758896",
"0.597... | 0.74469656 | 0 |
PUT /concours/1 PUT /concours/1.json | def update
@concour = Concour.find(params[:id])
respond_to do |format|
if @concour.update_attributes(params[:concour])
format.html { redirect_to @concour, notice: 'Concour was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @concour.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @court = Court.find(params[:id])\n\n respond_to do |format|\n if @court.update_attributes(params[:court])\n format.html { redirect_to @court, notice: 'Court was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit... | [
"0.6594773",
"0.64037323",
"0.6298576",
"0.6279237",
"0.62510943",
"0.6233729",
"0.62025833",
"0.61926514",
"0.61856854",
"0.61856854",
"0.61680025",
"0.61680025",
"0.6099019",
"0.6093475",
"0.60795635",
"0.60318255",
"0.6024753",
"0.60220796",
"0.59922475",
"0.5985191",
"0.5... | 0.71004486 | 0 |
DELETE /concours/1 DELETE /concours/1.json | def destroy
@concour = Concour.find(params[:id])
@concour.destroy
respond_to do |format|
format.html { redirect_to concours_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @court = Court.find(params[:id])\n @court.destroy\n\n respond_to do |format|\n format.html { redirect_to courts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concert.destroy\n respond_to do |format|\n format.html { redirect_to concerts_url,... | [
"0.70701784",
"0.7001888",
"0.7001888",
"0.7001888",
"0.6993278",
"0.69478506",
"0.6885034",
"0.6873558",
"0.68693256",
"0.68619126",
"0.68572754",
"0.6854256",
"0.68505245",
"0.6845161",
"0.68385065",
"0.6827538",
"0.6826371",
"0.68067914",
"0.68036056",
"0.6781018",
"0.6772... | 0.757922 | 0 |
def say_hello p "hello" say_hello end say_hello prints "hello" forever | def count_down(num)
if num == 0
p "Houston, we have lift-off!"
return;
end
p num
count_down(num - 1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_hello\n p \"hello\"\n # say_hello # an infinite loop\nend",
"def sayHi\n\t\tputs(greet)\n\tend",
"def say_hello(n)\n print \"hello \", n,\"\\n\"\nend",
"def say_hello\n puts \"HELLOOOOO!\"\nend",
"def hello\n puts \"Hello Dude!!!\"\n puts \"Hellod Douchebag!!!\"\nend",
"def say_hi\n\t\tputs... | [
"0.84866554",
"0.73637044",
"0.7292278",
"0.7284294",
"0.7266848",
"0.7251726",
"0.7198678",
"0.7188082",
"0.71665245",
"0.7141237",
"0.71301705",
"0.71095914",
"0.7106025",
"0.7090013",
"0.7074385",
"0.7055364",
"0.70477086",
"0.70343536",
"0.7033373",
"0.7029945",
"0.702801... | 0.0 | -1 |
Is this integer value a valid 32 bit signed integer? | def int32?
(MIN_SIGNED_32BIT <= self) && (self <= MAX_SIGNED_32BIT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def uint32?\n (MIN_UNSIGNED_32BIT <= self) && (self <= MAX_UNSIGNED_32BIT)\n end",
"def make_signed_int32(long); end",
"def bson_int32?\n (MIN_32BIT <= self) && (self <= MAX_32BIT)\n end",
"def i32s\n little? ? BinUtils.get_sint32_le(read(4)) : BinUtils.get_sint32_be(read(4))\n en... | [
"0.7358563",
"0.7236617",
"0.7082234",
"0.6556137",
"0.6499132",
"0.6485536",
"0.6472043",
"0.64274263",
"0.6388527",
"0.6367528",
"0.63161117",
"0.63049644",
"0.6280468",
"0.6261898",
"0.6192608",
"0.61502296",
"0.61360836",
"0.61007744",
"0.6090408",
"0.6032135",
"0.6015282... | 0.8058801 | 0 |
Is this integer value a valid 64 bit signed integer? | def int64?
(MIN_SIGNED_64BIT <= self) && (self <= MAX_SIGNED_64BIT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int64?\n type == INT64_TYPE\n end",
"def int64()\n # Read an unsigned value, then convert it to signed\n val = _uint64(\"int64\")\n\n val >= 2**63 ? -(2**64 - val): val\n end",
"def uint64?\n (MIN_UNSIGNED_64BIT <= self) && (self <= MAX_UNSIGNED_64... | [
"0.7495598",
"0.7297541",
"0.7025222",
"0.6950902",
"0.6452748",
"0.64381224",
"0.63993627",
"0.6245837",
"0.62232023",
"0.6216235",
"0.61528236",
"0.61336195",
"0.6102449",
"0.60978615",
"0.60975814",
"0.6079657",
"0.60220236",
"0.5977392",
"0.5957211",
"0.59520966",
"0.5914... | 0.7689883 | 0 |
Is this integer value a valid 32 bit unsigned integer? | def uint32?
(MIN_UNSIGNED_32BIT <= self) && (self <= MAX_UNSIGNED_32BIT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int32?\n (MIN_SIGNED_32BIT <= self) && (self <= MAX_SIGNED_32BIT)\n end",
"def uint32(i)\n i & 0xffffffff\n end",
"def i32u\n little? ? BinUtils.get_int32_le(read(4)) : BinUtils.get_int32_be(read(4))\n end",
"def uint32()\n _uint32(\"uint32\")\n end",
"def bson... | [
"0.72238696",
"0.7192215",
"0.69543743",
"0.67717844",
"0.67337346",
"0.66752833",
"0.6388936",
"0.63395095",
"0.62827027",
"0.62648374",
"0.62409455",
"0.62301797",
"0.6184744",
"0.6172127",
"0.61684114",
"0.6155822",
"0.61524314",
"0.609798",
"0.60684294",
"0.6004339",
"0.5... | 0.7953523 | 0 |
Is this integer value a valid 64 bit unsigned integer? | def uint64?
(MIN_UNSIGNED_64BIT <= self) && (self <= MAX_UNSIGNED_64BIT)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def int64?\n type == INT64_TYPE\n end",
"def int64()\n # Read an unsigned value, then convert it to signed\n val = _uint64(\"int64\")\n\n val >= 2**63 ? -(2**64 - val): val\n end",
"def int64?\n (MIN_SIGNED_64BIT <= self) && (self <= MAX_SIGNED_64BIT)\... | [
"0.700607",
"0.675361",
"0.6707469",
"0.6688625",
"0.66687846",
"0.65810853",
"0.65450466",
"0.64542896",
"0.63654447",
"0.63028896",
"0.62417716",
"0.61540365",
"0.6082775",
"0.6064239",
"0.59975636",
"0.59330785",
"0.5922335",
"0.5916456",
"0.58990586",
"0.5895661",
"0.5869... | 0.7779567 | 0 |
To keep the client light and remove the need for Javascript response time tracking is done on the server. Here a time is stored in the session, on vote the time is diffed and reset. Time is sent in milliseconds. | def get_response_time #:doc:
ret = session[:prompt_time].nil? ? 0 : (1000 * (Time.now - session[:prompt_time])).round
session[:prompt_time] = nil
ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @votecomment = Votecomment.new(params[:votecomment])\n @votecomment.user_id = session[:user_id]\n if @votecomment.save\n @votecomment.updatetime(@votecomment.comment_id)\n redirect_to(posts_path)\n else\n flash[:notice] = \"Error in creating vote: #{@votecomment.errors}\"\... | [
"0.6224539",
"0.602139",
"0.60011965",
"0.5969557",
"0.5912558",
"0.5874181",
"0.5847267",
"0.5843033",
"0.5785251",
"0.57505137",
"0.57474667",
"0.573364",
"0.569692",
"0.56887",
"0.56788933",
"0.5664307",
"0.56360626",
"0.5614712",
"0.5606045",
"0.5602698",
"0.55849504",
... | 0.66709113 | 0 |
Only allow a trusted parameter "white list" through. | def result_params
params.require(:result).permit(:game_id, :name, :organisation, :correct_count, :score,
answers: [:question_id, :answer])
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.71217275",
"0.7052942",
"0.6947555",
"0.6903013",
"0.6735074",
"0.67167085",
"0.6687677",
"0.66765445",
"0.66602796",
"0.65548825",
"0.6524274",
"0.6455697",
"0.6451343",
"0.645123",
"0.64465624",
"0.6433475",
"0.64118403",
"0.64118403",
"0.6390524",
"0.6378871",
"0.637887... | 0.0 | -1 |
for displaying the comments of a post | def show
@comment = @post.comments.find_by(id: params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_comments_for_post(comments)\n \n html = %()\n unless comments.empty?\n html << content_tag(:h3, \"<br /> Comentários Relacionadas : #{comments.size}<hr /><br/>\".html_safe) \n comments.each { |comment| html << render(:partial => '/admin/comments/comment', :locals => {... | [
"0.7998724",
"0.77634263",
"0.7752904",
"0.7687926",
"0.7678073",
"0.76161796",
"0.7592467",
"0.7527742",
"0.7451808",
"0.7357522",
"0.7347524",
"0.7344895",
"0.7344895",
"0.73320466",
"0.73275876",
"0.7312083",
"0.72905576",
"0.7276323",
"0.72498125",
"0.7186844",
"0.7177014... | 0.7205901 | 19 |
to display the list of users who liked the comment | def liked_by
comment = Comment.includes(:liked_by).find_by(id: params[:id])
@users = comment.has_been_liked_by
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def like\n @comment.liked_by current_user\n end",
"def get_like(comment)\n like = comment.likes.select { |l| l.user_id == current_user.id }\n return like\n end",
"def likers\n likes.map do |like|\n like.user\n end\n end",
"def display_like_stats(comment)\n comment_likes = comment.... | [
"0.76295006",
"0.75965613",
"0.7533139",
"0.7465058",
"0.716386",
"0.7148296",
"0.7099601",
"0.69832945",
"0.69354105",
"0.6906591",
"0.6854396",
"0.6852271",
"0.68384063",
"0.6741834",
"0.6724173",
"0.6702068",
"0.66684157",
"0.66658396",
"0.6637175",
"0.660848",
"0.659854",... | 0.7824497 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_would_you_rather
@would_you_rather = WouldYouRather.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def would_you_rather_params
params.require(:would_you_rather).permit(:question)
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.71217275",
"0.7052942",
"0.6947555",
"0.6903013",
"0.6735074",
"0.67167085",
"0.6687677",
"0.66765445",
"0.66602796",
"0.65548825",
"0.6524274",
"0.6455697",
"0.6451343",
"0.645123",
"0.64465624",
"0.6433475",
"0.64118403",
"0.64118403",
"0.6390524",
"0.6378871",
"0.637887... | 0.0 | -1 |
put a new member into the hat | def put(firstName, lastName, email)
member = Member.new(firstName, lastName, email)
@members << member
@pool << member
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_member_to_card\n @trello.add_commander_to_card(find_member, @card)\n end",
"def add_member( member )\n @members[member] = Person.new ( member )\n @members\n end",
"def do_add_team_member(a_team_member)\n @team_member = a_team_member\n end",
"def add username\n @members.add u... | [
"0.6712805",
"0.65267956",
"0.63187975",
"0.6263807",
"0.6241355",
"0.6086643",
"0.60500264",
"0.6026085",
"0.6020568",
"0.60176325",
"0.5967929",
"0.59628195",
"0.5926653",
"0.5901445",
"0.5887688",
"0.5867766",
"0.58627176",
"0.5860495",
"0.58309615",
"0.5818207",
"0.581028... | 0.6496527 | 2 |
match each Secret Santa to a person | def match
@members.each do |santa|
santa.minion = draw(santa)
notify(santa)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter(santa)\n @pool.select do |member|\n member.lastName != santa.lastName\n end\n end",
"def assign_santa\n\t\t#get random santa from available valid santa pool\n\t\trandom_santa = User.available_possible_santas(self).order(\"RANDOM()\").limit(1).first\n\t\t\n\t\tif random_santa\n\t\t\tself.up... | [
"0.6459273",
"0.63049316",
"0.6261442",
"0.6260064",
"0.62014866",
"0.61589164",
"0.6155087",
"0.6150181",
"0.6090249",
"0.6025892",
"0.5946739",
"0.5930815",
"0.5920387",
"0.58723044",
"0.58040184",
"0.5799511",
"0.57535386",
"0.57258403",
"0.5718162",
"0.568548",
"0.5673043... | 0.6432627 | 1 |
draw a person out of the hat for a Secret Santa | def draw(santa)
validPool = filter(santa)
person = validPool.at(rand(validPool.size))
@pool.delete(person)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n fight( enemy, 0 )\n end",
"def %( enemy )\n lettuce = rand( charisma )\n puts \"[Healthy lettuce gives you #{ lettuce } life points!!]\"\n @life += lettuce\n ... | [
"0.61943525",
"0.61943525",
"0.6167458",
"0.61021537",
"0.609241",
"0.6025226",
"0.5765957",
"0.57638174",
"0.57465523",
"0.5743713",
"0.57428813",
"0.574102",
"0.5730572",
"0.5725971",
"0.5712614",
"0.5709916",
"0.5703448",
"0.5695207",
"0.5630953",
"0.5629384",
"0.5623099",... | 0.6469976 | 0 |
filter out people who're in the same family as Secret Santa | def filter(santa)
@pool.select do |member|
member.lastName != santa.lastName
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def family_name_matches\n filtered_matches(ignore: [:first_name], partial_or_perfect: [:family_name], perfect: [:street, :city])\n end",
"def get_family_members (people, family)\n people.select { |key,person| person.family == family }\nend",
"def fellow_fans\n teams = self.teams\n users ... | [
"0.6672141",
"0.6463311",
"0.6111642",
"0.5848844",
"0.581016",
"0.57752126",
"0.5721854",
"0.5671581",
"0.56469053",
"0.5581386",
"0.5554022",
"0.55109495",
"0.54972637",
"0.5490621",
"0.5488094",
"0.5467268",
"0.54503393",
"0.54219586",
"0.53799707",
"0.536798",
"0.5353424"... | 0.7064711 | 0 |
notify each Secret Santa who they'll be watching over | def notify(santa)
if santa.minion != nil
msg = "#{santa.firstName} #{santa.lastName} is watching over " +
"#{santa.minion.firstName} #{santa.minion.lastName}"
else
msg = "#{santa.firstName} #{santa.lastName} is watching over nobody"
end
puts msg
#Net::SMTP.start('smtp.example.com', 25) do |smtp|
# smtp.send_message(msg, 'hat@magic.com', santa.email)
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match\n @members.each do |santa|\n santa.minion = draw(santa)\n notify(santa)\n end\n end",
"def notify\n {\n }\n end",
"def notify\n {\n }\n end",
"def notify\n notify_unmentioned_reviewers\n notify_mentioned_event_staff if mention... | [
"0.66695106",
"0.61196196",
"0.61196196",
"0.61189896",
"0.60920143",
"0.5972072",
"0.5942328",
"0.57843494",
"0.5655688",
"0.5628217",
"0.5599179",
"0.5592104",
"0.55783176",
"0.5575483",
"0.5563071",
"0.5560765",
"0.5560765",
"0.5560765",
"0.5554016",
"0.55339855",
"0.55233... | 0.6538972 | 1 |
GET /professors/1 GET /professors/1.xml | def show
@professor = Professor.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @professor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @frequencia_profissao = Frequencia::Profissao.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb.erb\n format.xml { render :xml => @frequencia_profissao }\n end\n end",
"def show\n @proposed_person = ProposedPerson.find(params[:id])\n\n respond_to do ... | [
"0.6486881",
"0.64469403",
"0.6414666",
"0.6395942",
"0.6374866",
"0.6294542",
"0.6272644",
"0.62046546",
"0.613767",
"0.61162406",
"0.60848504",
"0.60785633",
"0.6036924",
"0.6036924",
"0.60158485",
"0.5985567",
"0.5973978",
"0.5937421",
"0.5933659",
"0.59215283",
"0.5888876... | 0.62610793 | 7 |
GET /professors/new GET /professors/new.xml | def new
@professor = Professor.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @professor }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @proposed_person = ProposedPerson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @proposed_person }\n end\n end",
"def new\n @profesor = Profesor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { r... | [
"0.70607007",
"0.68752885",
"0.68752885",
"0.68752885",
"0.6860588",
"0.6844627",
"0.68416184",
"0.6828833",
"0.6825818",
"0.6825818",
"0.6821703",
"0.67962056",
"0.6674551",
"0.6674016",
"0.6649827",
"0.6613043",
"0.6587647",
"0.65781355",
"0.65756774",
"0.6555647",
"0.65510... | 0.67478454 | 14 |
POST /professors POST /professors.xml | def create
@professor = Professor.new(params[:professor])
respond_to do |format|
if @professor.save
format.html { redirect_to(@professor, :notice => 'Professor was successfully created.') }
format.xml { render :xml => @professor, :status => :created, :location => @professor }
else
format.html { render :action => "new" }
format.xml { render :xml => @professor.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @frequencia_profissao = Frequencia::Profissao.new(params[:frequencia_profissao])\n\n respond_to do |format|\n if @frequencia_profissao.save\n format.html { redirect_to(@frequencia_profissao, :notice => 'Profissão salva com sucesso.') }\n format.xml { render :xml => @frequenci... | [
"0.59974116",
"0.58256876",
"0.57411873",
"0.57411873",
"0.560098",
"0.5565386",
"0.5564214",
"0.5514703",
"0.5506302",
"0.54801106",
"0.5448469",
"0.54350686",
"0.54191005",
"0.5397025",
"0.5388464",
"0.53825736",
"0.53536534",
"0.5352687",
"0.53472346",
"0.5342211",
"0.5338... | 0.5656584 | 4 |
PUT /professors/1 PUT /professors/1.xml | def update
@professor = Professor.find(params[:id])
respond_to do |format|
if @professor.update_attributes(params[:professor])
format.html { redirect_to(@professor, :notice => 'Professor was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @professor.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @proposed_person = ProposedPerson.find(params[:id])\n\n respond_to do |format|\n if @proposed_person.update_attributes(params[:proposed_person])\n flash[:notice] = 'ProposedPerson was successfully updated.'\n format.html { redirect_to(@proposed_person) }\n format.xml {... | [
"0.628332",
"0.60882986",
"0.59588605",
"0.59563553",
"0.5955882",
"0.59225935",
"0.59016985",
"0.5879083",
"0.58092517",
"0.580886",
"0.5807298",
"0.5795611",
"0.5776183",
"0.57759094",
"0.5768094",
"0.57675266",
"0.5742153",
"0.57360023",
"0.56766725",
"0.56764054",
"0.5660... | 0.6004265 | 2 |
DELETE /professors/1 DELETE /professors/1.xml | def destroy
@professor = Professor.find(params[:id])
@professor.destroy
respond_to do |format|
format.html { redirect_to(professors_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @ppos_prerequisite = PposPrerequisite.find(params[:id])\n @ppos_prerequisite.destroy\n\n respond_to do |format|\n format.html { redirect_to(ppos_prerequisites_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @proposed_person = ProposedPerson.find(params[:id])... | [
"0.6690976",
"0.66050154",
"0.65769136",
"0.65343285",
"0.64907455",
"0.64907455",
"0.6429609",
"0.64163285",
"0.6383639",
"0.637876",
"0.6376715",
"0.6348778",
"0.63463384",
"0.63419557",
"0.6331501",
"0.6288606",
"0.62862325",
"0.6282301",
"0.6266203",
"0.6227072",
"0.62207... | 0.6491184 | 4 |
Create instance of mutation entry | def initialize row_key: nil
@row_key = row_key
@mutations = []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @entry = Entry.new\n end",
"def initialize(mutation, view, data)\n @mutation = mutation\n @view = view\n @data = data\n end",
"def entry\n Entry.new\n end",
"def mutation(name = nil, &block)\n Mutation.new(name, &block)\n end",
"def mutati... | [
"0.611099",
"0.6103383",
"0.59472764",
"0.58807254",
"0.5843771",
"0.58240294",
"0.5803478",
"0.57196856",
"0.5705476",
"0.56437826",
"0.55924195",
"0.5588326",
"0.553505",
"0.5453083",
"0.5404392",
"0.5358268",
"0.53500277",
"0.5345603",
"0.5312241",
"0.5295844",
"0.5285876"... | 0.0 | -1 |
Add SetCell mutation to list of mutations | def set_cell \
family_name: nil,
column_qualifier: nil,
timestamp_micros: nil,
value: nil
options = {
family_name: family_name,
column_qualifier: column_qualifier,
timestamp_micros: timestamp_micros,
value: value
}.delete_if { |_, v| v.nil? }
@mutations << Google::Bigtable::V2::Mutation.new(set_cell: options)
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def def_mutation_method(*meths)\n meths.each do |meth|\n instance_eval(\"def #{meth}!(*args, &block); mutation_method(:#{meth}, *args, &block) end\")\n end\n end",
"def mutation_for(index)\n @mutations[index] ||= OpenStruct.new(indexes: [], deletes: [])\n end",
"def mutation_method(meth... | [
"0.61026615",
"0.5669319",
"0.56528455",
"0.5421355",
"0.5421355",
"0.5363576",
"0.53306913",
"0.5275236",
"0.5238404",
"0.5194309",
"0.51595706",
"0.51575",
"0.51190317",
"0.49435246",
"0.4863465",
"0.48069",
"0.47235847",
"0.4683409",
"0.46541667",
"0.46464017",
"0.46405503... | 0.5640494 | 3 |
Add DeleteFromColumn mutation to list of mutations | def delete_from_column \
family_name: nil,
column_qualifier: nil,
time_range: nil
options = {
family_name: family_name,
column_qualifier: column_qualifier,
time_range: time_range
}.delete_if { |_, v| v.nil? }
@mutations <<
Google::Bigtable::V2::Mutation.new(delete_from_column: options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_mutation(cf, column, subcolumn, timestamp, options={})\n deletion_hash = {:timestamp => timestamp}\n if is_super(cf)\n deletion_hash[:super_column] = column if column\n deletion_hash[:predicate] = CassandraThrift::SlicePredicate.new(:column_names => [subcolumn]) if subcolumn\n ... | [
"0.6972807",
"0.66254073",
"0.5892553",
"0.5765904",
"0.5765904",
"0.5719498",
"0.57179976",
"0.5713823",
"0.5667568",
"0.5648876",
"0.5496132",
"0.54852504",
"0.54436743",
"0.54252535",
"0.540978",
"0.540978",
"0.54092294",
"0.53304726",
"0.5262191",
"0.5235954",
"0.5233527"... | 0.65923387 | 2 |
Add DeleteFromFamily to list of mutations | def delete_from_family family_name
options = { family_name: family_name }
@mutations <<
Google::Bigtable::V2::Mutation.new(delete_from_family: options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_from_row\n @mutations <<\n Google::Bigtable::V2::Mutation.new(delete_from_row: {})\n end",
"def delete_from_column \\\n family_name: nil,\n column_qualifier: nil,\n time_range: nil\n options = {\n family_name: family_name,... | [
"0.5580146",
"0.55263066",
"0.5497573",
"0.5410621",
"0.53976864",
"0.53690964",
"0.53685987",
"0.5312235",
"0.5308705",
"0.5295855",
"0.52908766",
"0.5287576",
"0.52873856",
"0.52873856",
"0.52654916",
"0.5221624",
"0.51929384",
"0.5173364",
"0.51714253",
"0.5148733",
"0.514... | 0.7018944 | 0 |
Add DeleteFromRow mutation to list of mutations | def delete_from_row
@mutations <<
Google::Bigtable::V2::Mutation.new(delete_from_row: {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _delete_mutation(cf, column, subcolumn, timestamp, options={})\n deletion_hash = {:timestamp => timestamp}\n if is_super(cf)\n deletion_hash[:super_column] = column if column\n deletion_hash[:predicate] = CassandraThrift::SlicePredicate.new(:column_names => [subcolumn]) if subcolumn\n ... | [
"0.59805226",
"0.57592815",
"0.57592815",
"0.5645911",
"0.5620477",
"0.5578985",
"0.54432166",
"0.5413112",
"0.5351776",
"0.5285552",
"0.5256937",
"0.5232629",
"0.52270424",
"0.5208792",
"0.5186986",
"0.5170502",
"0.515839",
"0.51457185",
"0.5110289",
"0.50698984",
"0.5063458... | 0.779848 | 0 |
provide a slightly nicer url for referencing individual items | def to_param
[id, name.parameterize].join("-")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n item_path(object)\n end",
"def item_url(item)\n item.url\n end",
"def item_url(item)\n item.url\n end",
"def item_detail_url(id)\n \"#{@baseurl}/agdocs.aspx?doctype=agenda&itemid=#{id}\"\n end",
"def url\n item_hash.deep_find([:listing_details, :view_item_url])\n end",
"... | [
"0.8077901",
"0.7713662",
"0.7713662",
"0.72329444",
"0.72040224",
"0.7140868",
"0.71071607",
"0.6874624",
"0.68341726",
"0.67999744",
"0.6643773",
"0.655471",
"0.6514069",
"0.6489683",
"0.6473923",
"0.64428043",
"0.64363885",
"0.6422611",
"0.63907284",
"0.63680524",
"0.63569... | 0.0 | -1 |
Clear any cached mp4info output for path. If path is nil, clear all cached output. | def clear_mp4info_output(path = nil)
if path.nil?
@mp4info_time = {}
@mp4info_output = {}
return nil
end
path = File.expand_path path
@mp4info_time = {} if @mp4info_time.nil?
@mp4info_output = {} if @mp4info_output.nil?
@mp4info_time.delete path
@mp4info_output.delete path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_path_results(path)\n [path_assets_key(path), path_links_to_key(path), path_linked_to_from_key(path)].each do |key|\n redis.del key\n end\n end",
"def clear(path)\n set_internal(path, nil)\n end",
"def clear\n Dir[File.join(@output_dir, '*')].each do |path|\n File... | [
"0.64796144",
"0.6389412",
"0.61936766",
"0.6101304",
"0.60086524",
"0.59450895",
"0.5869885",
"0.5796418",
"0.5794685",
"0.5745473",
"0.5706856",
"0.55756897",
"0.5527798",
"0.5513906",
"0.5402243",
"0.5392935",
"0.5356364",
"0.53444207",
"0.53435737",
"0.5326243",
"0.531667... | 0.8657946 | 0 |
Returns the dimensions of the video at path as an Array. | def dimensions(path)
mp4info_output(path).split("\n").each do |line|
matches = /video.*\s(\d+)x(\d+)\s/.match line
next if matches.nil?
return [matches[1].to_f, matches[2].to_f]
end
[nil, nil]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flash_dimensions(path)\n instance = ImageSpec.new(@video.attachment.path)\n width = instance.width\n height = instance.height\n return width, height\n end",
"def video_dimensions(file)\n dim = Paperclip.run('ffmpeg', '-i :source 2>&1', :source => File.expand_path(file.pa... | [
"0.73142195",
"0.68573606",
"0.65472263",
"0.6518619",
"0.638723",
"0.6245474",
"0.6240013",
"0.62026614",
"0.6190429",
"0.61529523",
"0.6071909",
"0.5975362",
"0.58772206",
"0.586249",
"0.58509547",
"0.5842587",
"0.5781153",
"0.5770876",
"0.57606757",
"0.5759018",
"0.5733305... | 0.8710226 | 0 |
Get the formatted audio or video bitrate from the MP4 video file at path. | def formatted_bitrate(path, type)
mp4info_output(path).split("\n").each do |line|
next unless line =~ /\d\t#{type}/
return line.split(',')[2].strip
end
'(not found)'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_bitrate(path)\n bitrate path, :video\n end",
"def formatted_video_bitrate(path)\n formatted_bitrate path, :video\n end",
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = err.match(/(\\d+) kb\\/s/)\n return bitrate ? bitrate[1].to... | [
"0.81294286",
"0.7998385",
"0.7527045",
"0.7056111",
"0.69612586",
"0.672203",
"0.63756025",
"0.63490736",
"0.61377305",
"0.5955219",
"0.57738906",
"0.57228506",
"0.57065165",
"0.56060815",
"0.5605602",
"0.5537394",
"0.54820764",
"0.5463842",
"0.54607147",
"0.5457932",
"0.544... | 0.7022294 | 4 |
Get the formatted audio bitrate from the MP4 video file at path. | def formatted_audio_bitrate(path)
formatted_bitrate path, :audio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def formatted_video_bitrate(path)\n formatted_bitrate path, :video\n end",
"def video_bitrate(path)\n bitrate path, :video\n end",
"def audio_bitrate(path)\n bitrate path, :audio\n end",
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = ... | [
"0.77966666",
"0.76847315",
"0.7376725",
"0.7376589",
"0.68822277",
"0.6602937",
"0.64624405",
"0.59737486",
"0.58868355",
"0.5823014",
"0.57839876",
"0.5697291",
"0.56890565",
"0.5686086",
"0.56756735",
"0.5629017",
"0.56084996",
"0.5540699",
"0.5531334",
"0.55067974",
"0.53... | 0.75179744 | 2 |
Get the formatted video bitrate from the MP4 video file at path. | def formatted_video_bitrate(path)
formatted_bitrate path, :video
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_bitrate(path)\n bitrate path, :video\n end",
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = err.match(/(\\d+) kb\\/s/)\n return bitrate ? bitrate[1].to_i : nil\n end",
"def formatted_bitrate(path, type)\n mp4info_output(path)... | [
"0.817623",
"0.7385877",
"0.7056713",
"0.6748468",
"0.66658753",
"0.65543526",
"0.63057923",
"0.6115159",
"0.5970281",
"0.5909683",
"0.58204395",
"0.56765527",
"0.54749143",
"0.54287153",
"0.53916276",
"0.5387644",
"0.53764665",
"0.53138685",
"0.5292887",
"0.52756554",
"0.523... | 0.826648 | 0 |
Get the numeric audio or video bitrate from the MP4 video file at path. | def bitrate(path, type)
formatted = formatted_bitrate(path, type).sub(/bps$/, '')
case formatted
when /M$/
formatted.sub(/M$/, '').strip.to_f * 1_000_000.0
when /k$/
formatted.sub(/k$/, '').strip.to_f * 1000.0
else
formatted.strip.to_f
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_bitrate(path)\n bitrate path, :video\n end",
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = err.match(/(\\d+) kb\\/s/)\n return bitrate ? bitrate[1].to_i : nil\n end",
"def formatted_video_bitrate(path)\n formatted_bitrate pa... | [
"0.81383395",
"0.7960096",
"0.7397341",
"0.7146394",
"0.68217254",
"0.65688336",
"0.6521675",
"0.6448629",
"0.6282854",
"0.625758",
"0.59971565",
"0.5990165",
"0.5986039",
"0.5971694",
"0.5878373",
"0.577691",
"0.57638854",
"0.5737732",
"0.5710099",
"0.5661267",
"0.5635599",
... | 0.6846043 | 4 |
Get the numeric audio bitrate from the MP4 video file at path. | def audio_bitrate(path)
bitrate path, :audio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = err.match(/(\\d+) kb\\/s/)\n return bitrate ? bitrate[1].to_i : nil\n end",
"def video_bitrate(path)\n bitrate path, :video\n end",
"def bit_rate\n mediainfo.audio.bitrate\n end",
"def... | [
"0.78070647",
"0.75318605",
"0.70306176",
"0.68496823",
"0.66534877",
"0.6364303",
"0.61771226",
"0.6123702",
"0.6114503",
"0.6113192",
"0.6084195",
"0.60739017",
"0.60328513",
"0.6032703",
"0.6011137",
"0.5961758",
"0.58093715",
"0.56733507",
"0.5632778",
"0.55332994",
"0.54... | 0.7310402 | 2 |
Get the numeric video bitrate from the MP4 video file at path. | def video_bitrate(path)
bitrate path, :video
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bitrate\n out, err, status = Open3.capture3('ffmpeg', '-i', @path)\n bitrate = err.match(/(\\d+) kb\\/s/)\n return bitrate ? bitrate[1].to_i : nil\n end",
"def formatted_video_bitrate(path)\n formatted_bitrate path, :video\n end",
"def bitrate(path, type)\n formatted ... | [
"0.78973496",
"0.7287975",
"0.67159647",
"0.6591915",
"0.64964217",
"0.64817303",
"0.63948166",
"0.62552285",
"0.62118",
"0.6084271",
"0.59261674",
"0.587248",
"0.5795195",
"0.5719678",
"0.56449896",
"0.55780536",
"0.55642074",
"0.5511735",
"0.54977167",
"0.54840446",
"0.5478... | 0.80314434 | 0 |
GET /statements/1 GET /statements/1.json | def show
@statement = Statement.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @statement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n respond_to do |format|\n format.html { render nothing: true }\n format.json { render json: @statements }\n end\n end",
"def get_statements(options={})\n options = {:result_type => DATA_TYPES[:Turtle]}.merge(options)\n easy = Curl::Easy.new\n easy.headers[\"Accept\"] = ... | [
"0.6915394",
"0.62550324",
"0.61614704",
"0.5867885",
"0.5828038",
"0.5788527",
"0.56535447",
"0.55563474",
"0.5523951",
"0.54761654",
"0.5448787",
"0.54469705",
"0.54382575",
"0.54147667",
"0.5395882",
"0.53941405",
"0.5391099",
"0.5363107",
"0.53503996",
"0.5330517",
"0.532... | 0.7043316 | 0 |
GET /statements/new GET /statements/new.json | def new
@statement = Statement.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @statement }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @statement = Statement.find(params[:statement_id])\n @expense = Expense.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def create\n @statement = Statement.new(params[:statement])\n\n respond_to do |format|\... | [
"0.7236457",
"0.6782236",
"0.64921063",
"0.6477343",
"0.645888",
"0.64295554",
"0.64279455",
"0.6416496",
"0.6396827",
"0.6396827",
"0.63565505",
"0.6331279",
"0.63294166",
"0.63227797",
"0.6296224",
"0.6294882",
"0.62858576",
"0.62657815",
"0.62602395",
"0.62403655",
"0.6229... | 0.8050562 | 0 |
POST /statements POST /statements.json | def create
@statement = Statement.new(params[:statement])
respond_to do |format|
if @statement.save
format.html { redirect_to administration_cms_path, notice: 'Statement was successfully created.' }
format.json { render json: @statement, status: :created, location: @statement }
else
format.html { render action: "new" }
format.json { render json: @statement.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @statement = Statement.new(statement_params)\n @statement.user = current_user\n\n respond_to do |format|\n if @statement.save\n format.html { redirect_to @statement, notice: 'Statement was successfully created.' }\n format.json { render :show, status: :created, location: @s... | [
"0.6495993",
"0.6124569",
"0.59856826",
"0.59541076",
"0.57091326",
"0.5650298",
"0.559031",
"0.5563983",
"0.55043954",
"0.54562414",
"0.54510266",
"0.54448575",
"0.540331",
"0.5397076",
"0.5375042",
"0.5356683",
"0.5343711",
"0.5318129",
"0.53139716",
"0.5282329",
"0.5271519... | 0.64445645 | 1 |
PUT /statements/1 PUT /statements/1.json | def update
@statement = Statement.find(params[:id])
respond_to do |format|
if @statement.update_attributes(params[:statement])
format.html { redirect_to @statement, notice: 'Statement was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @statement.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @statement.update(statement_params)\n format.html { redirect_to store_statements_url(@store), notice: 'Statement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.... | [
"0.6285552",
"0.6188284",
"0.5700515",
"0.5662684",
"0.56484187",
"0.560823",
"0.5599361",
"0.5586377",
"0.55595094",
"0.55492866",
"0.5517127",
"0.5517127",
"0.5517127",
"0.5479329",
"0.54785717",
"0.54370344",
"0.5425983",
"0.54248345",
"0.5423442",
"0.5403006",
"0.53722185... | 0.65764624 | 0 |
DELETE /statements/1 DELETE /statements/1.json | def destroy
@statement = Statement.find(params[:id])
@statement.destroy
respond_to do |format|
format.html { redirect_to statements_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to store_statements_url(@store) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @statement.destroy\n respond_to do |format|\n format.html { redirect_to statements_url, notice: 'Stat... | [
"0.71904516",
"0.7111607",
"0.6917781",
"0.6737038",
"0.66258734",
"0.65855336",
"0.6539619",
"0.6518448",
"0.6485976",
"0.6457105",
"0.6446704",
"0.6444823",
"0.64389604",
"0.6409114",
"0.6389034",
"0.6373529",
"0.6337345",
"0.63357604",
"0.6325747",
"0.63200015",
"0.6314593... | 0.74896455 | 0 |
these are conditional that check if the room is available i want to go line by line and understand the conditional. which conditions meet available rooms vs unavailable rooms. the availability method is checking the end,date,start,date and seeing if a room is available, so it's going to go through the reservations and see which dates are available, and it's going to use the does_overlap method to see what reservations are available. | def availability(room_number, end_date, start_date)
@reservations.each do |reservation|
# i am trying to look throught all the reservation instances and
# see what dates are available to reserve a reservation.
if room_number == reservation.room_number && reservation.does_overlap(end_date,start_date)
# if reservation.start_date == start_date && reservation.end_date == end_date
# return false
# elsif reservation.start_date > start_date && reservation.start_date < end_date
# next #true
# elsif reservation.start_date < start_date && reservation.start_date < end_date
# next #true
# elsif reservation.start_date > start_date && reservation.start_date > end_date
# next #false , i think i need only
# else
# end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def availability_of_room\n room_type = RoomType.find(self.room_type_id) rescue nil\n errors.add(:room_type_id, \"Pleass select room type\") if room_type.blank?\n return if room_type.blank?\n total_rooms = room_type.rooms.pluck(:id)\n booked_rooms = Booking.where('(start_date >= ? and start_date <= ?... | [
"0.7884735",
"0.74615186",
"0.7449114",
"0.74365795",
"0.7416771",
"0.7194438",
"0.71576613",
"0.71373236",
"0.70933443",
"0.7066479",
"0.7058382",
"0.7058148",
"0.7030371",
"0.6998662",
"0.69539624",
"0.6937622",
"0.6900442",
"0.68730867",
"0.6863713",
"0.68544465",
"0.68405... | 0.8402564 | 0 |
Starts the proxy and web servers | def start
main_loop
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n super\n start_proxy\n end",
"def start_proxy\n if !proxy.running?\n Kernel.at_exit do\n proxy.stop\n end\n end\n Socks.enable_net_http_socks_proxy\n proxy.start\n end",
"def start\n # we trap CTRL+C in the console and k... | [
"0.7362921",
"0.7348219",
"0.7029826",
"0.69100213",
"0.68708074",
"0.6851663",
"0.6816431",
"0.6691287",
"0.6648079",
"0.66148233",
"0.65478265",
"0.65477747",
"0.6536149",
"0.65347475",
"0.652827",
"0.64894944",
"0.64707935",
"0.64707935",
"0.6470511",
"0.6419364",
"0.64088... | 0.0 | -1 |
The url that the proxy server is running on | def url
"http://#{host}:#{port}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def proxy_uri; end",
"def proxy_uri; end",
"def http_proxy_uri\n @tools.http_proxy_url\n end",
"def server_url\n url\n end",
"def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end",
"def proxy_url\n URI.join(cas_url, 'proxy').to_s\n end",
"def spice_proxy_url\n service = ... | [
"0.804008",
"0.804008",
"0.8032359",
"0.80134887",
"0.78635925",
"0.78635925",
"0.7805007",
"0.775356",
"0.7741869",
"0.7728452",
"0.7715351",
"0.7696011",
"0.76709867",
"0.7626733",
"0.76235116",
"0.7578038",
"0.75754684",
"0.7569435",
"0.7518786",
"0.75069356",
"0.74745464"... | 0.763726 | 14 |
The url that the web server can be accessed from | def webserver_url
"http://#{webserver_host}:#{webserver_port}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_url\n url\n end",
"def server_url\n @uri\n end",
"def get_url\n URI.parse(\"#{@server}#{URL}\")\n end",
"def url\n File.join(server.url, path)\n end",
"def url\n \"http://#{host}:#{port}/\"\n end",
"def url\n @url = \"#{@http_mode}://#{self.config.ser... | [
"0.8416007",
"0.81232107",
"0.78986114",
"0.78748864",
"0.7871195",
"0.7737619",
"0.7737583",
"0.7735614",
"0.77273554",
"0.77273554",
"0.766367",
"0.763549",
"0.7623681",
"0.7590802",
"0.75541306",
"0.75451994",
"0.7486279",
"0.7478701",
"0.746647",
"0.7462863",
"0.7461101",... | 0.7985803 | 2 |
The url that the direct web server can be accessed from | def server_url
"http://#{server_host}:#{server_port}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_url\n url\n end",
"def server_url\n @uri\n end",
"def url\n File.join(server.url, path)\n end",
"def get_url\n URI.parse(\"#{@server}#{URL}\")\n end",
"def getServerUrl\n puts \"******* getServerUrl \" + \"*\" * 21\n reqUrl = request.original_url\n ... | [
"0.80691427",
"0.78183067",
"0.76460737",
"0.76277465",
"0.7620166",
"0.7562246",
"0.75315976",
"0.74251366",
"0.7402409",
"0.73892885",
"0.7383181",
"0.73784167",
"0.7331022",
"0.73144335",
"0.7284464",
"0.7244583",
"0.7201876",
"0.71870345",
"0.71870345",
"0.71870345",
"0.7... | 0.72287256 | 16 |
The host that the proxy server is running on | def host
'localhost'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_host\n AgileProxy.config.server_host\n end",
"def host\n return @forwarded_host || @host\n end",
"def webserver_host\n AgileProxy.config.webserver_host\n end",
"def get_host\n @host\n end",
"def public_hostname\n get_proxy.get_public_hostname\n end",
"def lo... | [
"0.8572064",
"0.8288719",
"0.8033457",
"0.7964709",
"0.7950906",
"0.7911097",
"0.7905989",
"0.789301",
"0.78472984",
"0.78472984",
"0.784292",
"0.7841446",
"0.7840302",
"0.7817707",
"0.7800799",
"0.7766707",
"0.7744529",
"0.7691157",
"0.7637672",
"0.7637672",
"0.7622603",
"... | 0.72230816 | 43 |
The port that the proxy server is running on | def port
@request_spec_server.port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_port\n AgileProxy.config.server_port\n end",
"def proxy_port; end",
"def webserver_port\n AgileProxy.config.webserver_port\n end",
"def proxyport\n config[\"proxyport\"]\n end",
"def proxy_port\n proxy? ? @options['proxy_port'].to_i : nil\n end",
"def port\n ... | [
"0.8833046",
"0.8504324",
"0.8399139",
"0.83455086",
"0.81563175",
"0.8147171",
"0.8019531",
"0.801942",
"0.79635996",
"0.7956652",
"0.7949512",
"0.7911321",
"0.7867339",
"0.7817146",
"0.7815137",
"0.7813168",
"0.7803565",
"0.7803565",
"0.7750971",
"0.7748397",
"0.7747662",
... | 0.75296885 | 32 |
The host that the webserver is running on | def webserver_host
AgileProxy.config.webserver_host
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def host\n request.host\n end",
"def get_host\n @host\n end",
"def host\n @host\n end",
"def server_host\n Socket.gethostname\n end",
"def current_host\n request.host\n end",
"def host\n @request['Host']\n end",
"def local_host\n get('beef.http... | [
"0.8540595",
"0.83259076",
"0.8263812",
"0.8227238",
"0.820997",
"0.8200371",
"0.81919074",
"0.8151155",
"0.8128283",
"0.8127045",
"0.8127045",
"0.80644435",
"0.7977605",
"0.7977605",
"0.7976272",
"0.7975769",
"0.796086",
"0.79496825",
"0.7938393",
"0.7925824",
"0.79250526",
... | 0.84756005 | 1 |
The port that the webserver is running on | def webserver_port
AgileProxy.config.webserver_port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def port\n request.port\n end",
"def server_port; end",
"def port\n raise \"Http-server not spawned yet. Call Hayabusa#start to spawn it.\" if !@httpserv\n return @httpserv.server.addr[1]\n end",
"def port\n configuration.port\n ... | [
"0.855258",
"0.8495012",
"0.8344487",
"0.8338298",
"0.82588476",
"0.82588476",
"0.8219797",
"0.819516",
"0.81781715",
"0.8141072",
"0.8140434",
"0.8118169",
"0.8092489",
"0.80759716",
"0.8060858",
"0.8060858",
"0.8060858",
"0.80454665",
"0.80112875",
"0.801016",
"0.7984073",
... | 0.8639566 | 0 |
The host that the direct server is running on | def server_host
AgileProxy.config.server_host
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_host\n Socket.gethostname\n end",
"def get_host\n @host\n end",
"def host\n @host\n end",
"def host\n return @host\n end",
"def host\n return @host\n end",
"def host\n\t\t\t# FIXME: This is both a hack and the best wa... | [
"0.84988356",
"0.83799535",
"0.8198146",
"0.8192407",
"0.8192407",
"0.8167378",
"0.81470466",
"0.8132097",
"0.8132028",
"0.8130037",
"0.8073443",
"0.8050749",
"0.8031818",
"0.8007639",
"0.7983823",
"0.796043",
"0.7952581",
"0.7952581",
"0.79278356",
"0.7888428",
"0.78256965",... | 0.82315063 | 2 |
The port that the direct server is running on | def server_port
AgileProxy.config.server_port
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def server_port ; @env['SERVER_PORT' ].to_i ; end",
"def port\n raise \"Http-server not spawned yet. Call Hayabusa#start to spawn it.\" if !@httpserv\n return @httpserv.server.addr[1]\n end",
"def port\n request.port\n end",
"def server_port; end",
"def port\n self.port\n end",
"d... | [
"0.8263134",
"0.816039",
"0.815227",
"0.81378675",
"0.80968785",
"0.80955166",
"0.8093267",
"0.8057937",
"0.8057937",
"0.8006207",
"0.7988661",
"0.79864514",
"0.79864514",
"0.79864514",
"0.79533154",
"0.79449356",
"0.78944904",
"0.78944904",
"0.7864458",
"0.78475386",
"0.7844... | 0.8316946 | 0 |
Builds a hash representation containing simple objects, suitable for serialization (JSON). | def to_hash
@to_hash ||= Util::NonNilHashBuilder.build do |h|
h.add(:application, application)
h.add(:class_name, class_name)
h.add(:file, file)
h.add(:function, function)
h.add(:line, line)
h.add(:module_name, module_name)
h.add(:vm_pid, vm_pid)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash() end",
"def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end",
"def hash\n [name, type, sub_attributes, multi_valued, description, required, canonical_values, case_exact, mutability, ... | [
"0.6681538",
"0.65886784",
"0.65382826",
"0.65286136",
"0.6499261",
"0.648298",
"0.64711004",
"0.6470033",
"0.6470033",
"0.64235705",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6383659",
"0.6364522",... | 0.0 | -1 |
initialize object after creation | def initialize(dollars=0, cents=0)
@dollars = dollars
@cents = cents
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize() end",
"def initialize\n init\n end",
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def init\n end",
"def init\n end",
"def init\n end",
"def initialize()\n end",
"def init; end",
"def init; end",
"def init; ... | [
"0.8631483",
"0.8563202",
"0.85210276",
"0.85210276",
"0.845091",
"0.845091",
"0.845091",
"0.84480727",
"0.84156007",
"0.84156007",
"0.84156007",
"0.84156007",
"0.835678",
"0.8329072",
"0.828633",
"0.8235651",
"0.8226336",
"0.81809765",
"0.81441337",
"0.81441337",
"0.8133795"... | 0.0 | -1 |
returns a new Money object that is the sum of this Money object and other Money object | def +(other)
raise TypeError.new("Argument is not a Money object") unless other.instance_of?(Money)
d = @dollars + other.dollars
c = @cents + other.cents
if c >= 100
d = d + 1
c = c % 100
end
Money.new(d,c)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def +(other)\n Money.create_from_cents((cents + other.to_money.cents))\n end",
"def +(other)\n raise TypeError unless other.is_a?(Money)\n if self.base_currency == other.base_currency\n Money.new(amount + other.amount, base_currency)\n else\n Money.new(amount + other.convert_to(self.base_c... | [
"0.81189156",
"0.77113867",
"0.7611345",
"0.75583375",
"0.7304315",
"0.7148269",
"0.69730556",
"0.6750792",
"0.6702213",
"0.66280824",
"0.6589613",
"0.6470328",
"0.64220893",
"0.6367652",
"0.633607",
"0.6309087",
"0.6299841",
"0.62673056",
"0.62230694",
"0.62157863",
"0.62038... | 0.7610856 | 3 |
Returns the String in snake_case. | def snakecase
str = dup
str.gsub! /::/, '/'
str.gsub! /([A-Z]+)([A-Z][a-z])/, '\1_\2'
str.gsub! /([a-z\d])([A-Z])/, '\1_\2'
str.tr! ".", "_"
str.tr! "-", "_"
str.downcase!
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def snake_case(str); end",
"def snakecase(string); end",
"def snake_case\n self.gsub(/([a-z])([A-Z])/) {|s| \"#{s[0]}_#{s[1]}\"}.gsub(/([A-Z])([A-Z][a-z])/) {|s| \"#{s[0]}_#{s[1..2]}\"}.downcase\n end",
"def snake_case\n return downcase if match(/\\A[A-Z]+\\z/)\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\... | [
"0.88888323",
"0.87702835",
"0.87283534",
"0.83722",
"0.8253904",
"0.8231606",
"0.8216839",
"0.8130532",
"0.80459297",
"0.80459297",
"0.80459297",
"0.802878",
"0.7991591",
"0.79397976",
"0.7935622",
"0.78992367",
"0.7820297",
"0.7816781",
"0.7814599",
"0.77987844",
"0.7700439... | 0.8106256 | 8 |
Returns the String in lowerCamelCase. | def lower_camelcase
str = dup
str.gsub!(/\/(.?)/) { "::#{$1.upcase}" }
str.gsub!(/(?:_+|-+)([a-z])/) { $1.upcase }
str.gsub!(/(\A|\s)([A-Z])/) { $1 + $2.downcase }
str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def camel_case(str); end",
"def camel_case_lower(str)\n str.strip().gsub(' ','').split('_').inject([]){ |buffer,e| buffer.push(buffer.empty? ? e : e.capitalize) }.join\n end",
"def lower_camelcase(source_str)\n str = source_str.dup\n str.gsub!(/\\/(.?)/) { \"::#{$1.upcase}\" }\n st... | [
"0.77710474",
"0.76927024",
"0.7557113",
"0.752166",
"0.7491947",
"0.7483406",
"0.7459908",
"0.73350567",
"0.72782993",
"0.7241182",
"0.7235849",
"0.71896416",
"0.7187515",
"0.71643484",
"0.7159971",
"0.7157174",
"0.7157174",
"0.7145288",
"0.71387166",
"0.7093949",
"0.7086096... | 0.79875034 | 0 |
Returns the String without namespace. | def strip_namespace
split(":").last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_nothing(s)\n s.gsub(/\\.|\\_|\\-/, '')\n end",
"def namespace\n return self.name ? self.name.downcase.gsub(/[^0-9A-Za-z ]/, '').gsub(' ', '-') : ''\n end",
"def raw_text\n \"\"\n end",
"def strip!\n \"\"\n end",
"def str_prefix\n\t\t\t\t\"\"\n\t\t\tend",
"def st... | [
"0.65099686",
"0.6340703",
"0.613671",
"0.6063887",
"0.5991692",
"0.59710956",
"0.5919321",
"0.59192306",
"0.5891738",
"0.5891738",
"0.58645713",
"0.5842534",
"0.5842534",
"0.5842534",
"0.5800302",
"0.5768306",
"0.5768306",
"0.57471746",
"0.5739507",
"0.5684593",
"0.5661979",... | 0.66244006 | 0 |
Translates SOAP response values to Ruby Objects. | def map_soap_response
return DateTime.parse(self) if Savon::SOAP::DateTimeRegexp === self
return true if self.strip.downcase == "true"
return false if self.strip.downcase == "false"
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map_soap_response\n inject({}) do |hash, (key, value)|\n key = key.strip_namespace.snakecase.to_sym\n\n value = case value\n when Hash then value[\"xsi:nil\"] ? nil : value.map_soap_response\n when Array then value.map { |a_value| a_value.map_soap_response rescue a_value }\n ... | [
"0.6317099",
"0.6317099",
"0.59868497",
"0.5955077",
"0.59317523",
"0.578516",
"0.5753095",
"0.57290816",
"0.56870955",
"0.5685565",
"0.5662481",
"0.5573609",
"0.5559776",
"0.5559776",
"0.5559776",
"0.5559776",
"0.5559776",
"0.55380833",
"0.55380833",
"0.5531697",
"0.5516199"... | 0.55897886 | 11 |
Returns the Object as a SOAP request compliant key. | def to_soap_key
self[-1, 1] == "!" ? chop : self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _build_object_key( obj )\n index = self.__pack[:keys].length\n self.__pack[:keys] << _pack_object( obj )\n index # return key\n end",
"def generate_key_from_object(obj)\n obj.class.name.underscore.to_sym\n end",
"def dump_key(object)\n object.key_attribute\n end",
"def to_key\n ... | [
"0.6884304",
"0.6626397",
"0.6536931",
"0.62537974",
"0.6175109",
"0.6170531",
"0.61252475",
"0.6095237",
"0.60556394",
"0.60556394",
"0.6012871",
"0.59898597",
"0.5953526",
"0.5941643",
"0.5938142",
"0.5927056",
"0.5902956",
"0.5890656",
"0.58897054",
"0.58897054",
"0.586474... | 0.60796654 | 8 |
Returns the String as a SOAP value. Escapes special characters for XML. | def to_soap_value
CGI.escapeHTML self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @soap\n end",
"def string_value(value)\n if value.kind_of? String\n value = CGI::escape_html(value)\n else\n value = value.to_s\n end\n value\n end",
"def xml_escape(input)\n return input.to_s.to_xs\n end",
"def escape_xml(string)\n strin... | [
"0.62317586",
"0.5946076",
"0.5928192",
"0.5790233",
"0.57574224",
"0.5737871",
"0.57190907",
"0.5662245",
"0.5656116",
"0.5598127",
"0.557627",
"0.55592984",
"0.5536804",
"0.5533672",
"0.5505227",
"0.54839903",
"0.5446453",
"0.5429151",
"0.54275405",
"0.5397207",
"0.5393661"... | 0.78851044 | 0 |
Convert the String into a SOAP value without escaping special characters. | def to_soap_value!
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_soap_value\n CGI.escapeHTML self\n end",
"def parse_value(s)\n s[0] == '\"' ? s[1...-1].gsub(/\\\\(.)/, \"\\\\1\") : s\n end",
"def from_string_internal(str)\n ole_connector.ValueFromStringInternal(str)\n end",
"def unescape_xml(text)\n CGI.unescape_html text\n ... | [
"0.69211364",
"0.61274296",
"0.5699745",
"0.5675472",
"0.56695247",
"0.5667433",
"0.5658844",
"0.5626205",
"0.56229115",
"0.55727637",
"0.55545074",
"0.55510986",
"0.54972005",
"0.54642606",
"0.54000586",
"0.5387515",
"0.53842634",
"0.5369247",
"0.5348352",
"0.53385514",
"0.5... | 0.55096316 | 12 |
Dumps a JSON representation of an order into the user's session. | def store!
session['order'] = unpromoted_order.dump
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def store_order_details(order)\n details = {}\n stored_attributes.each do |attribute|\n details[attribute.to_sym] = order.try(attribute)\n end\n cookies.permanent[\"last_#{order.class.name.underscore}_details\"] = ActiveSupport::JSON.encode(details)\n end",
"def orders\n authen... | [
"0.64394635",
"0.6190704",
"0.61813045",
"0.61813045",
"0.61745965",
"0.61476684",
"0.6138986",
"0.6133968",
"0.6017698",
"0.58758664",
"0.58649975",
"0.584597",
"0.5845053",
"0.5839118",
"0.58314097",
"0.5802074",
"0.5769938",
"0.57185006",
"0.5705542",
"0.56824136",
"0.5672... | 0.6870006 | 0 |
Dumps a JSON representation of an order into the user's session, then redirects them to either the originating URL or another URL specifed via the params. | def store_and_redirect(key = nil, note = nil)
flash[key] = note if key and note
store!
bounce_back
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect\n @order.assign_attributes(order_params)\n if @order.valid?\n Gocardless::RedirectFlowService::Initialize.run(@order) do |redirect_url|\n return redirect_to redirect_url\n end\n else\n @address = @order.address\n @product = @order.product.decorate\n @order = @o... | [
"0.6412608",
"0.62379247",
"0.61962026",
"0.61817056",
"0.61620194",
"0.6152969",
"0.5956442",
"0.59428895",
"0.5915842",
"0.59050304",
"0.5893475",
"0.58822274",
"0.5874501",
"0.58162403",
"0.57951635",
"0.57817525",
"0.5764216",
"0.57587063",
"0.5756803",
"0.5730396",
"0.57... | 0.0 | -1 |
Called after every test method runs. Can be used to tear down fixture information. | def teardown
# Do nothing
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_teardown; end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def teardown\n end",
"def tear... | [
"0.80261725",
"0.7953777",
"0.7953777",
"0.7856355",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.784488",
"0.78328496",
"0.78328496",
"0.77501464",
"0.77479887",
"0.77479887",
"0.7733529",
"0.771271",
"0.77113944",
"0.77113944",
"0... | 0.0 | -1 |
In your view files, call this anywhere the veiw could be extended. The argument 'point' is whatever you would like to name this point, it will be used as the first argument in ViewExtender.register. In your view: some default content In a plugin or anywhere else you'd like to add an extension: ViewExtender.register('index:things_list', :top, 'Your List') | def extension_point point, &blk
# Testing HACK: integrate more with rails / erb to get rid of
# output() and @collected_output, always concat instead of output()
oco = @collected_output
@collected_output = ''
reg = ViewExtender.send(:_registry)
unless reg[point]
if block_given?
# blocks to extension_point should only be run, not output
# because haml / erb should be handling the output
output(capture(&blk))
end
else
render_at(reg[point][:before])
unless render_at(reg[point][:replace])
render_at(reg[point][:top])
# a block that gets registered should return something outputable
if block_given?
output(capture(&blk))
end
render_at(reg[point][:bottom])
end
render_at(reg[point][:after])
end
nco = @collected_output
@collected_output = oco
nco
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custom_extension(context={}, element, aspect_model)\n\n app = context[:app]\n \n renderer = ::UI::FieldSetRender.new('location', app)\n renderer.render('viewextension','',{:element => element})\n \n end",
"def add_view\n super\n end",
"def add_point\n end",
"def loc_view\... | [
"0.67413044",
"0.6184599",
"0.58098173",
"0.56020874",
"0.54845506",
"0.54365945",
"0.54307675",
"0.53977805",
"0.53745335",
"0.5371315",
"0.5368227",
"0.5368227",
"0.5339749",
"0.53038436",
"0.5269724",
"0.5218176",
"0.52130306",
"0.52102727",
"0.52069587",
"0.5203506",
"0.5... | 0.62952304 | 1 |
Used for positioning, just look up the next layer | def positioned where
self[where] ||= RenderNodeList.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genCurrentLayer\n end",
"def pos() @current end",
"def layer\n end",
"def next_position\n return unless placed?\n axis = case direction\n when 'east', 'west'; :x\n when 'north', 'south'; :y\n end\n amount = case direction\n when 'north', 'east'; +1\n when 'south', 'w... | [
"0.63079345",
"0.6115071",
"0.60625875",
"0.6040438",
"0.60102713",
"0.5881337",
"0.58314717",
"0.58314717",
"0.58314717",
"0.58314717",
"0.58055395",
"0.58055395",
"0.58055395",
"0.58055395",
"0.58055395",
"0.58055395",
"0.58055395",
"0.58055395",
"0.5787766",
"0.5718902",
"... | 0.0 | -1 |
Screen X Sets the current X location on the screen based on the map | def screen_x
unless Layy_Meta.active
return screen_x_mgc_lm_gtbs
else
return @actor.lm_x
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def screen_x; @screen_x; end",
"def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end",
"def screen_x\r\n ret = ((@real_x - self.map.display_x) / Game_Map::X_SUBPIXELS).round\r\n ret += @width * Game_Map::TILE_WIDTH / 2\r\n return ret\r\n end",
"def screen_x\n x = ((... | [
"0.75631875",
"0.7537916",
"0.75241035",
"0.75190467",
"0.75070184",
"0.7487343",
"0.7487343",
"0.7480265",
"0.7480265",
"0.718076",
"0.7103438",
"0.70352334",
"0.70233417",
"0.70133716",
"0.69258136",
"0.691569",
"0.68287754",
"0.6684793",
"0.66461635",
"0.660394",
"0.659855... | 0.7054181 | 11 |
Screen Y Sets the current Y location on the screen based on the map | def screen_y
unless Layy_Meta.active
return screen_y_mgc_lm_gtbs
else
y = @actor.lm_y_h0
y -= 40
if @actor.unit_size > 1
y += (@actor.unit_size - 1 << 4)
end
return y
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y=(y)\n @screen_y = y\n end",
"def screen_y\n tsbs_cam_screen_y - $tsbs_camera.adjust_y(self)\n end",
"def screen_y\n tsbs_cam_screen_y - $tsbs_camera.adjust_y(self)\n end",
"def screen_y\n y = (@real_y - $game_map.display_y + 3) / 4 \n return y \n end",
"def screen_y\n y = ((@rea... | [
"0.78063875",
"0.75788516",
"0.75788516",
"0.75215036",
"0.75097907",
"0.745702",
"0.745702",
"0.7451211",
"0.7282498",
"0.7252613",
"0.7230669",
"0.71310735",
"0.6966215",
"0.6964163",
"0.68924266",
"0.67831063",
"0.67809",
"0.67526823",
"0.66500986",
"0.65749246",
"0.654059... | 0.7414558 | 8 |
If data not synced in last 5 hours or force=true, gets data from PADMA and syncs it to local DB. Parameters: PADMA AccessToken boolean indicating to force sync | def sync_from_padma(padma,force=false)
synced = false
if force || self.synced_at.nil? || self.synced_at < 5.hours.ago
begin
padma_data = padma.person(self.padma_id)
if self.update_attributes(:name => padma_data["name"], :surname => padma_data["surname"])
self.synced_at = Time.now
synced = true
end
rescue
logger.warn("#{Time.now}: Person#sync_from_padma: error in connection with PADMA")
end
else
synced = true
end
return synced
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_all_data\n return if self.disabled?\n self.sync_availability\n self.sync_rate\n self.sync_stop_sell\n self.sync_min_stay\n\n if self.channel == GtaTravelChannel.first\n self.sync_gta_travel_cta\n self.sync_gta_travel_ctb\n else\n self.sync_cta if Constant::SUPPORT_CTA.i... | [
"0.5798462",
"0.5532852",
"0.5476382",
"0.5220297",
"0.5186223",
"0.5117777",
"0.5076487",
"0.50418055",
"0.5041325",
"0.5019324",
"0.50185496",
"0.50105387",
"0.50105387",
"0.50105387",
"0.49928927",
"0.4991401",
"0.49888912",
"0.49885374",
"0.49870452",
"0.4982986",
"0.4982... | 0.6861331 | 0 |
def add_span(text, keyword, start_tag, end_tag) | def job
a = "闻》4月27日报道】题:中国军机展开前所未有的威吓飞行 据多名政府高官26日透露,就在中国8艘海监船23日侵入尖阁诸岛(即我钓鱼岛及其附属岛屿——本网注)周边日本领海的同时,中国的战斗机等军用飞机在尖阁诸岛周边飞行超过40架次。 军用飞机多数是战斗机,中国投入了新型苏-27和苏-30。这些战斗机趁航空自卫队战斗机飞行员疲惫的时候蜂拥而至。政府高官称这是“前所未有的威吓”。 政府方面认为中国军机的威吓飞行是为了配合海监船侵入领海。 中国军机从上空对海上保安厅的防范态势和海上自卫队护卫舰、P-3C巡逻机的部署进行侦察,估计向海监船进行了通报。 23日上午7时23分至8时25分左右,8艘海监船相继进入尖阁周边海域。其中一艘逼近鱼钓岛(即我钓鱼岛——本网注)西北约一公里处。当日下午7时半左右,8艘海监船离开了日本领海。 在海监船侵入领海之际,中国的战斗机等军用飞机也开始朝尖阁周边飞去。这些飞机交替着逼近尖阁周边上空,每次逼近时航空自卫队那霸基地的F-15等战斗机就紧急出动。飞来的中国军机总共在40架次以上。 "
# a = "In the above outline, expression is a Ruby expression
# The ruby code here marker is where the code to executed
# the expression evaluates to false."
# xx <span>the</span> xx bbbb the xxxx the bb
# 0123456789012345678901234567890123456789
# a = "xx the xx bbbb the xxxx the bb"
kw = "中国"
# kw = "the"
r = /#{kw}/
marker = 0
t1 = "<span style='color: blue;'>"
t2 = "</span>"
counter = 0
maxnum = 3
logout("====================================")
logout("a=" + a)
logout("Span added=" + add_span(a, kw, t1, t2))
# puts "a=" + a
# puts
#
# puts add_span(a, kw, t1, t2)
# puts
# # 1
# puts "<1>"
#
# puts "r =~ a"
# puts r =~ a
#
# # 2
# puts "<2>"
# puts a
# while r =~ a[marker..(a.size - 1)] && counter < maxnum do
#
# puts "[Start while]========================"
#
# puts "marker=" + marker.to_s
#
# # point = (r =~ a)
# point = (r =~ a[marker..(a.size - 1)])
# puts "point=" + point.to_s
# puts
#
# puts "a=" + a
# puts
#
# puts "a[marker..(a.size - 1)]=" + a[marker..(a.size - 1)]
# puts
#
#
#
# a.insert(marker + point, t1)
# a.insert(marker + point + t1.size + r.source.size, t2)
# # a.insert(point, t1)
# # a.insert(point + t1.size + r.source.size, t2)
#
# puts "a=" + a
# puts
#
# marker += point + t1.size + r.source.size + t2.size
# # marker = point + t1.size + r.source.size + t2.size
# # marker = point + t1.size + r.source.size
# # marker = point
#
# counter += 1
#
# puts "marker=" + marker.to_s
# puts "point=" + point.to_s
# puts
#
# puts "[End while========================]"
#
# end
#
# puts a
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def span_wrap tag, text\n \"<span class='#{tag}' markdown='1'>#{text}</span>\"\nend",
"def html_span(*args, &block)\n html_tag(:span, *args, &block)\n end",
"def format_as_span_html(name, attr, body); end",
"def span_with_title(text)\n content_tag :span, title: text do\n text\n end\n end",
... | [
"0.702795",
"0.69319177",
"0.6724568",
"0.66759336",
"0.66759336",
"0.65158397",
"0.64552975",
"0.63632685",
"0.6302085",
"0.628342",
"0.62209713",
"0.6195095",
"0.6170267",
"0.6064057",
"0.60296166",
"0.60196847",
"0.60093296",
"0.59955406",
"0.5995381",
"0.5988443",
"0.5974... | 0.0 | -1 |
build tree from array | def build_tree(arr, root, i, n)
if i < n
root = TreeNode.new(arr[i])
root.left = build_tree(arr, root.left, i*2+1, n)
root.right = build_tree(arr, root.right, i*2+2, n)
end
return root
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_tree(array)\n\t\t@root = Node.new(array.shift)\n\t\tarray.each { |value| add_node(value, @root)}\n\tend",
"def build_tree(arr)\n\tend",
"def build_tree(arr)\n @root = Node.new(arr.shift)\n arr.each { |data| insert_data(data, @root) }\n end",
"def build_tree(array)\n\t\t@root = Node.new(array... | [
"0.86057156",
"0.85165983",
"0.84040254",
"0.8391386",
"0.83750826",
"0.83401537",
"0.8224935",
"0.81320846",
"0.8123406",
"0.81027377",
"0.8023418",
"0.7951766",
"0.79348284",
"0.79331744",
"0.7915232",
"0.7869783",
"0.7858945",
"0.781483",
"0.7796251",
"0.77889764",
"0.7684... | 0.71379757 | 32 |
compare two binary trees | def is_same_tree(p, q)
if (p == nil) ^ (q == nil)
return false
end
q1 = []
q2 = []
q1.push p
q2.push q
while q1 != [] and q2 != []
c1 = q1.shift
c2 = q2.shift
if c1 == nil and c2 == nil
elsif (c1 == nil) ^ (c2 == nil)
return false
elsif c1.val != c2.val
return false
else
q1.push c1.left
q1.push c1.right
q2.push c2.left
q2.push c2.right
end
end
if q1 != [] or q2 != []
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def == other_tree\n one = []\n two = []\n each { |node| one << node }\n other_tree.each { |node| two << node }\n one == two\n end",
"def compare(context, left, right)\n return compare_with_node_set(\n context, left.to_node_set(context), right) if left.node_set?\n ... | [
"0.7814123",
"0.7211366",
"0.71967345",
"0.70995384",
"0.70633525",
"0.70041776",
"0.69382703",
"0.6854889",
"0.6818086",
"0.6771166",
"0.6744196",
"0.66298336",
"0.6610846",
"0.6600611",
"0.6547926",
"0.65457284",
"0.6538425",
"0.653616",
"0.65256715",
"0.6521477",
"0.651863... | 0.6758474 | 10 |
Start a new game, which may be a tiebreak game. The player names are required to format the score in the case of an Advantage. | def initialize(player1, player2, tie_break: false)
super(win_minimum: tie_break ? TIE_BREAK_WIN_MINIMUM : WIN_MINIMUM)
@player1 = player1
@player2 = player2
@tie_break = tie_break
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_new_game\n # TODO: increment stats\n # stats = GameStats.new\n # stats.game_number += 1\n\n # create new player\n\n\n # print New game text\n new_game_banner = File.read('./old_code/fancy_text/new_game.txt')\n puts new_game_banner\n\n # display into story\n puts display_intro(@... | [
"0.7537951",
"0.73502266",
"0.7343412",
"0.71013904",
"0.70281893",
"0.6954063",
"0.69294804",
"0.6811147",
"0.67216974",
"0.67171115",
"0.66950506",
"0.66669005",
"0.6665699",
"0.6633244",
"0.65909183",
"0.6538834",
"0.6519781",
"0.64985114",
"0.64891493",
"0.64305335",
"0.6... | 0.0 | -1 |
Override the default score formatting. | def score
return nil if won?
return super if tie_break?
return 'Deuce' if deuce?
case advantage
when 1 then "Advantage #{player1}"
when 2 then "Advantage #{player2}"
else game_score
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_score\n self.score = GradingRule.format_score(self.course.id, self.score)\n if self.assignment_id < 0\n self.score = Grade.encrypt_score(self.score, self.course_id, self.student_id)\n end\n end",
"def pretty_score\n \"%3.1f%\" % (@score*100)\n end",
"def print_score io, name, scor... | [
"0.7320758",
"0.7124344",
"0.6878777",
"0.67858666",
"0.66075736",
"0.6569201",
"0.65206075",
"0.6489078",
"0.6456962",
"0.6433921",
"0.62399936",
"0.6165322",
"0.61575294",
"0.61141783",
"0.60961044",
"0.60907054",
"0.5997986",
"0.5970642",
"0.59552616",
"0.59552616",
"0.593... | 0.5804174 | 27 |
I really don't like that mixlibcli refers to the parsed command line flags in a hash accessed via the `config` method. Thats just such an overloaded word. | def parsed_options
config
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cli_prefix; end",
"def parse_cli\n require 'getoptlong'\n require 'rdoc/usage'\n \n opts = GetoptLong.new(\n [ '--help', '-h', GetoptLong::NO_ARGUMENT ],\n [ \"--quote-terms\", '-q', GetoptLong::NO_ARGUMENT ]\n )\n \nend",
"def with_cli(cli); end",
"def cli_options... | [
"0.7010983",
"0.6771786",
"0.6758213",
"0.64685583",
"0.64226407",
"0.6399148",
"0.6365787",
"0.63578457",
"0.6352077",
"0.62882257",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",
"0.6286378",... | 0.0 | -1 |
Cache the succeeded event. | def succeeded(event)
succeeded_events.push(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def succeeded(event)\n @mutex.synchronize do\n succeeded_events.push(event)\n end\n end",
"def succeeded(event)\n events.push(event)\n end",
"def succeeded(event)\n @mutex.synchronize do\n succeeded_events << event\n all_events << event\n end\n end",
"def succ... | [
"0.7677623",
"0.7355496",
"0.7353886",
"0.7346502",
"0.68146265",
"0.6356442",
"0.58608264",
"0.5813691",
"0.5767881",
"0.57310206",
"0.5689902",
"0.5567917",
"0.55511594",
"0.55457616",
"0.551028",
"0.5509834",
"0.5501518",
"0.5464734",
"0.54627556",
"0.54615116",
"0.5448748... | 0.75510865 | 1 |
Cache the started event. | def started(event)
started_events.push(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def started(event)\n @mutex.synchronize do\n started_events.push(event)\n end\n end",
"def started(event)\n @started_events.push(event)\n end",
"def started(event)\n @mutex.synchronize do\n started_events << event\n all_events << event\n end\n end",
"def start\n re... | [
"0.7337646",
"0.7322883",
"0.71834224",
"0.6802759",
"0.65969145",
"0.6510273",
"0.6494951",
"0.6447805",
"0.6189209",
"0.60979694",
"0.6081516",
"0.60784316",
"0.6063567",
"0.6036",
"0.60085154",
"0.59585315",
"0.59574145",
"0.59386545",
"0.59332573",
"0.5929779",
"0.5926084... | 0.73701376 | 0 |
Cache the failed event. | def failed(event)
failed_events.push(event)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed(event)\n @mutex.synchronize do\n failed_events.push(event)\n end\n end",
"def failed(event)\n @mutex.synchronize do\n failed_events << event\n all_events << event\n end\n end",
"def failed(event)\n @failed_events.push(event)\n end",
"def failed(event)\n ... | [
"0.76092064",
"0.7348111",
"0.7315766",
"0.64170396",
"0.6385523",
"0.6043832",
"0.6003843",
"0.58571315",
"0.58571315",
"0.58403665",
"0.5837028",
"0.58002687",
"0.5777695",
"0.57773566",
"0.5744803",
"0.5722837",
"0.5698774",
"0.56902885",
"0.56633794",
"0.56510365",
"0.564... | 0.7508979 | 1 |
Clear all cached events. | def clear_events!
@started_events = []
@succeeded_events = []
@failed_events = []
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_all!\n @events = {}\n end",
"def clear_events!\n @all_events = []\n @started_events = []\n @succeeded_events = []\n @failed_events = []\n @published_events = []\n self\n end",
"def reset\n @events = []\n end",
"def clear_events!\n @started_events = []\n @suc... | [
"0.86498165",
"0.792603",
"0.77270335",
"0.76606095",
"0.76287574",
"0.75246024",
"0.7498465",
"0.72869515",
"0.7023239",
"0.6963405",
"0.69175225",
"0.6873404",
"0.68605375",
"0.6814371",
"0.68115777",
"0.67835516",
"0.6781971",
"0.677086",
"0.67141366",
"0.67046946",
"0.670... | 0.7675278 | 3 |
GET /group_organizations GET /group_organizations.json | def index
@group_organizations = GroupOrganization.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = send_request(params)\n orgs = response.css('OrgList Org')\n\n results = {}\n orgs.each do |org|\n results[org['name']] = or... | [
"0.78811866",
"0.7567624",
"0.75661004",
"0.7549616",
"0.748486",
"0.7365013",
"0.7269155",
"0.7135571",
"0.71069527",
"0.71069527",
"0.70806634",
"0.70446914",
"0.7024454",
"0.69884455",
"0.6968838",
"0.6968838",
"0.6968838",
"0.6968838",
"0.6968838",
"0.6968838",
"0.6968838... | 0.7641271 | 1 |
GET /group_organizations/1 GET /group_organizations/1.json | def show
@country = Country.find_by_id(@group_organization.country_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetOrg id\n\n APICall(path: \"organizations/#{id}.json\")\n\n end",
"def index\n @group_organizations = GroupOrganization.all\n end",
"def get_organizations\n params = {\n 'method' => :get,\n 'command' => '/org'\n }\n\n response, headers = se... | [
"0.76576847",
"0.7567603",
"0.748603",
"0.73194593",
"0.72933036",
"0.72933036",
"0.7208719",
"0.72007054",
"0.71191347",
"0.70738983",
"0.70243907",
"0.7011273",
"0.70036584",
"0.6989267",
"0.6989267",
"0.6989267",
"0.6989267",
"0.6989267",
"0.6989267",
"0.6989267",
"0.69892... | 0.0 | -1 |
POST /group_organizations POST /group_organizations.json | def create
@group_organization = GroupOrganization.new(group_organization_params)
respond_to do |format|
if @group_organization.save
format.html { redirect_to @group_organization, notice: 'Group organization was successfully created.' }
format.json { render :show, status: :created, location: @group_organization }
else
format.html { render :new }
format.json { render json: @group_organization.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @organization = Organization.new(organization_params)\n respond_to do |format|\n if @organization.save && @organization.associate_user(current_user, ['admin'])\n User.add_user_to_group(@organization, ['admin'], params[:admin1_email], params[:admin1_first_name], params[:admin1_last_na... | [
"0.71761686",
"0.7011733",
"0.6876238",
"0.67209095",
"0.67001307",
"0.66781",
"0.6601112",
"0.65831023",
"0.6578897",
"0.6555939",
"0.6426483",
"0.64106554",
"0.6406637",
"0.64026386",
"0.63905084",
"0.638568",
"0.6384201",
"0.63814414",
"0.63814414",
"0.63814414",
"0.638144... | 0.72752905 | 0 |
PATCH/PUT /group_organizations/1 PATCH/PUT /group_organizations/1.json | def update
respond_to do |format|
if @group_organization.update(group_organization_params)
format.html { redirect_to @group_organization, notice: 'Group organization was successfully updated.' }
format.json { render :show, status: :ok, location: @group_organization }
else
format.html { render :edit }
format.json { render json: @group_organization.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateOrganization params = {}\n \n APICall(path: 'organizations.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @organization = Organization.find(params[:id])\n @organization.update_attributes(organization_params)\n \n respond_with(@organization, :... | [
"0.7246191",
"0.72059506",
"0.7047866",
"0.69760066",
"0.69581544",
"0.69580436",
"0.6930636",
"0.69212794",
"0.6891812",
"0.6840226",
"0.68334043",
"0.68080044",
"0.68075156",
"0.6803365",
"0.67896354",
"0.6777474",
"0.6769266",
"0.6766023",
"0.67510056",
"0.67450905",
"0.67... | 0.742623 | 0 |
DELETE /group_organizations/1 DELETE /group_organizations/1.json | def destroy
@group_organization.destroy
respond_to do |format|
format.html { redirect_to group_organizations_url, notice: 'Group organization was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteOrganization id\n \n APICall(path: \"organizations/#{id}.json\",method: 'DELETE')\n \n end",
"def destroy\r\n @agroup.destroy\r\n respond_to do |format|\r\n format.html { redirect_to agroups_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"de... | [
"0.7511533",
"0.74496514",
"0.7291477",
"0.7290109",
"0.72464514",
"0.7191493",
"0.7191493",
"0.7191493",
"0.7167352",
"0.71666217",
"0.71666217",
"0.7159422",
"0.7145042",
"0.70955086",
"0.70853806",
"0.70800805",
"0.70730305",
"0.70642555",
"0.7058875",
"0.7058875",
"0.7057... | 0.754826 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_group_organization
@group_organization = GroupOrganization.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def group_organization_params
params.require(:group_organization).permit(:name, :organization_code,
:country_id, :group_organization_ids,
:group_organization_id, :model_type, :base_price)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
GET /topickeys/1 GET /topickeys/1.json | def show
@topickey = Topickey.find(params[:id])
@members = Member.where("topics.topic_id"=>@topickey.topic_id)
respond_to do |format|
format.html # show.html.erb
format.json { render json: @topickey }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def GetTopic id\n\n APICall(path: \"topics/#{id}.json\")\n\n end",
"def index\n @api_v1_topics = Api::V1::Topic.all\n end",
"def new\n @topickey = Topickey.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @topickey }\n end\n end",
"d... | [
"0.67418426",
"0.65874916",
"0.6339352",
"0.6338475",
"0.6334439",
"0.6270059",
"0.6216908",
"0.6216908",
"0.6216908",
"0.6179243",
"0.6148045",
"0.6143337",
"0.6123112",
"0.6123112",
"0.6123112",
"0.6123112",
"0.60910356",
"0.6052419",
"0.60513484",
"0.60509914",
"0.604835",... | 0.68723714 | 0 |
GET /topickeys/new GET /topickeys/new.json | def new
@topickey = Topickey.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @topickey }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @topickey = Topickey.new(params[:topickey])\n\n respond_to do |format|\n if @topickey.save\n format.html { redirect_to @topickey, notice: 'Topickey was successfully created.' }\n format.json { render json: @topickey, status: :created, location: @topickey }\n else\n ... | [
"0.7025945",
"0.6982397",
"0.6858261",
"0.6814961",
"0.68147284",
"0.68147284",
"0.68147284",
"0.68147284",
"0.68147284",
"0.67381066",
"0.6613789",
"0.6415737",
"0.6386532",
"0.6359731",
"0.6358836",
"0.63369954",
"0.63343924",
"0.6334062",
"0.63295305",
"0.63134265",
"0.626... | 0.79792947 | 0 |
POST /topickeys POST /topickeys.json | def create
@topickey = Topickey.new(params[:topickey])
respond_to do |format|
if @topickey.save
format.html { redirect_to @topickey, notice: 'Topickey was successfully created.' }
format.json { render json: @topickey, status: :created, location: @topickey }
else
format.html { render action: "new" }
format.json { render json: @topickey.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def CreateTopic params = {}\n \n APICall(path: 'topics.json',method: 'POST',payload: params.to_json)\n \n end",
"def create_topic payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post TOPICS, payload )\n\t\t\t\tend",
"def create\n @topic = current_user.topics.... | [
"0.64431864",
"0.62452215",
"0.5844279",
"0.58243793",
"0.58110493",
"0.57802254",
"0.5774556",
"0.5755638",
"0.5737804",
"0.5737804",
"0.56737983",
"0.5638645",
"0.5634324",
"0.55914843",
"0.5580257",
"0.55656195",
"0.55561614",
"0.554902",
"0.5548325",
"0.55392426",
"0.5517... | 0.6864939 | 0 |
PUT /topickeys/1 PUT /topickeys/1.json | def update
@topickey = Topickey.find(params[:id])
respond_to do |format|
if @topickey.update_attributes(params[:topickey])
format.html { redirect_to @topickey, notice: 'Topickey was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @topickey.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateTopic id,params = {}\n \n APICall(path: \"topics/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n @topic.update_attributes!(topic_params)\n json_response(@topic)\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.upd... | [
"0.695002",
"0.6822162",
"0.67278546",
"0.65101916",
"0.6492901",
"0.64304084",
"0.6385974",
"0.6382053",
"0.6307877",
"0.62509364",
"0.6201307",
"0.6155088",
"0.6101655",
"0.6100185",
"0.60995513",
"0.6099421",
"0.60830015",
"0.60815525",
"0.60815525",
"0.60815525",
"0.60815... | 0.7037723 | 0 |
DELETE /topickeys/1 DELETE /topickeys/1.json | def destroy
@topickey = Topickey.find(params[:id])
@topickey.destroy
respond_to do |format|
format.html { redirect_to topickeys_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteTopic id\n \n APICall(path: \"topics/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n if args.length != 2\n error \"Kafka name and topic required\"\n end\n name, urls = attachment(args)\n delete_topic(urls, args.last)\n display(\"Deleting topic #{arg... | [
"0.7428565",
"0.7203991",
"0.70384693",
"0.7018197",
"0.6929315",
"0.6916085",
"0.68802303",
"0.6847589",
"0.6835083",
"0.6833302",
"0.6825938",
"0.67951435",
"0.67951435",
"0.67951435",
"0.67951435",
"0.67951435",
"0.67951435",
"0.6792258",
"0.67850107",
"0.67755634",
"0.677... | 0.78403634 | 0 |
TODO: use require 'json'; JSON.parse; zepto get | def hashes_convert(array)
Array.new(array).map do |elem|
Hash.new elem
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_get(url)\n get url, :parse=>true\n end",
"def get_json( url )\n JSON.parse( get_url( url ){ |f| f.read } )\nend",
"def _convertJSON() \n js=\"\"\n \tbegin\n gem \"json\"\n\t\t js = JSON.parse(self.response)\n rescue\n puts \"Error during JSON. #{$!}\"\n ... | [
"0.7036257",
"0.68912894",
"0.68680483",
"0.6794637",
"0.6599798",
"0.6587653",
"0.6587653",
"0.6575609",
"0.6563969",
"0.64943653",
"0.64914685",
"0.63393015",
"0.63393015",
"0.6282259",
"0.6216067",
"0.6212554",
"0.61995596",
"0.6132327",
"0.6092413",
"0.607892",
"0.6066097... | 0.0 | -1 |
filters out flash not mapped to bootstrap classes | def flash_filter(flash)
flash.select { |k, _v| FLASH_TO_BOOTSTRAP_MAP.keys.include? k.to_sym }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bootstrap_flash_tag\n return if flash.blank?\n css_mapping = {notice: 'success', alert: 'danger', info: 'info'}\n [:notice, :alert, :info].select{|type| flash[type].present?}.inject(\"\") do |result, type|\n inner_html = content_tag(:a, \"x\", class: \"close\", :'data-dismiss' => 'alert', href: \... | [
"0.70265895",
"0.692459",
"0.6899875",
"0.67705345",
"0.6727417",
"0.66975933",
"0.65736836",
"0.65632814",
"0.6460863",
"0.64243096",
"0.64186734",
"0.64097863",
"0.6302947",
"0.6293178",
"0.6278248",
"0.62741554",
"0.6270874",
"0.6270016",
"0.62622046",
"0.6255059",
"0.6224... | 0.7675716 | 0 |
`Artistcreate_painting` Given the arguments of `title`, `price` and `gallery`, creates a new painting belonging to that artist | def create_painting(title, price, gallery)
Painting.new(title, price, gallery, self)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_painting(title, price, gallery) #(title, price, artist, gallery)\n Painting.new(title, price, self, gallery)\n end",
"def create_painting(title, price, gallery)\n Painting.new(title, price, self, gallery)\n end",
"def create_painting(title, price, gallery)\n Painting.new(title, price, sel... | [
"0.8418235",
"0.80365574",
"0.80365574",
"0.80365574",
"0.8008549",
"0.7949092",
"0.7713084",
"0.72265726",
"0.6885409",
"0.611855",
"0.5977028",
"0.58528525",
"0.5817534",
"0.5628799",
"0.5597639",
"0.5588164",
"0.5513482",
"0.54753166",
"0.54230165",
"0.53128177",
"0.531003... | 0.79744154 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.