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
Approve a particular Store in the database
def approve_store_app(uid) Store.unlock.where(uid: uid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n begin\n accept = params[:accept].eql?('true')\n st = StoreTransaction.where(id: params[:request_id], store: current_user.stores.find(params[:store_id])).first\n if accept\n st.status = 1\n st.store.owner = st.requester\n st.store.save!\n else\n st.st...
[ "0.65584135", "0.65475833", "0.65280986", "0.6248958", "0.61926055", "0.61558306", "0.61183625", "0.6085756", "0.6069497", "0.60578406", "0.60577106", "0.6045045", "0.604113", "0.60335875", "0.60078955", "0.59879804", "0.59736264", "0.5972359", "0.5959627", "0.59538823", "0.5...
0.6592211
0
Reject a particular Store in the database
def reject_store_app(uid) Store.lock.where(uid: uid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reject\n self[:status] = \"Reject\"\n save\n end", "def reject_offer\n @auction = @current_user.auctions.find(params[:auction_id])\n @offer = @auction.offers.find(params[:offer_id])\n Alert.transaction do\n Alert.offer_to_reject_response!(@offer, @decision)\n if @decision\n ...
[ "0.62324977", "0.6155242", "0.59718937", "0.5971266", "0.595649", "0.5921772", "0.5840953", "0.5774094", "0.5736666", "0.5736666", "0.57346123", "0.57309073", "0.571686", "0.571686", "0.57054085", "0.5700467", "0.56686306", "0.5590971", "0.55640686", "0.55594414", "0.55526054...
0.6388437
0
Edit a particular Store in the database
def edit_store(edited_store) store = Store.find(edited_store.uid) store.attributes = edited_store.attributes store.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t\t\t @store = Store.find(params[:id])\n\n\t\t\t\t respond_to do |format|\n\t\t\t\t if @store.update_attributes(params[:store])\n\t\t\t\t\tformat.html { redirect_to @store, notice: 'Store was successfully updated.' }\n\t\t\t\t\tformat.json { head :no_content }\n\t\t\t\t else\n\t\t\t\...
[ "0.7630424", "0.7570387", "0.753359", "0.75034577", "0.74710655", "0.74640095", "0.74640095", "0.74640095", "0.74640095", "0.74589825", "0.74499995", "0.74494755", "0.7435615", "0.71426547", "0.7111787", "0.7111787", "0.71071357", "0.70999485", "0.70999485", "0.70999485", "0....
0.83347523
0
Delete a particular Store in the database
def delete_store(uid) store = Store.find(uid) store.delete! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @store.destroy\n redirect_to store_path, notice: \"store destroyed.\"\n end", "def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n if @store.destroyed?\n flash[:notice] = \"El almacen fue eliminado.\"\n redirect_to stores_path\n else\n flash[:warnin...
[ "0.787363", "0.7869649", "0.78203076", "0.7595794", "0.75738734", "0.75329024", "0.7502063", "0.7495493", "0.7469896", "0.7456329", "0.74345654", "0.74345654", "0.74345654", "0.74345654", "0.74328136", "0.74072427", "0.7378357", "0.733771", "0.7279009", "0.7279009", "0.727900...
0.7872565
1
Create a new User in the database
def create_user(name, email, password) # Password is hashed automatically user = User.new(name: name, email: email, password: password) user.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user\n User.create name: \"test\", email: \"test@example.com\", password: \"123456\"\n end", "def create\n\t\t\t\t@user = User.create!(create_user_params)\n\t\t\tend", "def create_user\n User.create name: 'test', email: 'test@example.com', password: '123456'\n end", "def create_use...
[ "0.82827437", "0.82550865", "0.8250606", "0.80635464", "0.8017084", "0.7909887", "0.7801407", "0.77754986", "0.7733913", "0.7733913", "0.7733564", "0.7732228", "0.772994", "0.77292323", "0.7729019", "0.77122927", "0.77013797", "0.7692896", "0.7692896", "0.7683531", "0.7680831...
0.79190993
5
Edit a User in the database
def edit_user(edited_user) user = User.find(edited_user.email) user.attributes = edited_user.attributes user.save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def edit\n # loads user from th...
[ "0.82974344", "0.8265234", "0.8246112", "0.8167307", "0.8166744", "0.8166744", "0.8166744", "0.8166744", "0.812911", "0.80982524", "0.80982524", "0.80937004", "0.80937004", "0.80921304", "0.80813485", "0.8062237", "0.80555034", "0.80549896", "0.8046673", "0.80171055", "0.8013...
0.7616486
76
Delete a particular User in the database
def delete_user(user_email) user = User.all.where(email: user_email) user.delete! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user\n client.delete(user)\n end", "def delete_user(id)\n @user = User.destroy(id)\n end", "def destroy(user)\n unless user.id\n self.class.invalid_object!(\"Cannot save user #{user.username} without a valid id\")\n end\n\n unless execute_sql(:valida...
[ "0.84923565", "0.83225894", "0.82545865", "0.8222498", "0.81965995", "0.817622", "0.8161376", "0.8089328", "0.8053631", "0.80528075", "0.80528075", "0.8042526", "0.79831606", "0.7947526", "0.7941018", "0.79282117", "0.79037184", "0.7887739", "0.7882867", "0.78773665", "0.7843...
0.77848023
31
vai pegar os componentes e as quantidade de cada produto/componente
def iterando_nos_componente_enviados quantidade = params[:produto_quantidade] i = 1 for i in quantidade.to_i do @componentesenviados << Produto.all(params[:exibeformcomponente_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_produits_used\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * (p.quantite - p.stock) }\n sum\n end", "def sum_produits_assoc\n # TODO URGENT facture 46 la valeur renvoyee est fausse\n sum = 0\n # logger.error \"facture : #{self.id}\"\n self.protofactures.each do |p| \...
[ "0.6829691", "0.65202075", "0.63435733", "0.63397264", "0.6316852", "0.6309619", "0.6217147", "0.61361855", "0.6131325", "0.6002625", "0.60023963", "0.59801996", "0.59752125", "0.597436", "0.59686685", "0.59464395", "0.5934944", "0.5916231", "0.5909422", "0.5890826", "0.58889...
0.7346988
0
parameters has been used
def address_params params.permit(:company, :address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def param; end", "def param; end", "def get_parameters; end", "def get_parameters; end", "def params; end",...
[ "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.7270058", "0.6769667", "0.6769667", "0.6641361", "0.6641361", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "0.6633327", "...
0.0
-1
the credentials.json file that Firebase provides has newlines embedded in the private_key value these need to become real newlines in the database
def replace_newlines(s) (s || "").gsub('\n', "\n") # single quoted strings in Ruby are literals, double quoted are escaped end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private_key; end", "def private_key; end", "def key_pem; end", "def encode_secrets(data)\n data[:credentials] = Base64.encode64(data[:credentials]) if data[:credentials]\n data['credentials'] = Base64.encode64(data['credentials']) if data['credentials']\n data\n end", ...
[ "0.5791224", "0.5791224", "0.57139206", "0.57085174", "0.56565887", "0.56399906", "0.5605948", "0.5580012", "0.5580012", "0.5571749", "0.5546464", "0.5534472", "0.5531251", "0.54332507", "0.5401355", "0.5356815", "0.53346014", "0.53215516", "0.5311636", "0.52885395", "0.52724...
0.0
-1
GET /backend/conf_activities GET /backend/conf_activities.json
def index @backend_conf_activities = Conf::Activity.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activities\n get_call(\"1/activities.json\")\n end", "def activities(params = {})\n scope 'default'\n get('activities/', params)\n end", "def activities(options={})\n response = connection.get do |req|\n req.url \"activities\", options\n end\n return_error_or_body...
[ "0.75542724", "0.68641347", "0.6809054", "0.66842586", "0.6663225", "0.6663225", "0.6567038", "0.63987267", "0.63709867", "0.63617444", "0.6338498", "0.6294427", "0.6257422", "0.6244506", "0.62327194", "0.6232272", "0.62228", "0.6211288", "0.6186235", "0.6180784", "0.61680305...
0.79817796
0
GET /backend/conf_activities/1 GET /backend/conf_activities/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @backend_conf_activities = Conf::Activity.all\n end", "def activities\n get_call(\"1/activities.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def activity(id)\n get(\"/activities/#{id}.json\")\n end", "def set_backend_conf_activity\n ...
[ "0.7706899", "0.7218805", "0.6850805", "0.6850805", "0.65292907", "0.6494476", "0.6490101", "0.64245725", "0.6351569", "0.63404524", "0.62851685", "0.62740874", "0.6252528", "0.62339854", "0.61476827", "0.61410487", "0.6127833", "0.61059123", "0.60932356", "0.608994", "0.6083...
0.0
-1
POST /backend/conf_activities POST /backend/conf_activities.json
def create @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params) respond_to do |format| if @backend_conf_activity.save format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' } format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) } else format.html { render :new } format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end", "def index\n @backend_conf_activities = Conf::Activity.all\n end", "def activities=(value)\n @activities = value\n end", ...
[ "0.6811024", "0.6766937", "0.63630164", "0.6263741", "0.6192873", "0.6184391", "0.60916066", "0.60900486", "0.6074553", "0.60535264", "0.59931517", "0.59700567", "0.5950243", "0.59490144", "0.5913923", "0.586265", "0.58443826", "0.5834276", "0.5823087", "0.5748127", "0.573898...
0.73101914
0
PATCH/PUT /backend/conf_activities/1 PATCH/PUT /backend/conf_activities/1.json
def update respond_to do |format| if @backend_conf_activity.update(backend_conf_activity_params) format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' } format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) } else format.html { render :edit } format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.6343709", "0.6178252", "0.61266", "0.6083994", "0.6046057", "0.59535855", "0.5950184", "0.5949612", "0.5922814", "0.58745855", "0.5852685", "0.58491933", "0.58481866", "0.5836546", "0.5828746", "0.5822278", "0.5822278", "0.5822278", "0.5822278", "0.5822278", "0.5818107", ...
0.7072661
0
DELETE /backend/conf_activities/1 DELETE /backend/conf_activities/1.json
def destroy @backend_conf_activity.destroy respond_to do |format| format.html { redirect_to backend_conf_activities_url, notice: 'Conf activity was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def destroy\n @conf = Con...
[ "0.6913661", "0.67800796", "0.67069674", "0.6680008", "0.66371924", "0.65827173", "0.65827173", "0.65827173", "0.65827173", "0.65827173", "0.6514017", "0.65045214", "0.64559835", "0.6423752", "0.6423752", "0.6419196", "0.64056045", "0.64056045", "0.64015996", "0.63698447", "0...
0.7667125
0
Use callbacks to share common setup or constraints between actions.
def set_backend_conf_activity @backend_conf_activity = Conf::Activity.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def backend_conf_activity_params params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
Override to ensure compatibility with Tree::TreeNode.
def term self.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_node=(_); end", "def child_node; end", "def get_tree_adaptor\n raise NotImplementedError\n end", "def for_node; end", "def tree\r\n @rootNode\r\n end", "def parsed_tree; end", "def root_node; end", "def leaf?; false end", "def tree\n Tree.new(self)\n end", "d...
[ "0.64129406", "0.63605046", "0.63375276", "0.6200004", "0.61469805", "0.6072916", "0.6034564", "0.603018", "0.60122037", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768",...
0.0
-1
Override to ensure compatibility with Tree::TreeNode.
def term_name self.content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_node=(_); end", "def child_node; end", "def get_tree_adaptor\n raise NotImplementedError\n end", "def for_node; end", "def tree\r\n @rootNode\r\n end", "def parsed_tree; end", "def root_node; end", "def leaf?; false end", "def tree\n Tree.new(self)\n end", "d...
[ "0.64129406", "0.63605046", "0.63375276", "0.6200004", "0.61469805", "0.6072916", "0.6034564", "0.603018", "0.60122037", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768", "0.5981768",...
0.0
-1
Returns an array of the parents of this term.
def parentage get_parents unless @already_fetched_parents @already_fetched_parents = true super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parents\n @parents ||= parent ? parent.parents + Array(parent) : []\n end", "def get_parents\n return @parents\n end", "def ancestors\n parents = []\n\n this_parent = self.parent\n\n while this_parent != nil\n parents << this_parent\n this_pare...
[ "0.7702646", "0.76784796", "0.7666384", "0.7637204", "0.7487671", "0.74422425", "0.7316737", "0.7316485", "0.72727317", "0.7235021", "0.722944", "0.7174065", "0.7155565", "0.7148483", "0.7139109", "0.7110975", "0.70872486", "0.7056806", "0.70553386", "0.70390075", "0.70279646...
0.0
-1
Returns the children of this term as a tree. Will include the current term as the 'root' of the tree.
def child_tree child_check child_tree = self.clone child_tree.removeFromParent! child_tree end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree\n return [self] if @children.empty?\n\n @children.each_with_object([self]) do |child, tree|\n tree.concat(child.tree)\n end\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_na...
[ "0.7477105", "0.6980335", "0.6952803", "0.6952803", "0.69264483", "0.68283695", "0.67265224", "0.66345876", "0.66075677", "0.6587981", "0.6529466", "0.65288013", "0.6493495", "0.64042854", "0.6400683", "0.6369082", "0.6340871", "0.63233024", "0.63094026", "0.6305005", "0.6299...
0.56411684
79
Returns an array of the direct children of this term.
def children child_check super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def children\n Array.new\n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def get_children\n ret...
[ "0.7708992", "0.74148446", "0.74059296", "0.74059296", "0.73882806", "0.7384135", "0.7378472", "0.72532994", "0.7248968", "0.7248968", "0.72476405", "0.72332263", "0.7197464", "0.7197464", "0.7197464", "0.7196735", "0.71606714", "0.7094202", "0.7089693", "0.70896477", "0.7055...
0.0
-1
Returns a flat array containing all the possible child terms for this given ontology term
def all_child_terms get_all_child_lists return @all_child_terms end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_te...
[ "0.71345043", "0.70961", "0.65151185", "0.62965214", "0.61568606", "0.6139526", "0.61349463", "0.61024165", "0.6081994", "0.60605055", "0.60132635", "0.6008063", "0.60002565", "0.59987664", "0.59987664", "0.59987664", "0.59980315", "0.59953696", "0.59926134", "0.5988252", "0....
0.7743936
0
Returns a flat array containing all the possible child term names for this given ontology term
def all_child_names get_all_child_lists return @all_child_names end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_...
[ "0.7035232", "0.65570384", "0.648097", "0.642691", "0.6403646", "0.6261387", "0.6214521", "0.620101", "0.6112723", "0.604649", "0.6018305", "0.6001394", "0.59830844", "0.5955058", "0.59232795", "0.59232795", "0.59232795", "0.5882703", "0.58734363", "0.5861731", "0.5852528", ...
0.626335
5
Helper function to query the OLS database and grab the full details of the ontology term.
def get_term_details # This query ensures we look at the most recent fully loaded ontologies sql = <<-SQL select term.* from term join ontology on ontology.ontology_id = term.ontology_id where term.identifier = ? order by ontology.fully_loaded desc, ontology.load_date asc SQL term_set = OLS_DB[ sql, @name ].all() if term_set.size == 0 get_term_from_synonym else subject = term_set.first @content = subject[:term_name] @term_pk = subject[:term_pk] @ontology_id = subject[:ontology_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_term_from_synonym\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n join term_synonym on term.term_pk = term_synonym.term_pk\n where term_synonym.synonym_value = ?\n order by ontology.fully_loaded desc, ontology.load_dat...
[ "0.68499243", "0.6329367", "0.6329367", "0.62658453", "0.62274903", "0.61576813", "0.6092739", "0.59762514", "0.5881532", "0.58179694", "0.5768398", "0.57119757", "0.5704081", "0.5704081", "0.5675916", "0.5651722", "0.55973685", "0.5560954", "0.5536284", "0.5526757", "0.54803...
0.8191284
0
Helper function to try to find an ontology term via a synonym.
def get_term_from_synonym sql = <<-SQL select term.* from term join ontology on ontology.ontology_id = term.ontology_id join term_synonym on term.term_pk = term_synonym.term_pk where term_synonym.synonym_value = ? order by ontology.fully_loaded desc, ontology.load_date asc SQL term_set = OLS_DB[ sql, @name ].all() raise OntologyTermNotFoundError, "Unable to find the term '#{@name}' in the OLS database." \ if term_set.size == 0 subject = term_set.first @name = subject[:identifier] @content = subject[:term_name] @term_pk = subject[:term_pk] @ontology_id = subject[:ontology_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_synonyms(synonyms)\n return self.find_helper(@start_node, synonyms)\n end", "def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end", "def find_glossary_term!\n @glossary_term = find...
[ "0.63477594", "0.6241856", "0.59999985", "0.5946214", "0.588208", "0.584254", "0.5829018", "0.57326806", "0.5687308", "0.5675328", "0.5636151", "0.5636151", "0.56210554", "0.5585503", "0.55471754", "0.5498107", "0.5492347", "0.5476299", "0.54601806", "0.5453996", "0.5452583",...
0.73792243
0
Recursive function to query the OLS database and collect all of
def get_parents( node=self ) sql = <<-SQL select subject_term.identifier as child_identifier, subject_term.term_name as child_term, predicate_term.term_name as relation, object_term.identifier as parent_identifier, object_term.term_name as parent_term from term_relationship tr join term as subject_term on tr.subject_term_pk = subject_term.term_pk join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk join term as object_term on tr.object_term_pk = object_term.term_pk where predicate_term.term_name in ('part_of','is_a','develops_from') and subject_term.identifier = ? SQL OLS_DB[ sql, node.term ].each do |row| parent = OntologyTerm.new( row[:parent_identifier], row[:parent_term] ) parent << node get_parents( parent ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all\n \n end", "def find_all_parents\n end", "def recurse_result_set(result, options = {}, &block)\n return result unless block_given? \n inner_recursion = options.delete(:inner_recursion)\n result_set = inner_recursion ? result : result.dup\n \...
[ "0.583575", "0.57899743", "0.5709545", "0.56984794", "0.56750304", "0.5670683", "0.5655277", "0.561711", "0.5610376", "0.55660915", "0.5563774", "0.55381554", "0.5502065", "0.5495922", "0.54824597", "0.54707813", "0.546622", "0.5464629", "0.54591435", "0.5455437", "0.54546404...
0.0
-1
Recursive function to query the OLS database and collect all of the child objects and build up a tree of OntologyTerm's.
def get_children( node=self ) sql = <<-SQL select subject_term.identifier as child_identifier, subject_term.term_name as child_term, predicate_term.term_name as relation, object_term.identifier as parent_identifier, object_term.term_name as parent_term from term_relationship tr join term as subject_term on tr.subject_term_pk = subject_term.term_pk join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk join term as object_term on tr.object_term_pk = object_term.term_pk where predicate_term.term_name in ('part_of','is_a','develops_from') and object_term.identifier = ? SQL OLS_DB[sql,node.term].each do |row| child = OntologyTerm.new( row[:child_identifier], row[:child_term] ) node << child end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n ...
[ "0.644452", "0.6351324", "0.57664204", "0.564825", "0.56353563", "0.56243473", "0.56204253", "0.5588224", "0.55802494", "0.5546854", "0.5520916", "0.54795843", "0.5453274", "0.5447956", "0.54171306", "0.53714335", "0.5342707", "0.5337988", "0.53153515", "0.5310372", "0.528808...
0.6723604
0
Helper function to check whether the children have already been found or not.
def child_check if @children.nil? or @children.empty? get_children unless @already_fetched_children @already_fetched_children = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def have_children?\n children.count != 0\n end", "def children_exist?\n\tend", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n !children.empty?\n end", "def check_if_has_children\n self.lookups.count == 0\n ...
[ "0.7792547", "0.7750983", "0.77417713", "0.77417713", "0.7729542", "0.7724229", "0.7707363", "0.7707363", "0.76941514", "0.76941514", "0.76425475", "0.7638289", "0.7638289", "0.7638289", "0.7638289", "0.7638189", "0.7626998", "0.7626998", "0.7626998", "0.7626998", "0.76057714...
0.8091491
0
Helper function to produce the flat lists of all the child terms and names.
def get_all_child_lists child_check if @all_child_terms.nil? and @all_child_names.nil? @all_child_terms = [] @all_child_names = [] self.children.each do |child| @all_child_terms.push( child.term ) @all_child_terms.push( child.all_child_terms ) @all_child_names.push( child.term_name ) @all_child_names.push( child.all_child_names ) end @all_child_terms = @all_child_terms.flatten.uniq @all_child_names = @all_child_names.flatten.uniq end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end", "def all_child_names\n get_all_child_lists\n return @all_child_names\n end", "def children_names; @children.keys; end", "def descendent_names\n self_and_descendents.map(&:name).flatten \n end", "def get_child_nam...
[ "0.7798765", "0.710421", "0.66812056", "0.6411084", "0.6400847", "0.63181674", "0.6286913", "0.6132601", "0.6062827", "0.605796", "0.60351855", "0.60266215", "0.5994999", "0.59936947", "0.5935", "0.5894351", "0.5881827", "0.5881827", "0.5877281", "0.58642775", "0.5859277", ...
0.79793257
0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Write message vbs script on host
def write_msg_to_target(message) print_status("Writting message script on host...") location = session.sys.config.getenv('TEMP') msgvbs = "#{location}\\messenger.vbs" mg = @client.fs.file.new(msgvbs, "wb") mg.write("msgbox(\"#{message}\")") mg.close return msgvbs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message(text)\n end", "def send_message(msg); end", "def send_message(message, wparam = 0, lparam = 0)\n with_handle { User32.SendMessage(@handle, User32::EditMessage[message], wparam, lparam) }\n end", "def send_message(message); end", "def send_message(message); end", "def remote_ms...
[ "0.57655805", "0.5720912", "0.5712792", "0.56096125", "0.56096125", "0.545295", "0.5438206", "0.5435702", "0.5426623", "0.5412409", "0.5395258", "0.53720206", "0.5353252", "0.5350981", "0.5300604", "0.52930784", "0.52925056", "0.5282761", "0.5280771", "0.52484435", "0.5237092...
0.8221114
0
characters when determining whether it should uppercase or lowercase each letter. The nonalphabetic characters should still be included in the return value; they just don't count when toggling the desired case.
def staggered_case(str) # moving to new string capital_letter = true new_str = '' str.each_char do |letter| if letter =~ /[^a-z]/i new_str << letter else capital_letter ? letter.upcase! : letter.downcase! new_str << letter capital_letter = !capital_letter end end new_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letters_only(case_matters=false)\n just_letters = split('').find_all do |char| \n DUAL_CASE_ALPHABET.include?(char) \n end.join('')\n return just_letters if (case_matters)\n return just_letters.downcase\n end", "def destructive_uppercase(str)\n upcase_only = \"\"\n str.each_char do |char|...
[ "0.7205663", "0.70656484", "0.7018733", "0.6968633", "0.6950401", "0.6932238", "0.68766975", "0.6848055", "0.67992973", "0.6795128", "0.6786035", "0.6773397", "0.6771247", "0.676461", "0.67575693", "0.6754278", "0.67424095", "0.67363924", "0.668742", "0.66725236", "0.6662644"...
0.6355261
63
Override answered? to ensure last answer was not the user resetting the selection to the default unselected state.
def answered? if answers.length == 0 return false end if answers.last.rationale_choices.size > 0 # # The last answer is a list containing only one item, and it # does not contain a key for :choice_id. This is the answer we # generated in the case of unselecting a previous selection. # I.e. user is resetting to the default unselected state. # {:answer=>"not answered"} # return true end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end", "def selected?; false; end", "def selected?; false; end", "def touch_multi_choice_answer\n touch if question_type == \"MultiChoiceQuestion\"\n end", "def answered?\n return @...
[ "0.61158395", "0.6039257", "0.6039257", "0.58651316", "0.58648473", "0.58588004", "0.58179134", "0.58179134", "0.5811476", "0.5802728", "0.5781643", "0.57788855", "0.5752496", "0.5738389", "0.57280004", "0.5725222", "0.57241035", "0.5646508", "0.56231046", "0.55913544", "0.55...
0.7103728
0
TODO: We shouldn't need to special case this. But we do. We should use saveable.rbanswer, but because we are sending an array of answers, it doesn't work.
def answer if answered? answers.last.answer else [{:answer => "not answered"}] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n ...
[ "0.6771099", "0.6771099", "0.64499485", "0.64402765", "0.63951606", "0.63804525", "0.63658524", "0.6356687", "0.6273625", "0.62662", "0.6231626", "0.6191971", "0.61853206", "0.6155456", "0.61478585", "0.61211216", "0.60808533", "0.60705227", "0.60419357", "0.6037303", "0.6034...
0.66345304
2
TODO_IMP: Prevent delete if it has active enrollments TODO: Can add calendar year leaves and working days for the firm and can calculate end_date accordingly TODO: Ensure end_date > start_date
def seats_available? (capacity - total_enrollments) > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_range_integrity\n super\n\n # TODO: remove this after tie-in to Settings\n return\n\n open_enrollment_term_maximum = Settings.aca.shop_market.open_enrollment.maximum_length.months.months\n if open_enrollment_term.end > (open_enrollment_term.begin + open_enrollment_term_maximum)\n ...
[ "0.64424163", "0.627514", "0.59605473", "0.58377886", "0.5809442", "0.5705934", "0.56759226", "0.56735575", "0.5672888", "0.56650317", "0.5657773", "0.56558424", "0.56329674", "0.56061536", "0.55992657", "0.5579513", "0.55788326", "0.5573325", "0.5560626", "0.5548161", "0.554...
0.0
-1
Este test estaba antes cuando habia objetos que salian de new y objetos que salian de new_mock Podriamos borrarlo
def testear_que_no_se_ensucia_la_clase_mockeada PersonalHome.mockear(:cantidad_personas) do 100 end respuesta = PersonalHome.new.cantidad_personas respuesta.deberia ser 100 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_object\n sut.send(:new)\n end", "def test_new_creates_something\n @response = MnemeAPIResponse.new(@@empty_response)\n refute_nil @response, \"get object\"\n refute_nil @@testFileDir, \"locate test file directory\"\n end", "def stubs_create()\n Usuario.stub!(:find_by_ci).with(an...
[ "0.6939625", "0.6667902", "0.66436285", "0.6628323", "0.65261674", "0.63150376", "0.630806", "0.626953", "0.6257717", "0.62574464", "0.62503266", "0.62450635", "0.62436575", "0.6164831", "0.60916495", "0.6090912", "0.608212", "0.60414183", "0.60354203", "0.60279787", "0.60143...
0.6634959
3
Displays some text while you do something in the background
def infobox(msg, title, height = 5, width = 40) @dialog.title = "\"#{title}\"" @dialog.infobox("\n" + msg, height, width) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n @viewport.visible = true\n while Core::LOCK.locked?\n Graphics.update\n @text.text = @texts[Graphics.frame_count % 60 / 20] if Graphics.frame_count % 20 == 0\n end\n @viewport.visible = false\n end", "def display_message!(*lines)\n display_message(*lines)\n ...
[ "0.68535686", "0.6686648", "0.64565796", "0.6444821", "0.6435856", "0.640916", "0.6366326", "0.6363932", "0.63607085", "0.6243724", "0.62209135", "0.61815363", "0.61815363", "0.61255866", "0.6111053", "0.60937893", "0.60768354", "0.6071271", "0.6024081", "0.6017232", "0.60111...
0.0
-1
Shows a list of options and lets the user choose one
def choose(choices, title) res = @dialog.menu(title, choices) raise CancelPressed.new unless res res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def choose_from_list(question, list)\n ui.choose_from_list question, list\n end", "def present_menu_options\n space(1)\n puts \"Choose an option from the list below.\"\n space(1)\n puts '1. Search for events by city'\n puts '2. Search for events by artist or sports team'\n puts '3. See what...
[ "0.7181122", "0.7048328", "0.70123655", "0.6892284", "0.68794775", "0.68792945", "0.6852025", "0.6832611", "0.6800041", "0.6772683", "0.6688377", "0.6677057", "0.6598785", "0.656241", "0.6561706", "0.65510786", "0.6516383", "0.6504605", "0.6499889", "0.6499889", "0.64774376",...
0.0
-1
read and write accessors
def initialize(name, city, year_built) @name = name @city = city @year_built = year_built @renovated_on = year_built end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getters; end", "def read\n raise NotImplementedError\n end", "def read\n end", "def read\n _read\n end", "def read\n end", "def read\n end", "def read\n end", "def read\n end", "def read\nend", "def value_read; end", "def name\n return @name\nend\ndef age\n...
[ "0.7230983", "0.7070723", "0.6883437", "0.68400717", "0.6785759", "0.6785759", "0.6785759", "0.6785759", "0.6716437", "0.6714612", "0.6668406", "0.6667101", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6536095", "0.6423896", "0.63686836", ...
0.0
-1
num1 the first integer num2 the second integer num3 the third integer Examples max_of_three(2, 100, 1000) => 1000 Returns the biggest integer
def max_of_three(num1, num2, num3) return num1 if num1 > num2 && num1 > num3 return num2 if num2 > num3 && num2 > num1 return num3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_of_three num1, num2, num3\n\tif num1 > num2 && num1 > num3\n\t\treturn num1\n\telsif num2 > num1 && num2 > num3\n\t\treturn num2\n\telsif num3 > num1 && num3 > num2\n\t\treturn num3\n\tend\n\nend", "def max_of_three(num1, num2, num3)\n\t[num1, num2, num3].max\nend", "def max_of_three(num1, num2, num3)\...
[ "0.85609585", "0.85447156", "0.85396665", "0.85310704", "0.84949017", "0.8492857", "0.8464573", "0.8419367", "0.84154755", "0.8301388", "0.8269331", "0.8266856", "0.8255911", "0.82335585", "0.82212365", "0.8211843", "0.80714935", "0.8038424", "0.7952443", "0.7951491", "0.7883...
0.83335364
9
List all user targets that will be integrated by this target.
def user_targets return [] unless user_project user_target_uuids.map do |uuid| native_target = user_project.objects_by_uuid[uuid] unless native_target raise Informative, '[Bug] Unable to find the target with ' \ "the `#{uuid}` UUID for the `#{self}` integration library" end native_target end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_targets = UserTarget.all\n end", "def index\n @targets = current_user.targets\n end", "def users(target = nil)\n raw \"USERS #{target}\".strip << \"\\r\\n\"\n end", "def users(target = nil)\n send_data(\"USERS #{target}\".strip)\n end", "def index\n @tar...
[ "0.7615049", "0.7416185", "0.6919222", "0.6696222", "0.6306515", "0.6306515", "0.6306515", "0.63005334", "0.621244", "0.61536354", "0.61269253", "0.61269253", "0.60750526", "0.598214", "0.5953391", "0.5932337", "0.5873388", "0.58462155", "0.58194304", "0.58006716", "0.5792154...
0.7030201
2
PATCH/PUT /inspirations/1 def update
def destroy @inspiration.destroy render json: @inspiration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @inspiration = current_user.inspirations.find(params[:id])\n\n respond_to do |format|\n if @inspiration.update_attributes(params[:inspiration])\n format.html { redirect_to @inspiration.discussion, notice: 'Inspiration was successfully updated.' }\n format.json { head :no_conte...
[ "0.79453176", "0.7823965", "0.76066864", "0.7356654", "0.73026735", "0.7299989", "0.72535944", "0.72444135", "0.71837467", "0.7160196", "0.7158514", "0.7155997", "0.7074445", "0.70742553", "0.70698965", "0.70228326", "0.70124054", "0.7006653", "0.69982404", "0.69954044", "0.6...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_inspiration @inspiration = Inspiration.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 inspiration_params params.require(:inspiration).permit(:name, :image, :bio) 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 /types/1 GET /types/1.json
def show @amenity = Amenity.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @amenity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @types = Type.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @types.lookup(params[:q]) }\n end\n end", "def show\n if params[:term]\n @types = Type.all(:conditions => ['typeName LIKE ?', \"%#{params[:term]}%\"])\n else\n ...
[ "0.72724575", "0.7179091", "0.70928717", "0.70529896", "0.6886975", "0.6706508", "0.67046696", "0.66510755", "0.66487914", "0.6635179", "0.6635179", "0.66211784", "0.65380293", "0.6525202", "0.6501756", "0.6492074", "0.64882994", "0.6473578", "0.6469021", "0.6463662", "0.6447...
0.0
-1
GET /types/new GET /types/new.json
def new @amenity = Amenity.new respond_to do |format| format.html # new.html.erb format.json { render json: @amenity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "def new\n @resource_type = ResourceType.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type ...
[ "0.8200252", "0.7512469", "0.7484872", "0.7386359", "0.73646295", "0.7362049", "0.73583746", "0.7338448", "0.733121", "0.72833586", "0.72791624", "0.7273098", "0.7257026", "0.7222662", "0.722143", "0.72157836", "0.7185158", "0.7178197", "0.7156113", "0.71510834", "0.71470594"...
0.0
-1
POST /types POST /types.json
def create @amenity = Amenity.new(params[:amenity]) respond_to do |format| if @amenity.save format.html { redirect_to admin_amenity_path(@amenity), notice: 'Amenity was successfully created.' } format.json { render json: @amenity, status: :created, location: @amenity } else format.html { render action: "new" } format.json { render json: @amenity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_params\n params.from_jsonapi.require(:type).permit(:name)\n end", "def type_params\n params.require(:type).permit( :name)\n end", "def create\n @type = Type.new(type_params)\n\n unless @type.save\n render json: @type.errors, status: :unprocessable_entity\n end\n \n end", "d...
[ "0.70687604", "0.65884984", "0.6485644", "0.6473384", "0.6444047", "0.63409996", "0.62612855", "0.6230885", "0.6230885", "0.6212527", "0.61901176", "0.61901176", "0.6152289", "0.61110187", "0.6088263", "0.60799885", "0.6067926", "0.60175115", "0.60133713", "0.5963181", "0.595...
0.0
-1
PUT /types/1 PUT /types/1.json
def update @amenity = Type.find(params[:id]) respond_to do |format| if @amenity.update_attributes(params[:amenity]) format.html { redirect_to admin_type_path(@amenity), notice: 'Amenity was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @amenity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @type.update(type_params)\n end", "def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend", "def update\n\n raw = params[:sample_type]\n st = SampleType.find(raw[:id])\n\n st.name = raw[:name]\n st.description = raw[:description...
[ "0.702886", "0.6754036", "0.6523385", "0.6511128", "0.6425218", "0.6421935", "0.63793814", "0.63169396", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0.63160795", "0....
0.0
-1
DELETE /types/1 DELETE /types/1.json
def destroy @amenity = Amenity.find(params[:id]) @amenity.destroy respond_to do |format| format.html { redirect_to admin_amenities_path } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @type = Type.find(params[:type])\n @type.destroy\n\n respond_to do |format|\n format...
[ "0.78185445", "0.7513149", "0.7322236", "0.72992426", "0.7278669", "0.72307587", "0.7223803", "0.7213007", "0.7174043", "0.71335095", "0.71222985", "0.7102784", "0.70760554", "0.7071828", "0.70706236", "0.70596737", "0.704018", "0.70385766", "0.70241827", "0.702307", "0.70219...
0.0
-1
session :cookie_only => false, :only => :create skip_before_filter :verify_authenticity_token, :only => :create GET /photos/1
def show respond_to do |format| format.html { @photo.generate unless @photo.exists? } format.jpg { render_preview(@photo) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\r\n @photo = Photo.new(photo_params)\r\n @photo.user_id = session[:user_id]\r\n \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\r\n format.json { render :show, status: :created, locati...
[ "0.69820505", "0.6901483", "0.6852008", "0.6849862", "0.6749465", "0.665687", "0.64933723", "0.63232327", "0.62779933", "0.625796", "0.6257223", "0.62233466", "0.6170239", "0.613528", "0.6090918", "0.6083519", "0.6066089", "0.6050406", "0.60330397", "0.60315967", "0.6014808",...
0.0
-1
helps fixing upload issues for Safari browser
def closekeepalive response.headers['Connection'] = 'Close' render :text => '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_do_multifile_upload?\n modern_browser?(browser) && !browser.ie?(9)\n end", "def upload_simple\r\n \r\n end", "def client_side_multipart_upload\n end", "def file_uploads; end", "def multipart_upload\n end", "def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",...
[ "0.6423877", "0.60319906", "0.60127217", "0.59622204", "0.59221905", "0.588879", "0.58406985", "0.5809589", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57784325", "0.57713974", "0.57693595", "0.57651883", "0.5750233", "0.57424724", "0.5724193", "0...
0.0
-1
GET /ocorrencias GET /ocorrencias.json
def index @ocorrencias = Ocorrencia.all respond_to do |format| format.csv { send_data @ocorrencias.to_csv} format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n \treclamos = Reclamo.all\n \trende...
[ "0.74326205", "0.70911896", "0.70768183", "0.70362973", "0.70298326", "0.7007676", "0.69892937", "0.69334525", "0.69301605", "0.6886616", "0.68755674", "0.686979", "0.68683445", "0.68623996", "0.6858598", "0.68554425", "0.68530595", "0.68424433", "0.68257844", "0.68129665", "...
0.0
-1
GET /ocorrencias/1 GET /ocorrencias/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end", "def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end", "def index\n @cooperativas = Cooperativa.where...
[ "0.7362442", "0.7185649", "0.710891", "0.7103471", "0.7003312", "0.69888955", "0.69806415", "0.6957386", "0.6915646", "0.69155365", "0.6861175", "0.683773", "0.6825988", "0.682492", "0.6810571", "0.6803706", "0.6803706", "0.6798686", "0.67902774", "0.6784676", "0.67611396", ...
0.0
-1
POST /ocorrencias POST /ocorrencias.json
def create @ocorrencia = Ocorrencia.new(ocorrencia_params) respond_to do |format| if @ocorrencia.save format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully created.' } format.json { render action: 'show', status: :created, location: @ocorrencia } else format.html { render action: 'new' } format.json { render json: @ocorrencia.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def create\n @ocupacion = Ocupacion.new(ocupacion_params)\n\n respond_to do |...
[ "0.69658506", "0.64515084", "0.64445317", "0.6438216", "0.6412335", "0.638665", "0.63558", "0.63437164", "0.63252586", "0.6308761", "0.6301593", "0.6300208", "0.62985927", "0.6287717", "0.62838745", "0.626511", "0.62568045", "0.62283695", "0.6221246", "0.6209818", "0.62061137...
0.66312194
1
PATCH/PUT /ocorrencias/1 PATCH/PUT /ocorrencias/1.json
def update respond_to do |format| if @ocorrencia.update(ocorrencia_params) format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @ocorrencia.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redire...
[ "0.65316164", "0.6483392", "0.6450348", "0.64107937", "0.6378865", "0.6342928", "0.63359034", "0.63143235", "0.63059163", "0.6296044", "0.6295954", "0.62866074", "0.6278884", "0.62715554", "0.62698233", "0.6269008", "0.62531286", "0.6251403", "0.6248422", "0.624783", "0.62463...
0.6542112
0
DELETE /ocorrencias/1 DELETE /ocorrencias/1.json
def destroy @ocorrencia.destroy respond_to do |format| format.html { redirect_to ocorrencias_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @cargo_e...
[ "0.7249877", "0.7197048", "0.707396", "0.703247", "0.7018129", "0.70179844", "0.6993409", "0.6984617", "0.69833076", "0.6981152", "0.69762295", "0.6974523", "0.69669443", "0.6953194", "0.69510543", "0.6944849", "0.69321", "0.6928049", "0.69276994", "0.69267946", "0.6922505", ...
0.71945083
2
Use callbacks to share common setup or constraints between actions.
def set_ocorrencia @ocorrencia = Ocorrencia.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ocorrencia_params params.require(:ocorrencia).permit(:ocolocal, :ocostatus, :ocomunicipio, :ocosentido, :ocodataocorrencia, :ocodataregistro, :ocotipo, :ococomid, :ocoidorigem, :ococpfretif, :ococpfretif) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
This method is used to get the exact number of days in a month, ex: it gives 29 days as output for the february month in a leap year
def daysinmonth(year, month) return (Date.new(year, 12, 31) << (12-month)).day end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def days_in_month\n raw = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][self.month]\n self.month == 2 && leap_year? ? raw + 1 : raw\n end", "def count_of_days_in(month)\n 28 + (month + (month / 8)) % 2 + 2 % month + 2 * (1 / month)\nend", "def days_in_month(month, year = current...
[ "0.84366363", "0.8279695", "0.8269624", "0.8151693", "0.80753505", "0.8057325", "0.8049237", "0.7999014", "0.79909474", "0.79909474", "0.7967224", "0.79505646", "0.78664964", "0.786536", "0.7844537", "0.78081536", "0.7693863", "0.7686297", "0.7633689", "0.7578224", "0.7499859...
0.7213328
30
This method is used to construct query based on the parameter receives from the controller.
def generate_query(*args) #generate_query starts here begin @tablename=args[0].split('-')[0] @duration=args[0].split('-')[1] @report_type=args[1] @column1=args[2] @column2=args[3] @startdate=args[4] @enddate=args[5] @order=args[6] @limit=args[7] @column3=args[8] @page=(args[9]!=nil) ? args[9] : 0 #~ @start_year= Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[0] if @startdate!=nil #selects only year #~ @start_day=Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[2] if @startdate!=nil#selects only day #~ @start_month=Time.parse(@startdate).strftime("%Y-%m-%d").split('-')[1] if @startdate!=nil #~ @end_year=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[0] if @enddate!=nil #~ @end_month=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[1] if @enddate!=nil #~ @end_day=Time.parse(@enddate).strftime("%Y-%m-%d").split('-')[2] if @enddate!=nil #~ @ctr="((sum(clicks)/sum(impressions))*100)"#if @report_type!="Overall_Performance" #~ @ecpm='((sum(revenue)/sum(impressions))*1000)' #~ customize_column= @column3=='campaign_name' ? 'c.campaign_name' : @column3=='pub_name' ? 'p.publisher_name' : @column3=='advertiser_name' ? 'a.name' : '' #~ customize_table=@column3=='campaign_name' ? 'campaigns_summaries cs, campaigns c' : @column3=='pub_name' ? 'adclients_summaries ad,publishers p' : @column3=='advertiser_name' ? 'campaigns_summaries cs,advertisers a' : '' #~ customize_condition=@column3=='campaign_name' ? 'c.id=cs.campaign_id' : @column3=='pub_name' ? 'p.id=ad.pub_id' : @column3=='advertiser_name' ? 'a.id=cs.advertiser_id' : '' #~ customize_filter=@column3=='campaign_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : @column3=='pub_name' ? 'and (ad.impressions>0 or ad.clicks>0)' : @column3=='advertiser_name' ? 'and (cs.impressions>0 or cs.clicks>0)' : '' #~ begin #~ # ---- Query Builder ---- #~ sub_query="select count(*) as count from #{@tablename}" #~ sub_query+=" where delivery_date>='#{(Time.parse(@startdate)).strftime("%Y-%m-%d")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime("%Y-%m-%d")} 23:59:59'" #~ #sub_query+="and #{@column1}!='ip' and #{@column1}!=''" #~ obj=@column3=='pub_name' ? 'ad.' :'cs.' #~ sql_query ="select #{customize_column} as #{@column3} , (#{(@column2=='ctr') ? @ctr : @column2=='ecpm' ? @ecpm : "sum(#{obj}#{@column2})"}) as #{@column2=='amount_spent' ? 'amt_spent' :@column2} from #{customize_table}" #~ sql_query+=" where delivery_date>='#{(Time.parse(@startdate)).strftime("%Y-%m-%d")} 00:00:00' and delivery_date<='#{(Time.parse(@enddate)).strftime("%Y-%m-%d")} 23:59:59' and #{customize_condition} #{customize_filter}" #~ sql_query+=" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} limit #{@limit} offset #{@page}" if @report_type!="Overall_Performance" #~ sql_query+=" group by #{@column1} order by #{@column2=='amount_spent' ? 'amt_spent' :@column2} #{@order} " if @report_type=="Overall_Performance" #~ #following code is used to calculate modulas value if applicable #~ @add_month=0 #~ @no_day=(@end_day.to_i-@start_day.to_i)+1 #~ if @end_year.to_i!=@start_year.to_i #~ @add_month=@end_month.to_i+12 #~ @add_month=@add_month.to_i-@start_month.to_i #~ @no_day+=(@add_month*30) #~ elsif @end_month.to_i>@start_month.to_i #~ @add_month=@end_month.to_i-@start_month.to_i #~ @no_day+=(@add_month*30) #~ end #~ @modulas=@no_day/30 #~ @XML_xaxis='days' #~ @@date_count=Time.parse(@startdate) #~ rescue Exception=>e #~ puts "DEBUGGER :: Error:: in admin_xml_builder.rb - generate_query ::#{e.to_s}" #~ end @XML_xaxis='days' begin #~ @tablename=AdminCampaignWiseReport.show_data() #convert the string into model name #~ @tablename=@tablename.classify.constantize #convert the string into model name #~ @recordset=@tablename.find_by_sql(sql_query) # fetch the recordset from table @recordset=AdminCampaignWiseReport.top_campaigns_performance(@order,@startdate,@enddate) # fetch the recordset from table rescue Exception=>e puts "DEBUGGER :: ERROR :: in admin_xml_builder.rb - generate_query :: #{e.to_s}" end @anchor_color="anchorBgColor='FF0000'" count=0 othersValue=0.00 if @recordset.size !=0 #main If conditons starts here for recordset in @recordset #Check whether publisher request click or impression or revenuereport i=1 if args[3]!='imp vs clicks' #~ puts "-------------check 1---------" #~ generate_mutil_linechartXML(recordset.impressions,recordset.clicks,recordset.delivery_date,@startdate,@enddate,'Impression Vs Clicks',@no_day,@duration) #~ else count+=1 if (count.to_i<=@limit.to_i) #~ puts "-------------check 2----#{@report_type}-----" generate_piechartXML(recordset[@column3],recordset[@column2]) else othersValue+=recordset[@column2].to_f if (@recordset.size.to_i==count.to_i) generate_piechartXML('Others',othersValue) end end i+=1 end end #for loop ends here #to insert xml datas for which recordset are not available #~ if @report_type=='admin_campaign_wise_reports' and args[3].to_s!='imp vs clicks' #~ puts "-------------check 3---------" #~ if Time.parse(@enddate)>@@date_count #~ while Time.parse(@enddate)>=@@date_count #~ delivery_day=@@date_count.strftime("%Y-%m-%d").split('-')[2] #will return day #~ if Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0' #{@anchor_color if @duration.to_i==1}/>" #~ elsif delivery_day.to_i%@modulas==0 #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0'/>" #~ end #~ @@date_count+=86400 #~ end #~ elsif Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set name='#{@@date_count.strftime("%d-%b-%Y")}' value='0' #{@anchor_color if @duration.to_i==1}/>" #~ end #~ @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ #to insert xml datas for impression vs click if recordsets are not available for specified date #~ elsif @report_type=='admin_campaign_wise_reports' && args[3].to_s=='imp vs clicks' #~ puts "-------------check 1-1--------" #~ if Time.parse(@enddate)>@@date_count #~ while Time.parse(@enddate)>=@@date_count #~ delivery_day=@@date_count.strftime("%Y-%m-%d").split('-')[2] #will return day #~ if Time.parse(@enddate)==@@date_count #~ @@strXML+= "<set value='0' #{@anchor_color if @duration.to_i==1}/>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0' #{@anchor_color if @duration.to_i==1}/>" #~ elsif delivery_day.to_i%@modulas==0 #~ @@strXML+= "<set value='0'/>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0'/>" #~ end #~ @@date_count+=86400 #~ end #~ elsif Time.parse(@enddate)==@@date_count #~ puts "-------------check 1--2-------" #~ @@strXML+= "<set value='0'/ #{@anchor_color if @duration.to_i==1}>" #~ @@cat_strXML+="<category label='#{@@date_count.strftime("%d-%b-%Y")}'/>" #~ @@multi_strXML+="<set value='0'/ #{@anchor_color if @duration.to_i==1}>" #~ end #~ @@multi_strXML+="</dataset>" #~ @@cat_strXML+="</categories>" #~ @@strXML+="</dataset>" #~ @@strXML+=@@cat_strXML #~ @@strXML+=@@multi_strXML #~ p @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ end #~ if @report_type=='Traffic' #~ @@strXML+="</data>" #~ @@strXML+="<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>" #~ end #~ if @report_type=='Ad_Wise' and args[5]=='imp vs clicks' #~ puts "-------------check 12---------" #~ @@multi_strXML+="</dataset>" #~ @@cat_strXML+="</categories>" #~ @@strXML+="</dataset>" #~ @@strXML+=@@cat_strXML #~ @@strXML+=@@multi_strXML #~ @@strXML+="<styles><definition><style name='myLabelsFont' type='font' font='Arial' size='12' color='000000' bold='1'/></definition><application><apply toObject='DataLabels' styles='myLabelsFont' /></application></styles>" #~ end #~ if @report_type=='Traffic_Continent' #~ puts "-------------check 14---------" #~ @@strXML+='</data>' #~ @@strXML+="<colorRange><color minValue='0' maxValue='#{(@@date_count-1).to_s}' displayValue='Low' color='F0FFE8' /><color minValue='#{(@@date_count.to_i-1).to_s}' maxValue='#{(@@date_count.to_i+1).to_s}' displayValue='High' color='009900' /></colorRange></map>" #~ end #~ if @report_type=='Keyword' #~ puts "-------------check 1-6--------" #~ @@strXML+="<styles><definition><style name='myValuesFont' type='font' size='16' color='000000' bold='1' font='Arial, Helvetica, sans-serif' /></definition><application><apply toObject='DataLabels' styles='myValuesFont' /></application></styles>" #~ end @@strXML = @@strXML + "</chart>" end #main If ends here #reinitialize flag, str variable and counters to construct next chart @@flag=true #~ @@xml_count=0 #~ @@date_count=0 @@color_count=0 @@mod=0 @returnstrXML=@@strXML @@strXML='' @@cat_strXML='' @@multi_strXML='' @@xml_hash=nil @@xml_hash={:xml_string=>@returnstrXML } return @@xml_hash rescue Exception=>e puts "DEBUGGER :: ERROR :: in admin_xml_builder under generate_query method. The error is #{e.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def query ; @request.params ; end", "def retrieve_query\n if params[:set_filter] or !session[:query] or session[:query].project_id\n # Give it a name, required to be valid\n @query = Query.new(:name => \"_\", :executed_by => logged_in_user)\n if params[:fields] and params[:fields].is_a? Array\n...
[ "0.73308015", "0.6921461", "0.6907983", "0.6833503", "0.6820729", "0.6759445", "0.6717917", "0.67046714", "0.67030483", "0.66915774", "0.66683924", "0.66377103", "0.6634972", "0.6631745", "0.6623846", "0.65966046", "0.65668494", "0.6553683", "0.65521044", "0.6530581", "0.6508...
0.0
-1
generate_query ends here this method is used to construct xml structure based on the recordset retrived from the database this method is used to construct xml structure for piechart
def generate_piechartXML(*args) begin @color_hash=Hash.new @color_hash={"0"=>"0C95BF","1"=>"12C400","2"=>"ECB800","3"=>"EB2300","4"=>"70808F","5"=>"000000","6"=>"800080","7"=>"FFFF00","8"=>"7FFFD4","9"=>"0377CA","10"=>"15C2F7"} if @@flag==true #~ @@strXML = "<chart decimals='2' defaultAnimation='0' use3DLighting='0' showPlotBorder='1' showShadow='0' plotGradientColor='0' showLabels='1' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showValues='0' baseFontSize='12' isSliced='1' enableSmartLabels='1' bgColor='FFFFFF' showBorder='0' plotBorderThickness='0' startingAngle='80' canvasBorderColor ='cccccc' canvasBorderAlpha='0' canvasBorderThickness='0' showPercentageValues='1' pieRadious='100'>" if args[2]=='Device_Summary' or args[2]=="Carrier_Traffic" puts "hello" p @@strXML = "<chart decimals='2' defaultAnimation='0' use3DLighting='0' showPlotBorder='1' showShadow='0' plotGradientColor='0' showLabels='1' chartTopMargin='0' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='0' showValues='0' baseFontSize='12' isSliced='1' enableSmartLabels='1' bgColor='FFFFFF' showBorder='0' plotBorderThickness='0' startingAngle='80' canvasBorderColor ='cccccc' canvasBorderAlpha='0' canvasBorderThickness='0' showPercentageValues='1' pieRadious='100'>" #~ @@strXML = "<chart decimals='2' yAxisName='#{args[3].to_s=='ecpm' ? 'eCPM' : (args[3].to_s).upcase}' divLineColor='CCCCCC' numDivLines='2' alternateHGridColor='FFFFFF' anchorBorderColor='FFFFFF' defaultAnimation='0' use3DLighting='0' alternateVGridColor='FFFFFF' showPlotBorder='0' showShadow='0' plotGradientColor='' showLabels='1' chartTopMargin='10' chartLeftMargin='0' chartRightMargin='0' chartBottomMargin='10' showValues='0' canvasBorderColor ='FFFFFF' formatNumberScale='0' canvasBorderAlpha='0' canvasBorderThickness='0' pieRadious='100' baseFontSize='12' showBorder='0' plotBorderThickness='0' bgColor='FFFFFF' showPercentageValues='1' > " if args[3]=='ctr' || args[3]=='ecpm' @@flag=false end colour=@color_hash["#{@@color_count}"] limit = (args[3]=='ctr' || args[3]=='ecpm') ? 10 : 15 args[0]=(args[0]=='' || args[0]==nil) ? 'could not detect' : args[0] puts "---------------------34----------" p @@strXML=@@strXML+ "<set label='#{args[0]!=nil ? (truncate(args[0].split("'")[0].to_s,limit)).gsub(/([&%])/) do|s| @@getsymbol["#{s}"] end : 'NA' }' value='#{args[1].to_s}' color='#{(args[0].to_s=='Others') ? '000000' : colour.to_s}' />" if args[3]!='ctr' and args[2]!='URL' and args[3]!='ecpm' puts "---------------------35----------" #~ @@strXML+="<set label='#{args[0].to_s.gsub(/([&%])/) do|s| @@getsymbol["#{s}"] end}' value='#{args[1].to_s}' color='176D94'/>" if args[3]=='ctr' || args[3]=='ecpm' @@color_count+=1 rescue Exception=>e puts "DEBUGGER :: ERROR :: in AdminXmlBuilder Component under generate_piechartXML method. The Error is #{e.to_s}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_query_data(*args) #generate_query starts here\n begin\n @@XML_array=Array.new\n @pub_id=(args[0].split('-')[0]).to_i\n chk_filled=args[0].split('-')[1]\n @tablename=args[1]\n @report_type=args[2]\n @colu...
[ "0.6754907", "0.6137059", "0.60106975", "0.59371805", "0.5914314", "0.5776672", "0.5766882", "0.57645017", "0.57356685", "0.5694288", "0.5690197", "0.56722575", "0.562298", "0.56084913", "0.55933535", "0.54660743", "0.54639256", "0.545879", "0.54495037", "0.5425777", "0.54054...
0.57169294
9
stage the file git add make a commit push to a github repo
def check_number(num) if num.include?('.') num.to_f.to_s == num else num.to_i.to_s == num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def git_add_commit_push(host, branch, message, git_repo_path)\n git_add_everything(host, git_repo_path)\n git_commit_push(host, branch, message, git_repo_path)\nend", "def commit_to_git\n puts `git add .`\n puts `git commit -a -m \"New poshts for the syhtt\"`\n puts `git push blahg master`\n ...
[ "0.74996376", "0.7490692", "0.7366128", "0.73059666", "0.71267414", "0.70548695", "0.6877391", "0.686325", "0.68610436", "0.68302304", "0.68216634", "0.67689955", "0.67466503", "0.6706065", "0.66989535", "0.66948366", "0.66817766", "0.6666706", "0.66021025", "0.6581492", "0.6...
0.0
-1
Blank fields become empty strings instead of nil.
def add_converter_for_blank_fields CSV::Converters[:blank] = lambda { |s| s || '' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_blank_strings\n attributes.each do |column, value|\n self[column] = nil if value.is_a? String and value.blank?\n end\n end", "def blank_out_fields(record, fields)\n fields.to_a.each do |field|\n record[field.to_sym] = '' if record[field.to_sym].nil?\n end\n record\n end",...
[ "0.7942835", "0.77611476", "0.76865566", "0.7645719", "0.76156867", "0.7399313", "0.7228484", "0.7165962", "0.70984197", "0.70372784", "0.7016981", "0.70122755", "0.7003285", "0.6976444", "0.6932037", "0.6801326", "0.67795086", "0.6760287", "0.67593765", "0.67562544", "0.6695...
0.6936711
14
GET /discounts GET /discounts.json
def index @discounts = Discount.where(pricing_id: params[:id]).order(id: :desc) @pricings=Pricing.find(params[:id]) @discount_types=DiscountType.all @catalog_items=Catalog.where(pricing_id: params[:id],checked: true) @groups=Group.where(pricing_id: params[:id]) @resolution=ItemList.all # puts @catalog_items.as_json @array=@catalog_items.uniq.pluck(:item_list_id) @array1=@catalog_items.where(catalog_type: 'Custom').uniq.pluck(:id) puts @array @list_item_id_array = @array.sort{|a,b| a && b ? a <=> b : a ? -1 : 1 } # puts @list_item_id_array @discount_offer_types=DiscountOfferType.all @discount=Discount.new @discount_offers=DiscountOffer.all @discount_items_lists=DiscountItemsList.all @discount_groups_list=DiscountGroupsList.all @discount_bsgs_buy_items=DiscountBsgsBuyItem.all @discount_bsgs_get_items=DiscountBsgsGetItem.all @discount_cart_values=DiscountCartValue.all @package_discounts=PackageDiscount.where(discount_id: @discount.id) @package_discount_items=PackageDiscountItem.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "def discounts\n @discounts ||= hash[\"Discounts\"].map { |d| Merchan...
[ "0.6943867", "0.6804143", "0.66406983", "0.66127586", "0.6571965", "0.65084803", "0.6392808", "0.62904954", "0.62101614", "0.60305476", "0.60305476", "0.6023197", "0.5987936", "0.5928853", "0.5880489", "0.586941", "0.5851978", "0.5851745", "0.5842813", "0.58024865", "0.579885...
0.0
-1
GET /discounts/1 GET /discounts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @store = Store.find(params[:store_id])\n @dish_discounts = @store.dish_discounts\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dish_discounts }\n end\n end", "def show\n @store = Store.find(params[:store_id])\n @dish_discount = @s...
[ "0.6976709", "0.69058627", "0.65602225", "0.6406121", "0.6363159", "0.6363159", "0.636101", "0.63553894", "0.6326514", "0.6303807", "0.6245139", "0.61564684", "0.6110368", "0.60298824", "0.59950197", "0.59456486", "0.5896851", "0.58931494", "0.58792484", "0.5869454", "0.58681...
0.0
-1
POST /discounts POST /discounts.json
def create @discount = Discount.new(discount_params) respond_to do |format| if @discount.save format.html { redirect_to @discount, notice: 'Discount was successfully created.' } format.json { render :show, status: :created, location: @discount } else format.html { render :new } format.json { render json: @discount.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @discount = Discount.new(params[:discount])\n\n respond_to do |format|\n if @discount.save\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully created.' }\n format.json { render json: @discount, status: :created, location: @discount }\n...
[ "0.6922074", "0.6826182", "0.6560772", "0.6477866", "0.6321534", "0.6138121", "0.6131779", "0.61306036", "0.61306036", "0.605085", "0.59038067", "0.5888664", "0.58489597", "0.5839619", "0.58395773", "0.58288944", "0.58156484", "0.5805577", "0.5802414", "0.5782759", "0.5760846...
0.68092644
2
PATCH/PUT /discounts/1 PATCH/PUT /discounts/1.json
def update respond_to do |format| if @discount.update(discount_params) format.html { redirect_to @discount, notice: 'Discount was successfully updated.' } format.json { render :show, status: :ok, location: @discount } else format.html { render :edit } format.json { render json: @discount.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @discount = Discount.find(params[:id])\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to @discount, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { ren...
[ "0.6797258", "0.6556416", "0.6543301", "0.63482124", "0.6324844", "0.6278978", "0.6264766", "0.6238197", "0.62347627", "0.61171615", "0.6073157", "0.606955", "0.6064991", "0.60589355", "0.60543275", "0.60539436", "0.60486466", "0.6045954", "0.6045203", "0.60366195", "0.599912...
0.6473997
3
DELETE /discounts/1 DELETE /discounts/1.json
def destroy @pricing_id=@discount.pricing_id @discount.destroy respond_to do |format| format.html { redirect_to discounts_url(id: @pricing_id), notice: 'Discount was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_discounts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @discount = Discount.find(params[:id])\n @discount.destroy\n\...
[ "0.7449483", "0.7434036", "0.7138962", "0.7128333", "0.7004147", "0.692219", "0.6820708", "0.67317945", "0.67166585", "0.6705001", "0.6704677", "0.66711086", "0.66711086", "0.66711086", "0.66711086", "0.6670657", "0.66672397", "0.66533476", "0.66445726", "0.6643081", "0.66430...
0.68796676
6
Use callbacks to share common setup or constraints between actions.
def set_discount @discount = Discount.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def discount_params params.fetch(:discount, {}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
options :name :sleep timeout between spawns :log_file :sync_log :working_dir for log :after_fork
def initialize(opts = {}, &block) @opts = opts @block = block @opts[:sync_log] ||= true raise "block should be" unless block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_fork(options = {})\n return unless needs_after_fork_work?\n\n ::NewRelic::Agent.logger.debug(\"Starting the worker thread in #{Process.pid} (parent #{Process.ppid}) after forking.\")\n\n channel_id = options[:report_to_channel]\n install_pipe_service(channel_id) if cha...
[ "0.5993114", "0.58441323", "0.58128995", "0.5793069", "0.5731116", "0.5711288", "0.56880176", "0.56466854", "0.5572466", "0.5560918", "0.55388176", "0.5535151", "0.5535151", "0.5519311", "0.5407942", "0.5407018", "0.53903425", "0.53849745", "0.53849745", "0.5383673", "0.53645...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_contact_info @contact_info = ContactInfo.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def contact_info_params params.require(:contact_info).permit( :person_id, :info_type, :phone_no_fixed, :phone_no_mobile, :department, :detail_location, :address_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
prepare list of addresses
def set_address_options @address_options = Address.all.map{ |a| [ a.label, a.id ]} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_address_list_from_params\n @address_list = []\n params.each do |key, value|\n next unless key.start_with? 'address_list_'\n\n address = Address.new.from_json(value)\n @address_list << address\n end\n end", "def extract_addresses(address_list)\n addresses = []\n address_lis...
[ "0.75405616", "0.7061769", "0.6850537", "0.67182237", "0.6575284", "0.65727663", "0.65498775", "0.64918846", "0.6485239", "0.6473226", "0.64515823", "0.63484806", "0.6332715", "0.63140994", "0.6289869", "0.62185985", "0.6210023", "0.61692774", "0.61642265", "0.6154547", "0.61...
0.6007502
27
def aggregate_schema(type, write: false) end
def aggregate_schema(type, write: false) in_dir, out_dir = get_dirs(type) jsons = aggregate(in_dir) schema = Convert.jsons_to_schema(jsons) if write path = "#{out_dir}/schema-#{Time.current.strftime('%s%2N')}.json" File.write(path, JSON.pretty_generate(schema)) end schema end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply_schema(name, type, options={})\n raise NotImplementedError\n end", "def aggregate_db_storage_type; end", "def schema_composite_type(db_type)\n @row_schema_types[db_type] || super\n end", "def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n ...
[ "0.6682754", "0.6608514", "0.640476", "0.6218906", "0.61200637", "0.6013572", "0.59346664", "0.58826214", "0.58818483", "0.5806435", "0.58062404", "0.58002096", "0.57946223", "0.57759094", "0.57142127", "0.57091665", "0.5708315", "0.5666738", "0.565325", "0.56480676", "0.5627...
0.80117494
0
GET /budgets GET /budgets.json
def index @budgets = Budget.where(:session => $sess_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def budgets\n # https://developer.xero.com/documentation/api/budgets\n # if you are having issues in adding the accounting.budgets.read scope, get in touch => api@xero.com\n @budgets = xero_client.accounting_api.get_budgets(current_user.active_tenant_id).budgets\n @budget = xero_client.accounting_api.g...
[ "0.7769996", "0.77680784", "0.76790833", "0.739718", "0.7325283", "0.71915555", "0.7146855", "0.71041167", "0.70492715", "0.692903", "0.6864969", "0.6825186", "0.6761401", "0.6596338", "0.65764004", "0.6477175", "0.6459417", "0.6458338", "0.6431454", "0.6426355", "0.6417248",...
0.6327502
30
GET /budgets/1 GET /budgets/1.json
def show @budget = Budget.find(params[:id]) @incomev = @budget.income @savingv = @budget.income * 0.05 unless @budget.income.nil? @housingv = @budget.income * 0.24 unless @budget.income.nil? @utilitiev = @budget.income * 0.05 unless @budget.income.nil? @foodv = @budget.income * 0.08 unless @budget.income.nil? @transportationv = @budget.income * 0.09 unless @budget.income.nil? @clothingv = @budget.income * 0.07 unless @budget.income.nil? @personalv = @budget.income * 0.09 unless @budget.income.nil? @recreationv = @budget.income * 0.09 unless @budget.income.nil? @debtv = @budget.income * 0.09 unless @budget.income.nil? @kidv = @budget.income * 0.18 unless @budget.income.nil? @savingx = @budget.savings @housingx = @budget.housing @utilitiex = @budget.utilities @foodx = @budget.food @transportationx = @budget.transportation @clothingx = @budget.clothing @personalx = @budget.personal @recreationx = @budget.recreation @debtx = @budget.debt @kidx = @budget.kids @total_suggested = @savingv + @housingv + @utilitiev + @foodv + @transportationv + @clothingv + @personalv + @recreationv + @debtv + @kidv @total_actual = @savingx + @housingx + @utilitiex + @foodx + @transportationx + @clothingx + @personalx + @recreationx + @debtx + @kidx if @savingv > @savingx @savingz = (@savingv - @savingx) else @savingz = (@savingx - @savingv) end if @housingv > @housingx @housingz = (@housingv - @housingx) else @housingz = (@housingx - @housingv) end if @utilitiev > @utilitiex @utilitiez = (@utilitiev - @utilitiex) else @utilitiez = (@utilitiex - @utilitiev) end if @foodv > @foodx @foodz = (@foodv - @foodx) else @foodz = (@foodx - @foodv) end if @transportationv > @transportationx @transportationz = (@transportationv - @transportationx) else @transportationz = (@transportationx - @transportationv) end if @clothingv > @clothingx @clothingz = (@clothingv - @clothingx) else @clothingz = (@clothingx - @clothingv) end if @personalv > @personalx @personalz = (@personalv - @personalx) else @personalz = (@personalx - @personalv) end if @recreationv > @recreationx @recreationz = (@recreationv - @recreationx) else @recreationz = (@recreationx - @recreationv) end if @debtv > @debtx @debtz = (@debtv - @debtx) else @debtz = (@debtx - @debtv) end if @kidv > @kidx @kidz = (@kidv - @kidx) else @kidz = (@kidx - @kidv) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get_budgets\n end", "def index\n @budgets = Budget.all\n end", "def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end", "def index\n @items = Item.all\n @budget ...
[ "0.7615787", "0.75374943", "0.7529997", "0.7425407", "0.72966695", "0.7277789", "0.7269815", "0.7213055", "0.7091219", "0.70826834", "0.70211214", "0.7009892", "0.7009892", "0.7009892", "0.7009892", "0.6993125", "0.69291615", "0.6853403", "0.68420106", "0.68058616", "0.676241...
0.0
-1
POST /budgets POST /budgets.json
def create @budget = Budget.new(budget_params) respond_to do |format| if @budget.save format.html { redirect_to @budget, notice: 'Budget was successfully created.' } format.json { render :show, status: :created, location: @budget } else format.html { render :new } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format...
[ "0.75522953", "0.75473195", "0.7400839", "0.7374585", "0.7285448", "0.6889538", "0.67936605", "0.67759067", "0.67474437", "0.6740765", "0.6603135", "0.65819085", "0.65571755", "0.6493924", "0.64787555", "0.6478163", "0.6438241", "0.6424356", "0.6424356", "0.6424356", "0.64243...
0.7260562
6
PATCH/PUT /budgets/1 PATCH/PUT /budgets/1.json
def update respond_to do |format| if @budget.update(budget_params) format.html { redirect_to @budget, notice: 'Budget was successfully updated.' } format.json { render :show, status: :ok, location: @budget } else format.html { render :edit } format.json { render json: @budget.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end", "def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was succe...
[ "0.8026648", "0.7396934", "0.7396934", "0.7361922", "0.72452253", "0.68626356", "0.67455447", "0.66521835", "0.66150564", "0.6505353", "0.64734066", "0.6431644", "0.6408572", "0.6406165", "0.6379921", "0.63385046", "0.63385046", "0.63385046", "0.63385046", "0.63208914", "0.63...
0.7210185
6
DELETE /budgets/1 DELETE /budgets/1.json
def destroy @budget.destroy respond_to do |format| format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n ...
[ "0.80596507", "0.8052162", "0.7745417", "0.76833415", "0.7648094", "0.748794", "0.73072225", "0.72522795", "0.72057337", "0.72005427", "0.70806473", "0.6962823", "0.69600993", "0.69600993", "0.6938634", "0.69297326", "0.69276094", "0.6921499", "0.6921499", "0.68874925", "0.68...
0.7660224
5
Use callbacks to share common setup or constraints between actions.
def set_budget @budget = Budget.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def budget_params params.require(:budget).permit(:income, :savings, :housing, :utilities, :food, :food, :transportation, :clothing, :personal, :recreation, :debt, :kids, :session, :budget_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
var=? in Scheme implementation.
def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def var!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 75 )\n\n type = VAR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 196:7: 'var'\n match( \"var\" )\n\n \n @state.type = type\...
[ "0.6310705", "0.59082776", "0.5795238", "0.57875204", "0.5737463", "0.5702177", "0.56899834", "0.56841046", "0.5675468", "0.56703615", "0.5648727", "0.5612485", "0.55929464", "0.5557159", "0.55551696", "0.55264926", "0.55113", "0.55103993", "0.5506074", "0.550127", "0.5474357...
0.5204472
99
Walk environment S and look up value of U, if present.
def walk(u, s) if var?(u) pr = assp(-> (v) { u == v }, s) pr ? walk(cdr(pr), s) : u else u end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eval_prog env\n\t\tresults = env.select { |pair| pair[0] == @s }\n\t\tif results.length > 0\n=begin\n for i in 0..results.length-1\n puts results[i][0]\n puts results[i][1]\n puts \"\\n\"\n end\n=end\n results[0][1]\n\t\telse\n\t\t\trais...
[ "0.5306887", "0.5068697", "0.48224854", "0.48092902", "0.47228032", "0.47023335", "0.46932405", "0.462838", "0.46265164", "0.46179718", "0.46034986", "0.4601371", "0.45819363", "0.4556256", "0.45244116", "0.4500404", "0.44843635", "0.44218725", "0.44159862", "0.44086206", "0....
0.6504468
0
Call function f with a fresh variable.
def call_fresh(f) -> (s_c) { c = cdr(s_c) f.call(var(c)).call(cons(car(s_c), c + 1)) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def f\n 1\n end", "def f1(x, x); end", "def f\n end", "def f() 1 end", "def f\n x = 3\n b = binding()\n b\nend", "def call(f)\n CAS::Help.assert(f, Hash)\n\n -1.0 * @x.call(f)\n end", "def f\n g\n end", "def f\n 0\n end", "def f2(x, x=0); end",...
[ "0.5863297", "0.5788108", "0.57575756", "0.5741883", "0.5687574", "0.567119", "0.5655669", "0.5622544", "0.5584153", "0.55774474", "0.55583775", "0.5495838", "0.5484879", "0.5452233", "0.5452233", "0.54283416", "0.5380214", "0.53436005", "0.53393865", "0.53299165", "0.5317281...
0.67358845
0
Editer un restaurant s'il existe
def edit @restaurant = Restaurant.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_restaurante\n @restaurante = Restaurante.friendly.find(params[:id])\n end", "def set_restaurante\n\t\t@restaurante = Restaurante.find(params[:id])\t\n\tend", "def edit\n\t\t@restaurant = Restaurant.find(params[:id])\n\tend", "def set_restaurante\n @restaurante = Restaurante.find(params[:...
[ "0.65328443", "0.6518577", "0.65048647", "0.6492974", "0.6468509", "0.6445383", "0.6430796", "0.64213914", "0.63960665", "0.63824886", "0.62744445", "0.62045354", "0.61802244", "0.6167812", "0.6159476", "0.6129182", "0.6104444", "0.6104444", "0.6104352", "0.609757", "0.606990...
0.64130443
10
should return false =begin On line 5, the ternary operator evaluates the expression `odd_count = 3` before the `?`. In this expression, the local variable is reassigned to the Integer object with value `3`, which returns the value of odd_count, i.e. `3`. `3` is a truthy value, so it will always evaluate to true. Hence the whole line will always return `true`. Instead, we should use `odd_count == 3` as the expression to be evaluated. == checks whether the local variable `odd_count`'s value is `3`; if yes, it returns `true`, else it returns `false`'. In fact, we would not need to use the ternary operator at all; we can simply write the last statement as `odd_count == 3` =end
def valid_series?(nums) return false if nums.sum != 47 odd_count = nums.count { |n| n.odd? } odd_count == 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def oddness(count)\n count.odd? ? \"odd\" : \"even\"\n end", "def is_odd(x)\n x % 2 == 0 ? false : true\nend", "def is_odd(num)\n output = false\n if num % 2 != 0\n output = true\n end\n return output\nend", "def is_odd?(integer)\n integer % 2 == 0 ? false : true\nend", "def is_o...
[ "0.6825144", "0.6625457", "0.66202635", "0.66182435", "0.6593667", "0.65611786", "0.6557442", "0.6553553", "0.65033406", "0.64959615", "0.64919823", "0.6491229", "0.64878553", "0.64565444", "0.64199686", "0.6405991", "0.63954484", "0.6395214", "0.639399", "0.6362889", "0.6362...
0.0
-1
Create an endpoint processor
def create_request_processor(swagger_endpoint) request_processor = Sinatra::SwaggerExposer::Processing::SwaggerRequestProcessor.new(swagger_endpoint.produces) swagger_endpoint.parameters.each do |parameter| if TYPE_FILE == parameter.type dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerFileProcessorDispatcher.new( parameter.name, parameter.required ) else processor = create_parameter_value_processor(parameter) dispatcher = Sinatra::SwaggerExposer::Processing::SwaggerProcessorDispatcher.new( parameter.how_to_pass, processor ) end if dispatcher.useful? request_processor.add_dispatcher(dispatcher) end end swagger_endpoint.responses.each_pair do |code, endpoint_response| response_value_processor = create_response_value_processor(endpoint_response) response_processor = Sinatra::SwaggerExposer::Processing::SwaggerResponseProcessor.new( endpoint_response, response_value_processor ) request_processor.add_response_processor( code, response_processor.useful? ? response_processor : nil ) end request_processor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_endpoint_processor(swagger_endpoint)\n request_preprocessor = Sinatra::SwaggerExposer::Processing::SwaggerRequestPreprocessor.new\n swagger_endpoint.parameters.each do |parameter|\n preprocessor = create_value_preprocessor(parameter)\n dispatcher = Sinatra::SwaggerExposer...
[ "0.6852049", "0.6180102", "0.61758834", "0.60738254", "0.5909795", "0.5897608", "0.58657765", "0.58250624", "0.58187014", "0.5747947", "0.574435", "0.574435", "0.574435", "0.574435", "0.5719572", "0.57149154", "0.569486", "0.56530917", "0.56454515", "0.56450075", "0.5602877",...
0.6107682
3
Create a response processor
def create_response_value_processor(endpoint_response) response_type = endpoint_response.type if response_type == TYPE_ARRAY processor_for_values = create_processor_for_type('Response', endpoint_response.items, false) Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new('Response', true, processor_for_values) elsif response_type == TYPE_FILE # Don't validate the files' content nil elsif response_type create_processor_for_type('Response', response_type, false) else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_response( &block )\n @postprocessor = block\n end", "def create_response(request)\n response = Response.new\n end", "def response_parser; end", "def process_response(obj)\n end", "def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend", "def call( env ...
[ "0.6662526", "0.6638015", "0.6591317", "0.6546623", "0.6494686", "0.641557", "0.63104904", "0.6251861", "0.6226066", "0.61979103", "0.61979103", "0.6036747", "0.60179055", "0.6012466", "0.5982507", "0.5955824", "0.5943462", "0.5943462", "0.591904", "0.5898638", "0.5893349", ...
0.7114406
0
Create a parameter processor for a parameter
def create_parameter_value_processor(parameter) type_name = parameter.type if type_name == TYPE_ARRAY if PRIMITIVE_TYPES.include? parameter.items processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( parameter.name, false, parameter.items, parameter.default, parameter.params ) else processor_for_values = create_processor_for_type(parameter.name, parameter.items, false) end Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new( parameter.name, parameter.required, processor_for_values ) elsif PRIMITIVE_TYPES.include? type_name Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( parameter.name, parameter.required, type_name, parameter.default, parameter.params ) else create_processor_for_type(parameter.name, parameter.type, parameter.required) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n ...
[ "0.673584", "0.66540295", "0.64762616", "0.62489116", "0.6186723", "0.6050488", "0.60457397", "0.59999305", "0.5952087", "0.59322613", "0.5931921", "0.58731824", "0.5825732", "0.58170843", "0.5816643", "0.5796295", "0.577737", "0.57695746", "0.57695746", "0.5745455", "0.57418...
0.7743246
0
Create a type parameter processor for a type parameter
def create_processor_for_type(parameter_name, parameter_type, parameter_required) attributes_processors = create_attributes_processors_for_type(parameter_type) Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new( parameter_name, parameter_required, attributes_processors ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_preprocessor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_preprocessors = create_attributes_preprocessors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValuePreprocessor.new(\n parameter_name,\n parameter_requi...
[ "0.69013447", "0.68304664", "0.61616504", "0.61616504", "0.61616504", "0.61616504", "0.61616504", "0.60246724", "0.59889245", "0.5960109", "0.5960109", "0.5891081", "0.5813403", "0.5799338", "0.5670359", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0.56024855", "0...
0.74645126
0
Get attributes processor for a type
def create_attributes_processors_for_type(type_name) type = @types[type_name] attributes_processors = [] type.properties.each_pair do |property_name, property| attributes_processors << create_processor_for_property( property_name, property, type.required.include?(property.name) ) end if type.extends attributes_processors = attributes_processors + create_attributes_processors_for_type(type.extends) end attributes_processors end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\...
[ "0.66234607", "0.6392467", "0.62843263", "0.62843263", "0.62843263", "0.61374766", "0.6047604", "0.5946742", "0.58670545", "0.5860231", "0.58024645", "0.5683741", "0.5634317", "0.5620199", "0.5611769", "0.5598919", "0.5570774", "0.5521515", "0.55020857", "0.547216", "0.546899...
0.734431
0
Create a processor for a type property
def create_processor_for_property(name, type_property, required) property_type = type_property.type if property_type == TYPE_ARRAY if PRIMITIVE_TYPES.include? type_property.items processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( name, false, type_property.items, type_property.properties[:default], type_property.properties ) else processor_for_values = create_processor_for_type(name, type_property.items, false) end Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.new(name, required, processor_for_values) elsif PRIMITIVE_TYPES.include? property_type Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new( name, required, property_type, type_property.properties[:default], type_property.properties ) else create_processor_for_type(name, property_type, required) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n ...
[ "0.7112839", "0.6958294", "0.6858634", "0.6238908", "0.6230018", "0.6227938", "0.6150707", "0.6118763", "0.6111717", "0.60464376", "0.60255194", "0.59862924", "0.59661144", "0.5879526", "0.57871073", "0.5760827", "0.56870794", "0.56554484", "0.5640617", "0.56213623", "0.56211...
0.80070204
0
Translate point coordinate [x,y] into Cell Index > Column equal as X axis > Row equal as Y axis
def cell(col, row) return nil if out_of_bound?(row, 0, Grid::MaxRow - 1) return nil if out_of_bound?(col, 0, Grid::MaxCol - 1) return (Grid::MaxCol * row) + col end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_for(x, y, coordinate_system=:row_col)\n case coordinate_system\n when :row_col\n x * 9 + y\n when :col_row\n y * 9 + x\n when :box\n [0,3,6,27,30,33,54,57,60][x] + [0,1,2,9,10,11,18,19,20][y]\n end\n end", "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIG...
[ "0.7506393", "0.7349322", "0.6882335", "0.68398154", "0.6835803", "0.6808199", "0.67710584", "0.6763946", "0.6744747", "0.6737701", "0.66860825", "0.66803294", "0.66571987", "0.66341007", "0.6610396", "0.6601868", "0.6540601", "0.653739", "0.6522508", "0.65207195", "0.6499667...
0.6329584
40
Translate cell index into point [x,y]
def point(index) return [index % Grid::MaxCol, index / Grid::MaxCol] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end", "def translate_index_to_grid_position(index)\n @grid_positions[index]\nend", "def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end", "def index_for(x, y, coordinate_system=:row_...
[ "0.73571724", "0.70152014", "0.6968396", "0.67127645", "0.66602886", "0.6650141", "0.6579846", "0.65721875", "0.6539108", "0.6531649", "0.65258586", "0.65044814", "0.64949375", "0.64486504", "0.6445936", "0.64458525", "0.64177966", "0.64177966", "0.6416286", "0.6414701", "0.6...
0.7227134
1
Simply check if the value is out of bound
def out_of_bound?(value, min, max) return value > max || value < min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def out_of_range?\n value < 1 || value > 12\n end", "def out_of_range?(v)\n v < 1 || v > 12\n end", "def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end", "def check_value\n if var == \"limit\" && value.to_i < 1\n raise...
[ "0.79258496", "0.75973123", "0.7396919", "0.7321022", "0.726353", "0.7210668", "0.71527046", "0.71438575", "0.7141677", "0.70944566", "0.7036176", "0.703582", "0.69669616", "0.69613254", "0.693714", "0.69370985", "0.6927298", "0.68954843", "0.6887002", "0.6816876", "0.6781704...
0.7941162
0
TARGETING PART! Surrounding grid
def surrounding(index, directions = Grid::Movement, compact = true) result = directions.collect {|dir| neighbor(index, dir)} + [index] return result.compact.uniq if compact return result.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grid(*)\n super\n end", "def carve_walls_from_point(x, y, grid)\n \nend", "def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is...
[ "0.6187738", "0.6162783", "0.6158351", "0.61524725", "0.6121282", "0.6111624", "0.6111624", "0.60192966", "0.59997433", "0.59029144", "0.58752936", "0.5872623", "0.58701354", "0.5854581", "0.5819976", "0.5787717", "0.5757861", "0.57513267", "0.5741623", "0.5740996", "0.573774...
0.0
-1
Spread search. Expand node using BFS iteration
def spread(index, directions = Grid::Movement,limit = 1,compact = true) return [] unless index return [] if limit < 0 i = 0 result = [index] iteration = [index] until i == limit temp_res = [] iteration.each do |it| cells = surrounding(it, directions, compact) cells.delete_if {|c| result.include?(c)} temp_res += cells end temp_res.uniq! iteration = temp_res result += temp_res i += 1 end return result.compact.uniq if compact return result.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def bfs...
[ "0.6668395", "0.64870673", "0.63933283", "0.6341461", "0.6263692", "0.62364405", "0.61913985", "0.6186775", "0.61284083", "0.61246395", "0.6118684", "0.6070348", "0.60554963", "0.60554415", "0.605217", "0.60435", "0.6023189", "0.5988652", "0.5984487", "0.59387016", "0.5938162...
0.0
-1
Initialize a new HttpClient
def initialize(uri = nil, options = nil, &block) @url = uri @options = options @user_agent ||= USER_AGENT['bot'] yield self if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_http_client\n c = DefaultHttpClient.new( @connection_manager, @cparams )\n c.http_request_retry_handler = @retry_handler if @retry_handler\n c\n end", "def init_http_client(options)\n http = Net::HTTP.new(@base_uri.host, 443)\n http.use_ssl = true if @base_uri.s...
[ "0.7823902", "0.752578", "0.728903", "0.7230167", "0.7167555", "0.7111974", "0.7059632", "0.7039997", "0.7012834", "0.69910544", "0.6990311", "0.69551367", "0.69463295", "0.69166046", "0.6891927", "0.6877299", "0.68694335", "0.68469137", "0.68463993", "0.68243194", "0.6809537...
0.0
-1
Set the url for HttpClient
def url=(uri) @conn = nil @url = uri end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_base_url(url)\r\n @http_client.base_url = url\r\n end", "def set_url\n @url = DEFAULT_URL\n end", "def url(url)\n @url = url\n end", "def set_url\n url 'set'\n end", "def setURL(url)\r\n\t\t\t\t\t@url = url\r\n\t\t\t\tend", "def setURL(url)\r\n\t\t\t\t\t@url = url\...
[ "0.76124865", "0.7402809", "0.7114214", "0.7062254", "0.70554525", "0.70554525", "0.70554525", "0.70554525", "0.70554525", "0.7028956", "0.691217", "0.68442446", "0.6795744", "0.66941214", "0.6688651", "0.6638596", "0.6603098", "0.6601508", "0.6591256", "0.6539716", "0.651574...
0.63643634
29