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
POST /places POST /places.json
def create @place = Place.new(place_params) respond_to do |format| if @place.save format.html { redirect_to @place } #, notice: 'Place was successfully created.' } format.json { render :show, status: :created, location: @place } else format.html { render :new } format.json { render json: @place.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n place = Place.new(params[:place])\n\n if place.save\n render json: place, status: :created, location: place\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def create\n place = Place.new(place_params)\n\n if place.save\n render j...
[ "0.7382315", "0.7255577", "0.68692553", "0.68393594", "0.68393594", "0.68393594", "0.68393594", "0.6817437", "0.6782164", "0.6782164", "0.6782164", "0.6739458", "0.6687017", "0.6501645", "0.6497573", "0.6487039", "0.6473653", "0.64577216", "0.643016", "0.64248747", "0.6394875...
0.6551536
13
PATCH/PUT /places/1 PATCH/PUT /places/1.json
def update respond_to do |format| if @place.update(place_params) format.html { redirect_to @place } #, notice: 'Place was successfully updated.' } format.json { render :show, status: :ok, location: @place } else format.html { render :edit } format.json { render json: @place.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n place = Place.find(params[:id])\n\n if place.update_attributes(params[:place])\n head :no_content\n else\n render json: place.errors, status: :unprocessable_entity\n end\n end", "def update\n @place = Place.find(params[:id])\n\n respond_to do |format|\n if @place.up...
[ "0.715184", "0.6971671", "0.6971671", "0.6971671", "0.6971671", "0.6971671", "0.6953526", "0.67849296", "0.6708165", "0.6708165", "0.6708165", "0.6669499", "0.66694194", "0.6558429", "0.65450233", "0.65450233", "0.6536463", "0.65224093", "0.6513008", "0.6476143", "0.64504164"...
0.6492452
19
DELETE /places/1 DELETE /places/1.json
def destroy @place.destroy respond_to do |format| format.html { redirect_to places_url } #, notice: 'Place was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n format.html { redirect_to places_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n @place.destroy\n\n respond_to do |format|\n f...
[ "0.7516207", "0.7516207", "0.7516207", "0.7516207", "0.7516207", "0.73997223", "0.72790796", "0.7269607", "0.72638226", "0.72365075", "0.72365075", "0.72365075", "0.72365075", "0.72365075", "0.72365075", "0.72365075", "0.72190577", "0.7215013", "0.7215013", "0.7215013", "0.72...
0.7071635
29
Use callbacks to share common setup or constraints between actions.
def set_place @place = Place.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def place_params params.require(:place).permit(:name, :description, :neighborhood, :rating, :address, :latitude, :longitude, :location) 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.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "...
0.0
-1
render json: posts, include: [:likes] include: [:followers, :followed] render json: posts, include: [:likes] SHOW USER
def show user = User.find(params[:id]) friendships = user.followers + user.followees render json: {user: user, friendships: friendships} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_follows\n follows = paginate Follow.where(follower_id: params[:user_id])\n\n render json: follows.to_json(:include => :following)\n end", "def index\n @users = User.all\n\n # render json: @users\n # how do you include more than one include:\n render json: @users.to_json(include: :books)...
[ "0.79311055", "0.76210225", "0.7356662", "0.73487014", "0.72759354", "0.7270996", "0.72640294", "0.7253462", "0.7214051", "0.7154821", "0.71284544", "0.7100697", "0.70922005", "0.7088925", "0.7085008", "0.7073093", "0.7046665", "0.70424724", "0.70397115", "0.70375544", "0.702...
0.70855844
14
GET /funds GET /funds.json
def index @funds = Fund.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end", "def show\n render json: @fund\n end", "def show\n\t @funds = Fund.all\n end", "def show\n @admin_fund = Fund.find(params[:id])\...
[ "0.79779464", "0.7456549", "0.74468416", "0.694762", "0.67388076", "0.6655098", "0.6655098", "0.65718013", "0.6544788", "0.64161694", "0.6397997", "0.63918555", "0.6381159", "0.6348854", "0.631896", "0.63051325", "0.6285904", "0.62582123", "0.62239605", "0.6215937", "0.620529...
0.7127641
3
GET /funds/1 GET /funds/1.json
def show @funds = Fund.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\n render json: @fund\n end", "def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format...
[ "0.77693087", "0.77650607", "0.74898493", "0.7073392", "0.70075494", "0.6894644", "0.6871805", "0.6871805", "0.66480565", "0.6604758", "0.65748", "0.65482974", "0.6480356", "0.6479058", "0.64508605", "0.64112085", "0.6360159", "0.6347698", "0.6337726", "0.6330584", "0.6318178...
0.68106645
8
POST /funds POST /funds.json
def create @fund = Fund.new(fund_params) respond_to do |format| if @fund.save MoneyMailer.funding_confirmation(current_user, @fund).deliver_now Fund.find(@fund.id).update(:state => true) format.html { redirect_to @fund, notice: 'Fund was successfully created.' } format.json { render :show, status: :created, location: @fund } else format.html { render :new } format.json { render json: @fund.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render...
[ "0.76266783", "0.7466283", "0.67220575", "0.6642129", "0.66399187", "0.6557947", "0.6526183", "0.6473134", "0.6473134", "0.64079356", "0.64003307", "0.63965017", "0.63639534", "0.6360078", "0.63135415", "0.63010263", "0.62279147", "0.61976963", "0.61806935", "0.61159295", "0....
0.63795185
12
PATCH/PUT /funds/1 PATCH/PUT /funds/1.json
def update respond_to do |format| if @fund.update(fund_params) format.html { redirect_to @fund, notice: 'Fund was successfully updated.' } format.json { render :show, status: :ok, location: @fund } else format.html { render :edit } format.json { render json: @fund.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully upd...
[ "0.73715615", "0.70328516", "0.685733", "0.66884285", "0.6627741", "0.6571425", "0.6571425", "0.65422815", "0.6516973", "0.65142834", "0.65049154", "0.6461931", "0.6461931", "0.6457084", "0.6388734", "0.6369069", "0.6369069", "0.63545096", "0.6354392", "0.63510597", "0.631825...
0.7035257
1
DELETE /funds/1 DELETE /funds/1.json
def destroy @fund.destroy respond_to do |format| format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fund.destroy\n\n head :no_content\n end", "def destroy\n @admin_fund = Fund.find(params[:id])\n @admin_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_funds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trust_fun...
[ "0.7651113", "0.75108474", "0.74525034", "0.7196766", "0.7155708", "0.71305966", "0.71294063", "0.7115529", "0.7086548", "0.7083689", "0.7072832", "0.70402956", "0.7034332", "0.70170915", "0.70078135", "0.6991736", "0.69857246", "0.6982553", "0.6978067", "0.6973841", "0.69703...
0.751985
2
Use callbacks to share common setup or constraints between actions.
def set_fund @fund = Fund.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def fund_params params.require(:fund).permit(:state, :user_id, :promise_id, :project_id, :amount) 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.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "...
0.0
-1
GET /cancel_conditions GET /cancel_conditions.json
def index @cancel_conditions = CancelCondition.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @cancel_condition.destroy\n respond_to do |format|\n format.html { redirect_to cancel_conditions_url, notice: 'Cancel condition was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def cancel_condition_params\n params.require(:cancel_condition).p...
[ "0.6548755", "0.6439407", "0.64118785", "0.64064384", "0.6403174", "0.6375936", "0.6301547", "0.6172472", "0.6092053", "0.6001064", "0.59802777", "0.5921047", "0.58982366", "0.58650285", "0.58625966", "0.58625966", "0.5861203", "0.5845044", "0.58265775", "0.58057714", "0.5792...
0.7116375
0
GET /cancel_conditions/1 GET /cancel_conditions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @cancel_conditions = CancelCondition.all\n end", "def set_cancel_condition\n @cancel_condition = CancelCondition.find(params[:id])\n end", "def destroy\n @cancel_condition.destroy\n respond_to do |format|\n format.html { redirect_to cancel_conditions_url, notice: 'Cancel cond...
[ "0.72485876", "0.67229867", "0.66510737", "0.65530276", "0.6511275", "0.64399683", "0.6362008", "0.6348656", "0.63231945", "0.6191309", "0.6120465", "0.605638", "0.60128134", "0.598816", "0.59817", "0.5977231", "0.5959255", "0.5959255", "0.5922354", "0.5865663", "0.5857127", ...
0.0
-1
POST /cancel_conditions POST /cancel_conditions.json
def create @cancel_condition = CancelCondition.new(cancel_condition_params) respond_to do |format| if @cancel_condition.save format.html { redirect_to @cancel_condition, notice: 'Cancel condition was successfully created.' } format.json { render :show, status: :created, location: @cancel_condition } else format.html { render :new } format.json { render json: @cancel_condition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel_condition_params\n params.require(:cancel_condition).permit(:project_id, :cancel_type, :rate_id, :rate_coefficient, :parameter1, :parameter2)\n end", "def destroy\n @cancel_condition.destroy\n respond_to do |format|\n format.html { redirect_to cancel_conditions_url, notice: 'Cancel ...
[ "0.71039504", "0.68805975", "0.66304004", "0.6528034", "0.6521421", "0.64772594", "0.64654505", "0.63244617", "0.62887377", "0.62594414", "0.620065", "0.61635226", "0.6078002", "0.60585284", "0.60486925", "0.597365", "0.5972862", "0.5941038", "0.5859096", "0.5856665", "0.5845...
0.70688796
1
PATCH/PUT /cancel_conditions/1 PATCH/PUT /cancel_conditions/1.json
def update respond_to do |format| if @cancel_condition.update(cancel_condition_params) format.html { redirect_to @cancel_condition, notice: 'Cancel condition was successfully updated.' } format.json { render :show, status: :ok, location: @cancel_condition } else format.html { render :edit } format.json { render json: @cancel_condition.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_cancel_condition\n @cancel_condition = CancelCondition.find(params[:id])\n end", "def cancel_condition_params\n params.require(:cancel_condition).permit(:project_id, :cancel_type, :rate_id, :rate_coefficient, :parameter1, :parameter2)\n end", "def update!(**args)\n @cancel_imme...
[ "0.6850642", "0.6764064", "0.6705607", "0.6687557", "0.6511989", "0.6285725", "0.6234025", "0.6195312", "0.61721635", "0.6169629", "0.6165841", "0.6091082", "0.60331184", "0.6017538", "0.6014111", "0.60139316", "0.60092175", "0.6001602", "0.5990686", "0.59884924", "0.5944473"...
0.76468974
0
DELETE /cancel_conditions/1 DELETE /cancel_conditions/1.json
def destroy @cancel_condition.destroy respond_to do |format| format.html { redirect_to cancel_conditions_url, notice: 'Cancel condition was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @condition.destroy\n respond_to do |format|\n format.html { redirect_to conditions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @confirmed_condition.destroy\n respond_to do |format|\n format.html { redirect_to confirmed_conditions_url, notice:...
[ "0.6621219", "0.65835214", "0.65268064", "0.6525767", "0.65109706", "0.65052605", "0.6486266", "0.647125", "0.6449699", "0.6429895", "0.6345157", "0.6321205", "0.63186705", "0.6307964", "0.629623", "0.6288387", "0.62077236", "0.6200963", "0.6175576", "0.61676985", "0.6162475"...
0.7430564
0
Use callbacks to share common setup or constraints between actions.
def set_cancel_condition @cancel_condition = CancelCondition.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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def cancel_condition_params params.require(:cancel_condition).permit(:project_id, :cancel_type, :rate_id, :rate_coefficient, :parameter1, :parameter2) 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Method for printing the "usage information"
def usage puts "USAGE:" puts "\t" + __FILE__ + " [ARGUMENTS]" print "\n" puts "Installs the ServerUtils to the systems bin directory (Default: #{DEF_INSTALL_DIR}) and generates a config file." puts "If you don't like the default values for the config file you can use flags to change them (run " + "#{__FILE__} -sc".yellow + " to see the default config)" puts "The installation is based around the idea to keep all the SU files at one place (preferred if you cloned this via git)." puts "So the installation doesn't move or copy any files, instead it links them to their current location." puts "(So don't [re]move this directory after installation!)".red print "\n" puts "Example:" puts "\t" + __FILE__ + " -c" puts "\t" + __FILE__ + " -d /usr/sbin" puts "\nArguments:" puts "\t-h, --help\t\t\tShow this information" puts "\t-s, --simulate\t\t\tSimulate everything, don't making any real changes" print "\n" puts "\t-d, --dir DIR\t\t\tThe directory where the scripts should be installed (should be in $PATH) (defaults to #{DEF_INSTALL_DIR})" puts "\t\t\t\t\tWARNING: The script will stop with an error if the files already exists!".yellow puts "\t-c, --just-config\t\tJust generate the config file, don't do any installing!" puts "\t-n, --no-config\t\t\tDon't generate a config (useful if you already have a su_config.rb)'" puts "\t-r, --install-requirements\tInstall all the dependecies of SU (note: adds to the execution time!)" puts "\t-F, --force-install\t\tForces the install, overwrites files in the install directory if they exists (" + "Be careful with this!".red + ")" puts "\t-E, --keep-ext\t\t\tKeep the .rb extensions on the files when installing them" puts "\t\t\t\t\t(then you have to write " + "addemailaccount.rb arthur@example.com".yellow + " instead of " + "addemailaccount arthur@example.com".yellow + ")" print "\n" puts "\t-D, --db-name NAME\t\tSet the database name to NAME" puts "\t-U, --db-user USER\t\tSet the database user to USER" puts "\t-P, --db-password PASSWORD\tSet the database password to PASSWORD" puts "\t-u, --user-table TABLE\t\tSet the database table to TABLE" puts "\t-t, --domain-table TABLE\t\tSet the database table to TABLE" puts "\t-a, --alias-table TABLE\t\tSet the database table to TABLE" puts "\t-i, --id ID\t\t\tSet the default id (gid & uid) to ID (could be numeric or name [like " + "vmail".yellow + "], used to set the system/file owner of the mailboxes)" # We also exit the script here.. exit(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_usage; end", "def print_usage\n puts @@usage\n end", "def usage\n puts @usage_text\n end", "def display_usage\n end", "def printUsage\n \n print \"usage -- main.rb <structureFile> <outFile>\\n\"\n print \" <numTimesteps> - total number of timesteps to run\\n\"\n print \" ...
[ "0.8832141", "0.8393655", "0.8375082", "0.8263629", "0.79581857", "0.7740699", "0.770911", "0.7515836", "0.73992103", "0.73133385", "0.72661364", "0.7250998", "0.7250998", "0.71781796", "0.71200424", "0.70617265", "0.70571107", "0.70227915", "0.70178646", "0.70178646", "0.701...
0.0
-1
Does all the initial processing
def init # Validate and parse the flags OptionParser.new do |o| o.on('-D NAME', '--db-name NAME') { |n| $DB_NAME = n } o.on('-U USER', '--db-user USER') { |u| $DB_USER = u } o.on('-P PASSWORD', '--db-password PASSWORD') { |p| $DB_PASSWORD = p } o.on('-u TABLE', '--user-table TABLE') { |t| $DB_ACC_TABLE = t } o.on('-t TABLE', '--domain-table TABLE') { |t| $DB_DOM_TABLE = t } o.on('-a TABLE', '--alias-table TABLE') { |t| $DB_VIRT_TABLE = t } o.on('-i ID', '--default-id ID') { |i| $DEFAULT_ID = i } o.on('-d DIR', '--dir DIR') { |d| $install_dir = d } o.on('-E', '--keep-ext') { |b| $keep_extensions = b } o.on('-F', '--force-install') { |b| $force_install = b } o.on('-c', '--just-config') { |b| $just_gen_conf = b; } o.on('-r', '--install-requirements') { |b| $install_req = b; } o.on('-n', '--no-config') { |b| $dont_gen_conf = true } # b assingment didn't work!? (b was false) o.on('-s', '--simulate') { |b| $simulate = b } o.on('-h', '--help') { usage } o.parse! end # We can't do anything if we should both skip the config file and just generate the config file if $just_gen_conf and $dont_gen_conf puts "Conflicting flags: -n/--no-config and -c/--just-config".red puts "Since we can't both generate just the config and skip the generation of it, the script will now quit!".red exit(65) end puts "RUNNING IN SIMULATION MODE!".pink if $simulate # If this isn't a simulation ... unless $simulate # ... check if the script is running as root, if it isn't: warn the user! puts "WARNING!!!\nThis script should be run with root privileges!\n".pink unless is_root? end # Add a / to the end of the install path if it's missing $install_dir << '/' unless $install_dir[-1,1] == '/' # Add quotes if the ID is a name $DEFAULT_ID = "'#{$DEFAULT_ID}'" unless is_numeric? $DEFAULT_ID end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process; end", "def post_process\n end", "def pre_process\n end", "def after_processing\n end", "def pre_loop; end", "def on_begin_process()\n # subclasses may override this method \n end", "def preloop\n end", "def start_processing\n @ran = true\n @sta...
[ "0.7112163", "0.70254964", "0.69968617", "0.6934751", "0.69235975", "0.68107754", "0.67945665", "0.677695", "0.6664655", "0.6637299", "0.6608766", "0.6605591", "0.6605591", "0.6605591", "0.6605591", "0.6605591", "0.6605591", "0.6605591", "0.6605591", "0.6541349", "0.6499194",...
0.0
-1
The main method, it mainly just calls other methods
def main generate_config unless $dont_gen_conf if $just_gen_conf puts "\nSkips installing, just generated the config file!".pink exit(0) end install_dependencies if $install_req install_to_directory end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\n end", "def main\n end", "def main; end", "def run_main\n end", "def main\n\nend", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run\n end", "def run\n end...
[ "0.8221748", "0.81297386", "0.81054175", "0.7850456", "0.7548115", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7453587", "0.7436631", "0.7436631", "0.73045814", "0.7298101", "0.7298101", "0.7298101", "0.7298101", ...
0.0
-1
Method for generating the config file
def generate_config # Tell the user what's going on puts "> Generating the config file".green config = <<CONF_END # Configuration for the ServerUtility # Created by Christopher Hindefjord - chris@hindefjord.se - http://chris@hindefjord.se - 2014 # Licensed under the MIT License (see LICENSE file) DEFAULT_ID = #{$DEFAULT_ID} BASE_PATH = '#{$BASE_PATH}' BASE_PATH_MAIL = BASE_PATH + 'maildir/' BASE_PATH_HOME = BASE_PATH + 'home/' USER_PATH = '%domain/mails/%user' MAILBOX_RIGHTS = 0770 # "ug=wrx" DB_DATABASE_NAME = '#{$DB_NAME}' DB_ACCOUNTS_TABLE = '#{$DB_ACC_TABLE}' DB_DOMAINS_TABLE = '#{$DB_DOM_TABLE}' DB_ALIAS_TABLE = '#{$DB_VIRT_TABLE}' DB_USER = '#{$DB_USER}' DB_PASSWORD = '#{$DB_PASSWORD}' CONF_END # If this is a simulation if $simulate puts "We're not writing to a file, so here's the config file in text:".green # Just output the config file print config.yellow # Not a simulation else # Open a "file stream" and write to it File.open(CONFIG_FILE, 'w') { |f| f.write config } # Tell the user puts "> Wrote the config to '#{CONFIG_FILE}'.".green end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_app_config_file\n filename = 'config/init/app_config.rb'\n bakname = 'config/init/app_config.rb~'\n File.delete(bakname) if File.exist?(bakname)\n File.rename(filename, bakname) if File.exist?(filename)\n File.open(filename, \"w\") do |file|\n file.puts(app_config_content)\n end\n e...
[ "0.72982734", "0.70215833", "0.6900366", "0.68459386", "0.682383", "0.6743956", "0.6691067", "0.66722584", "0.66546106", "0.6647939", "0.66059834", "0.65895116", "0.6569773", "0.65546113", "0.6552749", "0.65345174", "0.6518721", "0.6518721", "0.6516246", "0.649913", "0.649775...
0.63485736
26
Method for installing the scripts
def install_to_directory # Get the current directory curr_dir = FileUtils::pwd + '/' # Use FileUtils fu = FileUtils # If we're just running as a simulation if $simulate # Use ::DryRun, that just echoes the commands, instead of the normal FileUtils fu = FileUtils::DryRun # ::DryRun / ::NoWrite end # Tell the user puts "Installing the files to ".green + $install_dir.yellow puts " (Keeping the .rb extensions) ".green if $keep_extensions # Go through the files files = ['deleteemailalias.rb','addemailalias.rb','listemailaliases.rb', 'deleteemaildomain.rb','addemaildomain.rb','deleteemailaccount.rb', 'listemailaccounts.rb','addemailaccount.rb','generate_password.rb'] files.each { |f| # Remove the extenstion (unless we should keep it) nf = $keep_extensions ? f : f[0..-4] # Tell the user puts "> Linking ".green + "#{curr_dir}#{f}".yellow + ' to '.green + "#{$install_dir}#{nf}".yellow if $force_install puts "Forcing the install of #{nf}!".red # Link the file fu.ln_sf curr_dir + f, $install_dir + nf else begin # Link the file fu.ln_s curr_dir + f, $install_dir + nf rescue Exception => e puts "Couldn't link the file:".pink puts e.message.red next end end puts "> Adding 'execute permission' to the file".green # adding "execute permission" fu.chmod "a+x", $install_dir + nf } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install\n bin.install \"SwiftyScripts\"\n end", "def install\n #python executable files\n end", "def install\n end", "def install\n bin.install \"testscript\"\n end", "def install\n end", "def install\n end", "def install\n end", "def install\n \n end", "def instal...
[ "0.7948659", "0.7908039", "0.7678121", "0.7665955", "0.7599443", "0.7599443", "0.75111955", "0.74700797", "0.7446458", "0.71901506", "0.70874876", "0.70518905", "0.70062315", "0.69480234", "0.6936792", "0.69364893", "0.69330424", "0.6922226", "0.6887", "0.68404037", "0.679434...
0.0
-1
Method that install dependencies
def install_dependencies # sudo apt-get install postgresql-client libpq5 libpq-dev # sudo apt-get install ruby1.9-dev # sudo apt-get install make # Install the pg gem puts "> Installing the pg gem".green system "gem install pg" unless $simulate # Install the nokogiri gem puts "> Installing the nokogiri gem".green system "gem install nokogiri" unless $simulate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_dependencies\n raise 'Not implemented'\n end", "def install\n install_gems(dependencies)\n end", "def install\n result = @dependency_manager.install_dependencies\n if @dependency_manager.should_install?('libvirt')\n result = result.and_then { install_vagrant_plugins }\n ...
[ "0.821859", "0.81524444", "0.7730848", "0.7679064", "0.76565045", "0.7591259", "0.7537699", "0.7523247", "0.7523247", "0.75204253", "0.73491365", "0.73258346", "0.72275347", "0.71224827", "0.7064686", "0.70336425", "0.7027231", "0.7022794", "0.70152634", "0.7000755", "0.69858...
0.68432254
37
dup used because yaml generation is upstream and dont want string refs
def required_value(key) unless key?(key) fail Error.new("meta object does not have key #{key}") end value_term = self[key] fail Error.new("meta object with key #{key} is null") if value_term.nil? return value_term.dup unless value_term.is_a?(DSLTerm) unless value_term.is_known?() fail Error.new("meta object with key #{key} has unknown value") end value_term.value.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize_dup(new_obj)\n super(new_obj)\n new_obj.reset_yaml_repr\n end", "def soft_copy\n StringDoc.from_structure(@structure, node: @node ? Utils::Dup.deep(@node) : nil)\n end", "def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end", "def ...
[ "0.59995216", "0.5708191", "0.5673725", "0.56634474", "0.5612476", "0.5549194", "0.5525119", "0.54872465", "0.5416135", "0.5397123", "0.5397123", "0.53888726", "0.5369148", "0.5344843", "0.53355056", "0.53028756", "0.52686936", "0.526509", "0.5251736", "0.520154", "0.51792455...
0.0
-1
functions to convert to object form
def reify(hash) type = index(hash, :type) content = klass(type).new(nil, @context, reify: true, def: index(hash, :def)) DSLStructObject.new(type, content, reify: true, required: index(hash, :required)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert(object); end", "def to_obj; end", "def convert\n self.class.convert(object)\n end", "def convert\n return unless should_convert?\n\n object_magic = MagicObjects.get_magic(object)\n {\n _magic: object_magic\n }\n end", "def convert\n end", "def convert\...
[ "0.8137619", "0.76630086", "0.7139108", "0.6942121", "0.68574375", "0.68574375", "0.6653392", "0.6627016", "0.6519122", "0.6519122", "0.6518692", "0.6518692", "0.6518692", "0.6518692", "0.64451873", "0.6367492", "0.63662124", "0.62963957", "0.62726593", "0.6257037", "0.618514...
0.0
-1
functions to treat object functions can be overwritten
def object_attributes [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extend_object(obj) end", "def overrides; end", "def overrides=(_arg0); end", "def decorated_object_behavior\n #code\n end", "def set_functions\n super\n end", "def set_additional_values(object, override)\n override.class.attributes.each do |o|\n object.instance_variable_se...
[ "0.6792109", "0.66790175", "0.6595069", "0.6375371", "0.6331271", "0.63288015", "0.61790675", "0.6178664", "0.61783904", "0.6163917", "0.59681374", "0.5968119", "0.5966603", "0.5966603", "0.5966603", "0.5966603", "0.5947337", "0.5947337", "0.59389734", "0.58960724", "0.585597...
0.0
-1
since yaml generator is being used want to remove references so dont generate yaml with labels
def yaml_form(level = 1) ret = RenderHash.new each do |k, v| if level == 1 && k == 'version' next end converted_val = if v.is_a?(RenderHash) v.yaml_form(level + 1) elsif v.is_a?(Array) v.map { |el| el.is_a?(RenderHash) ? el.yaml_form(level + 1) : el.dup? } else v.dup? end ret[k.dup?] = converted_val end ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yaml_file?; end", "def labels(labels)\n super.transform_keys { |key| \"#{label_base}/#{key}\" }\n end", "def to_yaml(indent_space_count = 0)\n yaml = \"\"\n longest_label_mapping_length =\n @label_mappings.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.t...
[ "0.596386", "0.5891122", "0.5736131", "0.5722176", "0.5722176", "0.5719107", "0.5652693", "0.5642293", "0.5624891", "0.5614041", "0.56026864", "0.55746317", "0.557014", "0.55446446", "0.5536884", "0.55272967", "0.55272967", "0.55195504", "0.55195504", "0.55165833", "0.5516583...
0.0
-1
GET /draughts/1 GET /draughts/1.xml
def show @draught = Draught.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @draught } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dosages = @drug.dosages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dosages }\n end\n end", "def show\n @dosage = Dosage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render...
[ "0.6283135", "0.60884476", "0.6050694", "0.60105574", "0.60098296", "0.60012746", "0.5982629", "0.59555787", "0.5954819", "0.5941296", "0.5888862", "0.5855767", "0.5851589", "0.5834053", "0.5828471", "0.5817916", "0.58000594", "0.57977843", "0.57918894", "0.57836664", "0.5769...
0.7094706
0
GET /draughts/new GET /draughts/new.xml
def new @draught = Draught.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @draught } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @pdig = Pdig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pdig }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n...
[ "0.6932118", "0.69312865", "0.69154453", "0.68863434", "0.67597985", "0.67586166", "0.6743395", "0.6729142", "0.67115295", "0.6679006", "0.6667036", "0.66662925", "0.66662925", "0.6659162", "0.66588444", "0.665296", "0.66417825", "0.6630996", "0.66271627", "0.6614821", "0.661...
0.76069915
0
POST /draughts POST /draughts.xml
def create @draught = Draught.new(params[:draught]) respond_to do |format| if @draught.save format.html { redirect_to(@draught, :notice => 'Draught was successfully created.') } format.xml { render :xml => @draught, :status => :created, :location => @draught } else format.html { render :action => "new" } format.xml { render :xml => @draught.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_nodes_with_root\n serialize_service.post_nodes_serialized\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def new\n @draught = Draught.new\n\n respond_to do |format|\n format.html # new.ht...
[ "0.5671842", "0.54849285", "0.54796183", "0.5361587", "0.5339464", "0.5323506", "0.5316165", "0.53116584", "0.53116584", "0.53116584", "0.5301011", "0.5293941", "0.52748746", "0.5268699", "0.5263344", "0.52582574", "0.52415663", "0.52184063", "0.5213559", "0.5213559", "0.5213...
0.6664184
0
PUT /draughts/1 PUT /draughts/1.xml
def update @draught = Draught.find(params[:id]) respond_to do |format| if @draught.update_attributes(params[:draught]) format.html { redirect_to(@draught, :notice => 'Draught was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @draught.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def put_datastream(pid, dsID, xml)\n uri = URI.parse(@fedora + '/objects/' + pid + '/datastreams/' + dsID ) \n RestClient.put(uri.to_s, xml, :content_type => \"app...
[ "0.6425696", "0.6214337", "0.5950191", "0.5719625", "0.5689883", "0.5662172", "0.561635", "0.5515727", "0.55075395", "0.5421879", "0.54208404", "0.5402073", "0.53854865", "0.5378695", "0.5376122", "0.5359278", "0.535494", "0.53532076", "0.5350234", "0.53216314", "0.53129655",...
0.62973785
1
DELETE /draughts/1 DELETE /draughts/1.xml
def destroy @draught = Draught.find(params[:id]) @draught.destroy respond_to do |format| format.html { redirect_to(draughts_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n en...
[ "0.6738604", "0.6728645", "0.6677141", "0.6654592", "0.64447856", "0.6406554", "0.6355638", "0.63402754", "0.629638", "0.62874347", "0.6262077", "0.62603813", "0.6254528", "0.6242718", "0.6228138", "0.620896", "0.61949956", "0.6193239", "0.61789554", "0.6176304", "0.6174356",...
0.6833443
0
Log the user in on the given connection.
def login(connection) mechanism = user.mechanism || :scram conversation = Conversation.new(user, mechanism) converse_multi_step(connection, conversation).tap do unless conversation.server_verified? raise Error::MissingScramServerSignature end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n make_login_call\n end", "def login(connection)\n nonce = connection.dispatch([ nonce_message(connection) ]).documents[0]\n reply = connection.dispatch([ login_message(connection, nonce[Auth::NONCE]) ])\n raise Unauthorized.new(user) if reply.documents[0]['ok'] == 0\n ...
[ "0.6895968", "0.6754662", "0.6687955", "0.6679056", "0.6614269", "0.6593452", "0.65558773", "0.65300244", "0.6483563", "0.6469603", "0.6463645", "0.64265937", "0.64188594", "0.6405681", "0.6385227", "0.6365883", "0.63460773", "0.63376784", "0.6330229", "0.63159394", "0.630932...
0.5958988
86
================================= API Handler =================================
def get_client_customer_id adwords.credential_handler.credentials[:client_customer_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handler; end", "def handler; end", "def handle; end", "def handlers; end", "def handlers; end", "def handlers; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def r...
[ "0.7832852", "0.7832852", "0.7449044", "0.7282885", "0.7282885", "0.7282885", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.71706814", "0.7156938", "0.707975", "0.69875634", "0.69...
0.0
-1
def completed_payment_request flash[:notice] = "Payment Completed" redirected_to root_url end
def ipn_notification @params = params ipn = PaypalAdaptive::IpnNotification.new ipn.send_back(env['rack.request.form_vars']) if ipn.verified? @payment= PaymentDetail.new @payment.transaction_id = params["transaction"]["0"][".id_for_sender_txn"] @payment.sender_email = params["sender_email"] @payment.receiver_email = params["transaction"]["0"][".receiver"] @payment.date = params["payment_request_date"] @payment.charitytype = params["charitytype"] @payment.amount = params["transaction"]["0"][".amount"].scan(/\d+/).first.to_f @payment.user_id = params["userid"].to_i @payment.bet_id = params["betid"].to_i @payment.save else logger.info "IT DIDNT WORK" end render nothing: true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_processing\n if params['redirect_status'] == 'succeeded'\n flash[:success] =\n 'Payment submitted. Thank you! Please wait a moment and refresh to see your dues updated.'\n else\n flash[:error] =\n 'Payment could not be submitted. Please contact a director for furt...
[ "0.83876", "0.8112654", "0.74684227", "0.7398737", "0.736164", "0.7339513", "0.73270047", "0.7322433", "0.72328514", "0.7166413", "0.7134751", "0.7124001", "0.70844966", "0.70508856", "0.70429134", "0.70363975", "0.7021532", "0.70176566", "0.7002597", "0.6948212", "0.69447887...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def payment_params params.permit(:transaction_id, :sender_email, :receiver_email, :date, :charitytype, :amount) 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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Simple CRUD system which can display, create, update and delete items, with strong paramaters.
def index @news = News.all @news = News.order(created_at: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crud *args\n @crud = args.first if args.size > 0\n end", "def item_edit\n end", "def edit\n @item = Item.find_by_id( params[:id] )\n render :layout => 'form'\n end", "def edit\n\t\t@item = Item.find(params[:id])\n \tend", "def edit\n \n end", "def edit; end", "def edit; end",...
[ "0.6287214", "0.61665845", "0.6156859", "0.61183", "0.60964787", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "0.60398203", "...
0.0
-1
TODO: Handle cases where users input letters in the phone number and convert them to numbers
def standardized_phone_number @standardized_phone_number ||= phone_number.gsub(/\D/, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phone_number_value\n # byebug\n\n if self.phone_number.present?\n numbers_array = self.phone_number.split(\",\")\n numbers_array.each do |nn|\n nn = nn.gsub(\"-\",\"\").gsub(\"+91\",\"\").gsub(\" \",\"\") \n # byebug\n if nn.to_i.to_s.length != 10\n # byebug\n ...
[ "0.74693704", "0.72517943", "0.7243458", "0.72420037", "0.72218364", "0.72218364", "0.72218364", "0.72218364", "0.72119087", "0.72119087", "0.72119087", "0.72119087", "0.7211758", "0.72072256", "0.7202681", "0.71858484", "0.7153181", "0.7089043", "0.7025552", "0.7024536", "0....
0.7007507
20
The math:product operator takes a list of strings or numbers and calculates their sum.
def resolve(list) list.to_a.map(&:as_number).reduce(&:*) || RDF::Literal(1) # Empty list product is 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(numbers)\n numbers.inject(1) { |result, num| num.is_a?(Numeric) ? result * num : result }\n end", "def product(numbers)\n numbers.reduce(1) { |acc, x| acc * x }\nend", "def product\n reduce(1, &:*)\n end", "def product(*args)\n args.map! { |x| Rubinius::Type.coerce_to(x, Array, :t...
[ "0.7075096", "0.6688627", "0.6629959", "0.6627172", "0.6562222", "0.6562222", "0.6504922", "0.6493308", "0.6493308", "0.6465379", "0.6429297", "0.6404628", "0.63858753", "0.63440025", "0.6327277", "0.63189596", "0.6308746", "0.62574786", "0.6252115", "0.6240628", "0.62249875"...
0.0
-1
Iterate through a directory and parse only child directories which may contain image files
def ingest(base_directory) Dir["#{base_directory}/*"].sort.each do |entry| next unless File.directory?(entry) bib_id = File.basename(entry) ingest_directory(directory: entry, property_value: bib_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_directory(dir, files, rec)\n dir.children(true).each do |f|\n # ignore sub-directories\n if f.directory?\n if rec == false\n next\n else\n process_directory(f.expand_path, files, rec)\n end\n end\n pro...
[ "0.68725544", "0.6592337", "0.6567606", "0.6497233", "0.64896446", "0.63876545", "0.6362896", "0.63205266", "0.63143784", "0.62979996", "0.6236861", "0.62183404", "0.61945397", "0.61721295", "0.6152671", "0.61238337", "0.60739934", "0.6070966", "0.6065427", "0.6060353", "0.60...
0.0
-1
Retrieves the metadata adapter for persisting and indexing resources
def metadata_adapter Valkyrie::MetadataAdapter.find(:indexing_persister) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata_adapter\n Valkyrie.config.metadata_adapter\n end", "def metadata_adapter\n Valkyrie.config.metadata_adapter\n end", "def adapter\n persisters.first.adapter\n end", "def adapter\n @adapter\n end", "def adapter\n self.class.adapter\n end", "def adapter\n ...
[ "0.75736445", "0.75736445", "0.658445", "0.6121918", "0.6099217", "0.59822226", "0.5945053", "0.58910155", "0.58571726", "0.58406955", "0.572652", "0.5716334", "0.5690776", "0.56458926", "0.56413984", "0.5635436", "0.5627773", "0.5625865", "0.5563711", "0.55622435", "0.556172...
0.76079375
1
Determine whether or not the jobs should be performed asynchronously
def background? @background end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_do_job_async?(job)\n !! job.queue['async']\n end", "def execute_async?\n @execution_mode == :async\n end", "def asynchronous?() false end", "def asynchronous?\n @asynchronous\n end", "def async?\n false\n end", "def async?\n @args.include? :async\n end", ...
[ "0.78570837", "0.7383451", "0.73756176", "0.73608947", "0.73061776", "0.7104061", "0.70827585", "0.70266473", "0.69515127", "0.68877864", "0.66035026", "0.6600658", "0.6515302", "0.6475265", "0.64233196", "0.6405596", "0.6404681", "0.6394115", "0.63848174", "0.6383623", "0.63...
0.0
-1
Parse and extract a numeric index from a file path
def extract_index(image_entry) index_m = /\/(\d+)\./.match(image_entry) unless index_m @logger.warn "Failed to parse the index integer from #{image_entry}" return end index_value = index_m[1] index = index_value.to_i index - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_path (path)\n\tbasename = File::basename(path)\n\treturn basename.to_i\nend", "def get_idx(basename)\n idx = basename[/^\\d+_/].gsub(\"_\", \"\")\n idx\nend", "def index\n history = File.open(@current)\n line = history.readline.rstrip\n line =~ /(\\d+)$/ # get the index\n $1.to_i\n ...
[ "0.69597447", "0.66958034", "0.6566613", "0.626697", "0.61733425", "0.6148153", "0.6099197", "0.6009716", "0.5889263", "0.5885259", "0.5862515", "0.5723412", "0.57170457", "0.5607588", "0.55990726", "0.5579833", "0.55775934", "0.5531577", "0.55045545", "0.54941595", "0.548914...
0.7098939
0
Use callbacks to share common setup or constraints between actions.
def set_recurso @recurso = Recurso.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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def recurso_params params.require(:recurso).permit(:nombre,:tipe,:description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
How many people need be in a group until it is more likely than not that 2 people share a birthday?
def most_likely prob = 0 num_people = 1 until prob > 0.5 num_people += 1 prob = give_prob_with_n_people(num_people) end num_people end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amount_of_people_alive_in(year)\n amount = 0\n\n each { |person| amount += 1 if person.alive_in?(year) }\n\n amount\n end", "def test_number_of_people_in_group\n group_size = @group2.people() #speak to instructor about output\n assert_equal(6, group_size.count)\n end", ...
[ "0.65791106", "0.63876307", "0.62031907", "0.59887207", "0.597206", "0.597163", "0.5906007", "0.57534623", "0.57272846", "0.5724294", "0.5690113", "0.5683532", "0.5678379", "0.5669555", "0.55967575", "0.5592429", "0.55762285", "0.55699736", "0.5562578", "0.55494034", "0.55366...
0.60354745
3
You may not provide any solution that requires you to sort the result array. You must build the result array one element at a time in the proper order. Your solution should not mutate the input arrays. =begin Problem: Input: 2 arrays => Output: 1 new array (sorted) Return a sorted array which contains the elements of both input arrays (parameters) Can't use sort method on result array, must build by one element at a time Handle empty array Examples: see below Data Structures: array of integers Algorithm: create mixed array = array 1 plus array 2 sort the mixed array: compare current number with next number loop until no swap happens between items iteration: one less time than mixed_array size check if current number is smaller or equal to next number if yes: no swap go to check next number and the following one (increment) if it's bigger: swap happens swap the two numbers go to next iteration (increment) return mixed array =end
def merge(array1, array2) mixed_array = array1 + array2 loop do swap = false current_number = 0 next_number = 1 (mixed_array.size - 1).times do if mixed_array[current_number] <= mixed_array[next_number] current_number += 1 next_number += 1 next else mixed_array[current_number], mixed_array[next_number] = mixed_array[next_number], mixed_array[current_number] current_number += 1 next_number += 1 swap = true end end break if swap == false end mixed_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def combine_arrays(arr1, arr2)\r\n combo = arr1 + arr2 # and unsorted combo of arr1 and arr2\r\n length = combo.length\r\n sort = [] # set up array variable for eventual return.\r\n\r\n while sort.length < length # loops until an equal amount of elements are pushed to sort as exist in combo. this is unncessary...
[ "0.792749", "0.77646095", "0.75958574", "0.7575984", "0.7567537", "0.75599414", "0.75543886", "0.7518542", "0.7515518", "0.73987615", "0.7388406", "0.7381034", "0.73644066", "0.7363527", "0.73584086", "0.7347672", "0.73318464", "0.732492", "0.7317562", "0.73167425", "0.731436...
0.78338873
1
Respond with the cached value if available.
def to_param_from_cache read_attribute(friendly_id_config.cache_column) || id.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_value?; end", "def cache_hit(response)\n response\n end", "def cached?; end", "def cache_response(resource, single_resource)\n super resource, false\n end", "def assert_cached(res, value=nil)\n if value\n assert_header res, \"Cache-Control\", value\n else\n ass...
[ "0.73815256", "0.71255493", "0.7002228", "0.66683453", "0.65971303", "0.64549154", "0.64418244", "0.63501114", "0.6339877", "0.63276154", "0.630693", "0.6295398", "0.6293652", "0.62643796", "0.6234615", "0.6234615", "0.6207571", "0.618605", "0.61770487", "0.61398983", "0.6107...
0.0
-1
Respond with the slugged value if available.
def to_param_from_slug slug? ? slug.to_friendly_id : id.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slug\n @slug ||= begin\n raw = self['identifier'].find { |id| id.start_with?('slug:') }\n Spot::Identifier.from_string(raw).value unless raw.nil?\n end\n end", "def slug\n fetch[:slug]\n rescue NoMethodError\n nil\n end", "def slug; end", "def slug; en...
[ "0.69048667", "0.6851793", "0.6738965", "0.6738965", "0.67166185", "0.66388965", "0.6618099", "0.6618099", "0.6600208", "0.6572358", "0.6560955", "0.6552167", "0.6506399", "0.6503191", "0.64602304", "0.645676", "0.6452446", "0.644089", "0.6440094", "0.64306206", "0.64306206",...
0.0
-1
Build the new slug using the generated friendly id.
def build_a_slug return unless new_slug_needed? @slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self), :sluggable => self @new_friendly_id = @slug.to_friendly_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_slug\n return unless new_slug_needed?\n @slug = slugs.new(:name => slug_text, :scope => friendly_id_config.scope_for(self))\n raise FriendlyId::BlankError unless @slug.valid?\n @new_friendly_id = @slug.to_friendly_id\n @slug\n end", "def build_slug\n retur...
[ "0.8887277", "0.8755437", "0.83461845", "0.82203096", "0.8081627", "0.79119086", "0.7889298", "0.78659713", "0.78208816", "0.78205913", "0.7709957", "0.7705441", "0.76938474", "0.7678501", "0.76526", "0.76525885", "0.7651956", "0.7651956", "0.7553107", "0.7543858", "0.7542397...
0.8658271
2
Reset the cached friendly_id?
def new_cache_needed? uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfriendly_id?; end", "def set_slug_cache\n if new_cache_needed?\n send \"#{friendly_id_config.cache_column}=\", slug.to_friendly_id\n send :update_without_callbacks\n end\n end", "def set_slug_cache\n if new_cache_needed?\n self.attribute_set(friendly_i...
[ "0.70568943", "0.660705", "0.6580158", "0.6539399", "0.64795756", "0.63255644", "0.6104099", "0.6065717", "0.603738", "0.6019688", "0.5969543", "0.58977616", "0.58650225", "0.5789044", "0.5776159", "0.57738984", "0.57734954", "0.5753693", "0.57215625", "0.5711591", "0.5711591...
0.0
-1
Reset the cached friendly_id.
def set_slug_cache if new_cache_needed? begin send "#{friendly_id_config.cache_column}=", slug.to_friendly_id update_without_callbacks rescue ActiveRecord::StaleObjectError reload retry end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfriendly_id?; end", "def set_slug_cache\n if new_cache_needed?\n self.attribute_set(friendly_id_config.cache_column, slug.to_friendly_id)\n self.save_self(false) # save!\n end\n end", "def set_slug_cache\n if new_cache_needed?\n send \"#{friendly_id_co...
[ "0.6437696", "0.6263794", "0.62135106", "0.6012492", "0.6007959", "0.5987236", "0.59713906", "0.5893019", "0.5838067", "0.5832873", "0.5830261", "0.581005", "0.5790104", "0.5786108", "0.5774138", "0.57460344", "0.5646104", "0.56074584", "0.556574", "0.55465215", "0.552971", ...
0.61737806
3
Update the slugs for any model that is using this model as its FriendlyId scope.
def update_dependent_scopes return unless friendly_id_config.class.scopes_used? if slugs(true).size > 1 && @new_friendly_id friendly_id_config.child_scopes.each do |klass| Slug.update_all "scope = '#{@new_friendly_id}'", ["sluggable_type = ? AND scope = ?", klass.to_s, slugs.second.to_friendly_id] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_scopes\n if @old_friendly_id != friendly_id\n friendly_id_config.child_scopes.each do |klass|\n Slug.all(:sluggable_type => klass, :scope => @old_friendly_id).update(:scope => friendly_id)\n end\n end\n end", "def update_dependent_scopes\n if slug...
[ "0.71313757", "0.687847", "0.6829958", "0.6639019", "0.6639019", "0.65090513", "0.6413278", "0.64109504", "0.63576865", "0.62225366", "0.6185063", "0.6177294", "0.61025196", "0.60648245", "0.60565877", "0.6015863", "0.600764", "0.6000941", "0.5965204", "0.5959111", "0.5958072...
0.67250615
3
Does the model use slug caching?
def uses_slug_cache? friendly_id_config.cache_column? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end", "def new_cache_needed?\n uses_slug_cache? && slug? && send(friendly_id_config.cache_column) != slug.to_friendly_id\n end", "def new_cache_needed?\n uses_slug_...
[ "0.7942197", "0.7942197", "0.7942197", "0.7441741", "0.74313915", "0.7387396", "0.7259844", "0.69698733", "0.6821392", "0.68009895", "0.66227657", "0.66085875", "0.64450866", "0.64374727", "0.6387143", "0.638442", "0.638442", "0.6350467", "0.6339073", "0.63288456", "0.6321609...
0.79698193
1
2. Assignment 2 with Block
def bubble_sort_by(array) swapped = true while swapped swapped = false (array.length - 1).times do |i| next unless yield(array[i], array[i + 1]) tmp = array[i] array[i] = array[i + 1] array[i + 1] = tmp swapped = true end end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end"...
[ "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257", "0.72051257"...
0.0
-1
Called after every test method runs. Can be used to tear down fixture information.
def teardown # Do nothing end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_teardown; end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def tear...
[ "0.8026111", "0.79549605", "0.79549605", "0.7857582", "0.78457963", "0.78457963", "0.78457963", "0.78457963", "0.78457963", "0.78457963", "0.78457963", "0.78457963", "0.7834715", "0.7834715", "0.77511096", "0.7748903", "0.7748903", "0.7735611", "0.7713685", "0.7712235", "0.77...
0.0
-1
GET /hospitals GET /hospitals.json
def index authorize! :creat, Ward @hospitals = Hospital.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end", "def index\n @hospitals = Hospital.all\n end", "def index\n @hospitalizations = Hospitalization.all\...
[ "0.72499996", "0.7132315", "0.6992541", "0.69657105", "0.68489665", "0.676795", "0.6644071", "0.66138494", "0.6583906", "0.6525727", "0.641462", "0.6395886", "0.639027", "0.6337728", "0.63045585", "0.62724835", "0.6245045", "0.6215571", "0.6213112", "0.61994296", "0.61895084"...
0.6105793
29
GET /hospitals/1 GET /hospitals/1.json
def show authorize! :update, Hospital end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @hospital = Hospital.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hospital }\n end\n end", "def show\n @hospitalization = Hospitalization.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.er...
[ "0.75783706", "0.730289", "0.68833095", "0.6844651", "0.6826415", "0.6690673", "0.66303366", "0.66264254", "0.65897065", "0.65156615", "0.6500072", "0.6490517", "0.6417856", "0.64139533", "0.64064026", "0.63951623", "0.6368262", "0.6348773", "0.6339797", "0.63325447", "0.6257...
0.0
-1
POST /hospitals POST /hospitals.json
def create authorize! :creat, Ward @hospital = Hospital.new(hospital_params) respond_to do |format| if @hospital.save format.html { redirect_to @hospital, notice: 'Hospital was successfully created.' } format.json { render :show, status: :created, location: @hospital } else format.html { render :new } format.json { render json: @hospital.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @hospital = Hospital.new(hospital_params)\n\n respond_to do |format|\n if @hospital.save\n format.html { redirect_to @hospital, notice: 'Hospital added.' }\n format.json { render :show, status: :created, location: @hospital }\n else\n format.html { render :new }\n ...
[ "0.70361704", "0.6590414", "0.6555907", "0.6421231", "0.6364988", "0.63617617", "0.63160163", "0.6300402", "0.62497836", "0.6232692", "0.6227839", "0.61684346", "0.61223596", "0.6014842", "0.5986285", "0.59781", "0.59745663", "0.5948805", "0.59422445", "0.591795", "0.5906178"...
0.55963844
74
PATCH/PUT /hospitals/1 PATCH/PUT /hospitals/1.json
def update authorize! :update, Hospital respond_to do |format| if @hospital.update(hospital_params) format.html { redirect_to @hospital, notice: 'Hospital was successfully updated.' } format.json { render :show, status: :ok, location: @hospital } else format.html { render :edit } format.json { render json: @hospital.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @hospital = Hospital.find(params[:id])\n\n\n respond_to do |format|\n if @hospital.update_attributes(:name=>params[:name],:namefull=>params[:namefull],:description=>params[:description])\n # format.html { redirect_to @hospital, notice: 'Hospital was successfully created.' }\n f...
[ "0.6985167", "0.6976237", "0.6964457", "0.6878142", "0.669773", "0.6601907", "0.65845877", "0.6501893", "0.6467967", "0.64509237", "0.6413244", "0.63894993", "0.63838553", "0.6364263", "0.6347396", "0.6335519", "0.6320596", "0.63157564", "0.6289491", "0.6271661", "0.62622994"...
0.6905609
3
DELETE /hospitals/1 DELETE /hospitals/1.json
def destroy @hospital.destroy respond_to do |format| format.html { redirect_to hospitals_url, notice: 'Hospital was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @hospital = Hospital.find(params[:id])\n @hospital.destroy\n\n respond_to do |format|\n format.html { redirect_to hospitals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hospitalization = Hospitalization.find(params[:id])\n @hospitalization.dest...
[ "0.7884306", "0.76110226", "0.73608476", "0.7192028", "0.7187938", "0.71666694", "0.7146411", "0.710677", "0.7093666", "0.70673984", "0.69837713", "0.69378257", "0.69045174", "0.69009966", "0.68985575", "0.6897652", "0.6894883", "0.6855578", "0.685307", "0.68432856", "0.68379...
0.75467306
2
Use callbacks to share common setup or constraints between actions.
def set_hospital @hospital = Hospital.find(params[:id]) @pharmacies = @hospital.pharmacies @doctors = @hospital.doctors @nurses = @hospital.nurses @pharmacists = @hospital.pharmacists @receptionists = @hospital.receptionists @wards = @hospital.wards 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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def hospital_params params.require(:hospital).permit(:hname, :htellphone, :haddress1, :haddress2, :haddress3, :haddresscode, :haddress) 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
Have field error for
def have_field_error_for(field_id) have_xpath "//span[contains(@class, 'help-block') and contains(@for, '#{field_id}')]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_error(obj, field)\n if obj.errors[field].any?\n content_tag :div,\n obj.errors.messages[field].first,\n class: 'form-error-message'\n end\n end", "def char_form_error(field)\n case field\n when :supername\n \"!! Must be between 3-25 characters.\"...
[ "0.74374765", "0.7336833", "0.73363674", "0.7314489", "0.72046155", "0.7163482", "0.703812", "0.70362324", "0.6972844", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.6856513", "0.68161833", "0.68161833", "0.68161833...
0.6289663
79
Click link with text
def click_link_with_text(text) find(:xpath, "//a[text()='#{text}']").click wait_for_turbolinks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend", "def click(link); end", "def click_link_with_text(link_text, opts = {})\r\n if opts && opts[:index]\r\n elements = find_elements(:link_text, link_text)\r\n elements[opts...
[ "0.8325584", "0.81643134", "0.809693", "0.79819596", "0.79741395", "0.7954145", "0.7922781", "0.7913878", "0.7898759", "0.789422", "0.77926266", "0.7758277", "0.77120227", "0.76382464", "0.75791675", "0.7573132", "0.7516847", "0.75124055", "0.7449993", "0.74488306", "0.738840...
0.82309955
1
Click link containing text
def click_link_containing_text(text) find(:xpath, "//a[contains(text(),'#{text}')]").click wait_for_turbolinks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click_link_with_text(text)\n find(:xpath, \"//a[text()='#{text}']\").click\n wait_for_turbolinks\n end", "def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{text}\")\n\t\t\n\t\t@main_window.click(text)\n\tend", "def click_link_with_text(link_text, opts = {})\r\n if opts && opts[:i...
[ "0.8221687", "0.8071657", "0.7847584", "0.78105396", "0.7750476", "0.77179646", "0.77083117", "0.7697198", "0.7681322", "0.7660108", "0.76217127", "0.7538297", "0.75358385", "0.75263274", "0.7508414", "0.74140894", "0.74072284", "0.7303481", "0.7239499", "0.721811", "0.719691...
0.82607114
0
Click link with href
def click_link_with_href(href) find(:xpath, "//a[@href='#{href}']").click wait_for_turbolinks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def click(link); end", "def click_on_link(selector)\n\n click_link(selector)\n\n end", "def navigate_to_link(link_name)\n find_link(link_name).click\n end", "def click_selenium_test1\n @session.click_link(@link_text)\n end", "def click_web_link(text)\n\t\t@log.debug(\"Clicking web link #{te...
[ "0.8473957", "0.80053747", "0.7532116", "0.74824727", "0.7465279", "0.74251175", "0.7421744", "0.7313708", "0.73130196", "0.7308019", "0.7279807", "0.72171646", "0.71079266", "0.70967394", "0.70627284", "0.7050748", "0.70487714", "0.7005485", "0.6985527", "0.69779176", "0.697...
0.77980715
2
Click delete with href
def click_delete_with_href(href, options={confirm: true}) if options[:confirm] accept_confirm do find(:xpath, "//a[@href='#{href}' and @data-method='delete']").click end else dismiss_confirm do find(:xpath, "//a[@href='#{href}' and @data-method='delete']").click end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_link\n button_tag(t('.delete_row'), name: 'delete_row', class: 'ds_link', id: \"delete_row_#{index}\",\n value: index, 'aria-label' => \"#{t('.delete_row')} #{index}\")\n end", "def clicks_delete_link(link_text)\n link = find_link(link_text)\n ...
[ "0.7819042", "0.7211902", "0.72016805", "0.7025678", "0.7001412", "0.69911695", "0.6981196", "0.6980049", "0.6806646", "0.67839855", "0.67762834", "0.6767708", "0.67503107", "0.67223483", "0.67217153", "0.67047477", "0.67043495", "0.663361", "0.6582122", "0.6555908", "0.65439...
0.7479941
1
Nested form id for
def nested_form_id_for(id_prefix, id_sufix="") if id_sufix.blank? page.evaluate_script(%Q{ $("[id^='#{id_prefix}']").attr("id") }) else page.evaluate_script(%Q{ $("input[id^='#{id_prefix}'][id$='#{id_sufix}']").attr("id") }) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html_form_id\n \"#{@form.name}:#{@screen.name}:#{@name}\"\n end", "def dom_id\n form_node['id']\n end", "def form_element_id\n \"#{self.model_name}_#{self.column_name}\"\n end", "def id\n # Note that below method is from FormTagHelper\n @id ||= field_id(@builder.obje...
[ "0.7535029", "0.7424712", "0.71462613", "0.7032754", "0.69723475", "0.6957319", "0.6780983", "0.6658514", "0.64302117", "0.64262354", "0.64016116", "0.64016116", "0.639192", "0.6354166", "0.6332885", "0.6324081", "0.6298161", "0.62545747", "0.6250802", "0.6138605", "0.6138467...
0.70763487
3
Save and open screenshot
def saos save_and_open_screenshot end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_screenshot\n @suite.p \"-- CAPTURE SCREENSHOT ::\"\n begin\n screenshot_flag = true\n filename = (ENV['REPORTS_DIR'] + \"/\" + self.class.name + '.png')\n @suite.capture_screenshot(filename)\n @suite.p \"-- SCREENSHOT CAPTURED TO: {#{filename}}\"\n screenshot_f...
[ "0.77200437", "0.7689662", "0.76797366", "0.7643434", "0.7630784", "0.76202035", "0.75838566", "0.7551766", "0.7480387", "0.7477133", "0.74537456", "0.7430621", "0.74016726", "0.739385", "0.7388306", "0.7376537", "0.7368984", "0.7342207", "0.72734153", "0.72495204", "0.720061...
0.84713244
0
Save and open page
def saop save_and_open_page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page!\n save_and_open_page\n end", "def page!\n save_and_open_page\n end", "def save_and_open\n return unless File.exist?(session.saved_page_dir)\n\n filename = \"#{session.saved_page_dir}/webrat-#{Time.now.to_i}.html\"\n \n File.open(filename, \"w\") do |f|\n f.write rew...
[ "0.8414777", "0.8414777", "0.7607644", "0.7197824", "0.7191379", "0.7183442", "0.69737047", "0.67624086", "0.6712009", "0.667185", "0.6614702", "0.6609397", "0.6562876", "0.6554701", "0.653877", "0.6513563", "0.6402241", "0.6395148", "0.6376207", "0.6346534", "0.6310275", "...
0.839554
2
GET /users GET /users.json
def index @users = User.all respond_to do |format| format.html # index.html.erb format.xlsx end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.8210063", "0.78731877", "0.78600395", "0.78103924", "0.78053653", "0.76777875", "0.76582843", "0.7632195", "0.75826395", "0.7529077", "0.7487757", "0.7448671", "0.7439283", "0.7437491", "0.74267244", "0.739832", "0.739832", "0.739832", "0.739832", "0.73765147", "0.73729014...
0.0
-1
function UserList return userlist
def index @users = UsersService.UserListAll(params[:page]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getUserList\n @userList\n end", "def get_user_list\n return User.find(:all, :order => 'last_name ASC').collect {|user| [user.full_name, user.id]}\n end", "def users\n unless @users\n userListService = $viewContext.getViewService(OTUserListService.java_class)\n @users = userListService....
[ "0.8257627", "0.81829613", "0.8016019", "0.8016019", "0.79690194", "0.79587615", "0.78936857", "0.78845465", "0.7830973", "0.7781479", "0.7755859", "0.7640669", "0.76237047", "0.7615128", "0.7592315", "0.7575088", "0.75641114", "0.74631065", "0.7429917", "0.742916", "0.742916...
0.6744503
86
function User Detail param userid return user
def show @user = UsersService.findUserById(params[:id]) respond_to do |format| format.html format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend", "def byUid\n @user = User.find(:all, :conditions => [ \"uid = ?\" , params[:id]])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", ...
[ "0.74716234", "0.72709274", "0.7270194", "0.7253276", "0.72298473", "0.722298", "0.7201307", "0.7131601", "0.71101487", "0.7101141", "0.7098619", "0.70812225", "0.70658106", "0.70146304", "0.7013686", "0.7013007", "0.69986635", "0.69975305", "0.6996306", "0.6991026", "0.69884...
0.0
-1
function new return new user
def new @user = User.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def newUser\n end", "def new_user\n User.new({\n email: 'hoge@hoge',\n password: 'hoge',\n password_confirmation: 'hoge'\n })\n end", "def new_user\n\t @user = User.new\t \n\tend", "def new\n \t#declare user variabel with assign new user\n \t@user=User.new\n end", "def newacct...
[ "0.80446655", "0.79521006", "0.7934818", "0.7898353", "0.7842184", "0.783887", "0.78188175", "0.7756252", "0.7727516", "0.77246755", "0.7706143", "0.76445574", "0.7639538", "0.75793034", "0.7537596", "0.7537596", "0.7537596", "0.7537596", "0.7537596", "0.7537596", "0.7537596"...
0.0
-1
function create user form param user form params reutrn create confirm form
def create_form @user = User.new(user_params) # save profile image if user_params.has_key?(:profile) dir = "#{Rails.root}/app/assets/profiles/" FileUtils.mkdir_p(dir) unless File.directory?(dir) profilename = user_params[:name]+ "_" + Time.now.strftime('%Y%m%d_%H%M%S') + "." + ActiveStorage::Filename.new(user_params[:profile].original_filename).extension File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f| f.write(user_params[:profile].read) end @user.profile = profilename end unless @user.valid? render :new else redirect_to :action => "create_confirm", name: @user.name, email: @user.email, password: @user.password, password_confirmation: @user.password_confirmation, role: @user.role, phone: @user.phone, dob: @user.dob, address: @user.address, profile: @user.profile end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_confirm\n \t@name = params[:name]\n @email = params[:email]\n @password =params[:password]\n @password_confirmation = params[:password_confirmation]\n @role = params[:role]\n @dob = params[:dob]\n @phone = params[:phone]\n @address = params[:address]\n @profile = params[:profile...
[ "0.7072652", "0.7036796", "0.6926918", "0.6689666", "0.66696817", "0.6561109", "0.6538904", "0.6536806", "0.6522841", "0.6497217", "0.64796805", "0.64654607", "0.6459573", "0.64535004", "0.6442421", "0.64417267", "0.64390457", "0.6428773", "0.6412283", "0.6401971", "0.6381762...
0.6425789
18
function create user confirm form params user params return create user
def create_confirm @name = params[:name] @email = params[:email] @password =params[:password] @password_confirmation = params[:password_confirmation] @role = params[:role] @dob = params[:dob] @phone = params[:phone] @address = params[:address] @profile = params[:profile] @user = User.new(name: @name, email: @email, password: @password, password_confirmation: @password_confirmation, role: @role, phone: @phone, dob: @dob, address: @address, profile: @profile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n i...
[ "0.73458016", "0.72862244", "0.7267669", "0.7237634", "0.71918875", "0.71902245", "0.71812695", "0.7171335", "0.7167116", "0.71543825", "0.71392107", "0.71349823", "0.711704", "0.71037525", "0.708825", "0.7082577", "0.7081799", "0.70776856", "0.7070121", "0.70626473", "0.7051...
0.75790685
0
function create user params user params return create user
def create isSaveUser = UsersService.createUser(user_params,current_user) if isSaveUser redirect_to users_path, notice: "Successfully User Created!!!." else flash[:error] = "Something wrong in User Create Please Check again." render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create(params)\n if validate_create_user(params)\n db = connect_to_db()\n db.results_as_hash = true\n existing_user = db.execute(\"SELECT id FROM user...
[ "0.8222399", "0.7719442", "0.7678374", "0.7652284", "0.76376104", "0.761268", "0.75893104", "0.7575656", "0.75752574", "0.75142646", "0.74565876", "0.74429023", "0.7423336", "0.74111295", "0.7410174", "0.73870575", "0.73851496", "0.7382093", "0.738037", "0.73695487", "0.73609...
0.0
-1
function user profile params user id return user
def profile @user = UsersService.findUserById(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n @user = UserService.getUserById(params[:id])\n end", "def user_profile\n @current_user = current_user\n\n if params[:id] == 'me'\n @user = @current_user\n else\n @user = User.find_by_id(params[:id])\n end\n end", "def profile\n @user = User.find(params[:id])\n end",...
[ "0.80461", "0.79590464", "0.7793545", "0.7791628", "0.762109", "0.76147765", "0.75381994", "0.7516113", "0.7454513", "0.74306154", "0.7422582", "0.7362226", "0.73584855", "0.7294999", "0.72578263", "0.7197616", "0.7183244", "0.71719414", "0.7165529", "0.71496034", "0.70786405...
0.81306636
0
function user edit params user id return user
def edit_profile @user = UsersService.findUserById(params[:id]) user = UsersService.findUserById(params[:id]) @user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by(:id => the_user_id)\n\tend", "def edit\n \n @user = User.find(params[:id])\n \n end", "def edit\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def edit\n # @user = User.find(params[:i...
[ "0.85504544", "0.8279667", "0.82793087", "0.8169167", "0.8149946", "0.8146444", "0.8146444", "0.80869263", "0.8084625", "0.8074963", "0.8050149", "0.8038552", "0.80316824", "0.80316824", "0.80316824", "0.80316824", "0.8015344", "0.7942396", "0.7941258", "0.79411685", "0.79344...
0.0
-1
function user update profile params user profile params return user profile form params
def update_profile @user_profile_form = UserProfileForm.new(user_profile_params) if user_profile_params[:edit_profile].present? dir = "#{Rails.root}/app/assets/profiles/" FileUtils.mkdir_p(dir) unless File.directory?(dir) profilename = user_profile_params[:name]+ "_" + Time.now.strftime('%Y%m%d_%H%M%S') + "." + ActiveStorage::Filename.new(user_profile_params[:edit_profile].original_filename).extension File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f| f.write(user_profile_params[:edit_profile].read) end @user_profile_form.profile = profilename end unless @user_profile_form.valid? flash[:error] = "Something wrong in User Update Please Check again." render :edit_profile else redirect_to :action => "update_confirm", id: @user_profile_form.id, name: @user_profile_form.name, email: @user_profile_form.email, role: @user_profile_form.role, phone: @user_profile_form.phone, dob: @user_profile_form.dob, address: @user_profile_form.address, profile: @user_profile_form.profile end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_params_update\n params.permit(:name, :profile_id)\n end", "def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = param...
[ "0.78693944", "0.7798288", "0.77875185", "0.77483594", "0.7662395", "0.7533904", "0.74473166", "0.74186337", "0.735722", "0.7351972", "0.7340945", "0.72958076", "0.72921365", "0.72917616", "0.7271624", "0.7266046", "0.72616273", "0.7251025", "0.7248194", "0.72346175", "0.7228...
0.7040856
50
function user profile update confirm params user profile params return user profile confirm data
def update_confirm @id = params[:id] @name = params[:name] @email = params[:email] @role = params[:role] @phone = params[:phone] @dob = params[:dob] @address = params[:address] @profile = params[:profile] @user = UserProfileForm.new(id: @id,name: @name, email: @email, role: @role, phone: @phone, dob: @dob, address: @address, profile: @profile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm\n\t @profiles=@current_user.user_profile.update_attributes(params[:body])\n\tend", "def update\n @user = User.find(params[:id])\n\n redirect_url = params.has_key?(\"admin_fxn\") ? ('/users/' + @user.id.to_s + '/edit') : '/profile'\n\n if params[\"commit\"]\n respond_to do |format|\n ...
[ "0.7633287", "0.73666817", "0.72948295", "0.728732", "0.7061519", "0.70590264", "0.7041489", "0.7037903", "0.7036917", "0.7031817", "0.7024556", "0.69478613", "0.69086", "0.68794876", "0.6867341", "0.6821627", "0.6817725", "0.681111", "0.6807939", "0.680433", "0.68032956", ...
0.7854593
0
function user_profile update params user profile params return update user
def user_update saveupdateProfile = UsersService.updateProfile(user_profile_params) if saveupdateProfile redirect_to users_path, notice: "Successfully Updated!!!." else flash[:error] = "Something wrong in User Update Please Check again." render :edit_profile end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_profile(params = {})\n response = post('account/update_profile.json', params)\n Croudia::Object::User.new(response)\n end", "def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: pa...
[ "0.798056", "0.7879421", "0.7874659", "0.77770436", "0.776316", "0.7751128", "0.77093035", "0.7702343", "0.768173", "0.7660199", "0.7591883", "0.755956", "0.7552598", "0.75425845", "0.75369036", "0.7531838", "0.75068927", "0.7501904", "0.74936014", "0.74657494", "0.7460347", ...
0.7389997
31
function: update password params: update password params
def update_password @password_change_form = UserChangePasswordForm.new(change_password_params) if !@password_change_form.valid? render :change_password else updatePassword = UsersService.updatePassword(change_password_params,current_user) if updatePassword redirect_to users_path, notice: "Successfully Update the Password!!!." else redirect_to change_password_user_path, notice: "New Password and New Confirm Password must be same !!!." end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_with_password(params, *options); end", "def update_with_password(params, *options)\n if encrypted_password.blank?\n update_attributes(params.except(:current_password), *options)\n else\n update_with_password_pass(params)\n end\n end", "def update_with_password(params={})\n para...
[ "0.88845384", "0.81869364", "0.80326307", "0.80326307", "0.7927264", "0.78553087", "0.7818154", "0.7810125", "0.78062105", "0.77667916", "0.77540034", "0.77168864", "0.77168864", "0.77168864", "0.77168864", "0.77168864", "0.77168864", "0.77168864", "0.77168864", "0.77168864", ...
0.0
-1
function user destroy params user id
def destroy UsersService.destroyUser(params[:id],current_user) redirect_to users_path, notice: "Successfully Destroy User!!!." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_user(id)\n #TODO:\n # ADD SOME USER LEVEL TO AVOID THESE\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n\t\tthe_user_id = params[\"id\"]\n \tuser = User.find_by(:id => the_user_id)\n \tuse...
[ "0.8083346", "0.79412735", "0.79037195", "0.7878849", "0.7878849", "0.7878849", "0.7878849", "0.7865073", "0.7839494", "0.7818429", "0.7815129", "0.7809204", "0.78020203", "0.78006876", "0.77764946", "0.77738136", "0.777045", "0.77650315", "0.77613884", "0.7748374", "0.774655...
0.77574736
19
function search user params search user form return search user
def search_user @users = UsersService.searchUser(params) render :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_search(params = {})\n last_name.set params[:last_name] unless nil_or_empty? params[:last_name]\n login_id.set params[:login] unless nil_or_empty? params[:login]\n site_name.set params[:site] unless nil_or_empty? params[:site]\n site_group_select.select unless nil_or_empty? params[:site...
[ "0.77350354", "0.7302145", "0.723552", "0.71950233", "0.7185186", "0.7117412", "0.7089622", "0.7080442", "0.70281285", "0.7002526", "0.6996915", "0.6989715", "0.69478005", "0.6914797", "0.68946207", "0.6870381", "0.686944", "0.68245965", "0.6803459", "0.6800852", "0.6767098",...
0.6901922
14
Initializes compression context with appropriate client/server defaults and maximum size of the dynamic table.
def initialize(**options) default_options = { huffman: :shorter, index: :all, table_size: 4096, } @table = [] @options = default_options.merge(options) @limit = @options[:table_size] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression_server; end", "def compression_client; end", "def default_compression=(_arg0); end", "def default_compression; end", "def initialize\n @max_resource_size = 10_000_000\n end", "def all_virtual_compression_statistics\n super\n end", "def initialize(connect_type=:local,...
[ "0.6460405", "0.6405653", "0.6070299", "0.59256613", "0.5825303", "0.57842004", "0.562933", "0.55439466", "0.54985374", "0.54985374", "0.54958445", "0.54646456", "0.5443533", "0.5392482", "0.5392482", "0.5390198", "0.5369144", "0.53290343", "0.531825", "0.5308749", "0.529447"...
0.58170295
5
Duplicates current compression context
def dup other = EncodingContext.new(@options) t = @table l = @limit other.instance_eval do @table = t.dup # shallow copy @limit = l end other end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compressor; end", "def compression; end", "def compression; @store.compression; end", "def compress!; end", "def compression_server; end", "def compression?; end", "def compression_method; end", "def compression_client; end", "def compression\n unless defined?(@compression)\n @compressi...
[ "0.6546452", "0.64980227", "0.6387318", "0.63269174", "0.61594063", "0.60491365", "0.60294604", "0.59738606", "0.5961093", "0.5952711", "0.59513396", "0.59117335", "0.5864702", "0.583543", "0.56966794", "0.5676949", "0.56518984", "0.5576309", "0.55552036", "0.55089813", "0.55...
0.5011726
53
Finds an entry in current dynamic table by index. Note that index is zerobased in this module. If the index is greater than the last index in the static table, an entry in the dynamic table is dereferenced. If the index is greater than the last header index, an error is raised.
def dereference(index) # NOTE: index is zero-based in this module. value = STATIC_TABLE[index] || @table[index - STATIC_TABLE.size] fail CompressionError, 'Index too large' unless value value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(index_key)\n index[index_key]\n end", "def get_at_index(index)\r\n curr = @head\r\n count = 0 \r\n\r\n while count < index && curr\r\n count += 1\r\n curr = curr.next \r\n end\r\n\r\n if count == index \r\n return curr.data \r\n else \r\n ...
[ "0.6147358", "0.5945045", "0.580465", "0.57859826", "0.5743969", "0.57144964", "0.56959313", "0.56636757", "0.56596476", "0.5587435", "0.55722684", "0.5571049", "0.5518987", "0.5486305", "0.54854584", "0.5450515", "0.5448569", "0.54339105", "0.54325074", "0.5414161", "0.54047...
0.6974224
0
Emits command for a header. Prefer static table over dynamic table. Prefer exact match over nameonly match.
def addcmd(*header) exact = nil name_only = nil if [:all, :static].include?(@options[:index]) STATIC_TABLE.each_index do |i| if STATIC_TABLE[i] == header exact ||= i break elsif STATIC_TABLE[i].first == header.first name_only ||= i end end end if [:all].include?(@options[:index]) && !exact @table.each_index do |i| if @table[i] == header exact ||= i + STATIC_TABLE.size break elsif @table[i].first == header.first name_only ||= i + STATIC_TABLE.size end end end if exact { name: exact, type: :indexed } elsif name_only { name: name_only, value: header.last, type: :incremental } else { name: header.first, value: header.last, type: :incremental } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Header(*args)\n Stupidedi::Schema::TableDef.header(*args)\n end", "def click_table_header(header_name, column_name)\n append_to_script \"click_table_header \\\"#(header_name)\\\" \\\"#(column_name)\\\"\"\n end", "def command_header\n header = \"#{command.identity}\"\n header << \" -- #{co...
[ "0.68551075", "0.67816114", "0.6756072", "0.66214377", "0.64044356", "0.64044356", "0.62739456", "0.62634814", "0.6113436", "0.60817295", "0.605765", "0.6009797", "0.6009797", "0.6007592", "0.59589535", "0.5936949", "0.5934648", "0.5930576", "0.5927701", "0.59236294", "0.5910...
0.68032426
1
Alter dynamic table size. When the size is reduced, some headers might be evicted.
def table_size=(size) @limit = size size_check(nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_size=(size)\n @cc.table_size = size\n end", "def table_size=(size)\n @cc.table_size = size\n end", "def size_check(cmd)\n cursize = @table.join.bytesize + @table.size * 32\n cmdsize = cmd[:name].bytesize + cmd[:value].bytesize + 32\n\n cur = 0\n whi...
[ "0.6999835", "0.6999835", "0.6112371", "0.6078422", "0.59587735", "0.5827976", "0.5827976", "0.5821253", "0.57928514", "0.5782264", "0.57492876", "0.566833", "0.5658755", "0.5644129", "0.5617313", "0.5615697", "0.5517085", "0.5514076", "0.5480552", "0.5368979", "0.53593135", ...
0.6872259
2
Returns current table size in octets
def current_table_size @table.inject(0) { |r, (k, v)| r + k.bytesize + v.bytesize + 32 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_size\n @table.size\n end", "def table_size\n @table.size\n end", "def size\n table.size\n end", "def size\n @table.size\n end", "def size\n @table.size\n end", "def size\n @db.get_first_value( \"SELECT COUNT(*) FROM #{TABLE_NAME};\" ).to_i\n end", "def table_si...
[ "0.8225724", "0.8225724", "0.80047995", "0.79198784", "0.7804551", "0.73884606", "0.7242021", "0.71330464", "0.71011496", "0.71011496", "0.7014112", "0.700263", "0.7001837", "0.6987215", "0.6987215", "0.69263893", "0.6916779", "0.69089377", "0.6893272", "0.6893272", "0.686675...
0.8956151
0
Add a namevalue pair to the dynamic table. Older entries might have been evicted so that the new entry fits in the dynamic table.
def add_to_table(cmd) return unless size_check(cmd) @table.unshift(cmd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append(name, val)\n name = name.to_sym\n val = val.to_s\n if @values.key?(name)\n @values[name] << val\n else\n self[name]= val\n end\n val\n end", "def add(aName,aDataArray,aValue,reply)\n i = searchKey(aName,aDataArray[1])\n if i != '' then\n returnStorage(rep...
[ "0.6522959", "0.62602955", "0.61425424", "0.6142344", "0.6114854", "0.6075321", "0.6042804", "0.60148853", "0.59901124", "0.59783864", "0.59582806", "0.59193027", "0.58962566", "0.5882248", "0.5867234", "0.5867234", "0.5850036", "0.5839939", "0.5835118", "0.5818082", "0.58023...
0.0
-1
Set dynamic table size in EncodingContext
def table_size=(size) @cc.table_size = size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def table_size=(size)\n @limit = size\n size_check(nil)\n end", "def table_size_for(entry_count); end", "def set_table_size\n @table_x = @table_reversed[0].size\n @table_y = @table_reversed.size\n end", "def set_sql_buffer_size(size)\n @config[:sql_buffer_size] = size\n end", "...
[ "0.6730487", "0.64728105", "0.6451957", "0.6274105", "0.6182482", "0.61517835", "0.61517835", "0.60989517", "0.5887544", "0.5865577", "0.57516", "0.56910586", "0.5678743", "0.5677725", "0.56458306", "0.5631373", "0.5608171", "0.55893487", "0.55581176", "0.55489445", "0.544982...
0.726892
0
Encodes provided value via integer representation. If I = 128 Encode (I % 128 + 128) on 8 bits I = I / 128 encode (I) on 8 bits
def integer(i, n) limit = 2**n - 1 return [i].pack('C') if i < limit bytes = [] bytes.push limit unless n.zero? i -= limit while (i >= 128) bytes.push((i % 128) + 128) i /= 128 end bytes.push i bytes.pack('C*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode(int)\n masked_int = int & @mask\n result = 0\n @mapping.each_with_index do |b, i|\n result |= (1 << b) if (masked_int & (1 << i)) != 0\n end\n\n return (int & ~@mask) | result\n end", "def encode_uleb128(value)\n raise ArgumentError, \"Signed integers are not su...
[ "0.70199883", "0.69744366", "0.6840506", "0.6722686", "0.6638", "0.6620233", "0.65373", "0.652033", "0.6454385", "0.6395521", "0.63767797", "0.63756675", "0.6304359", "0.6278647", "0.62726283", "0.6251645", "0.6250823", "0.6239963", "0.62339437", "0.621029", "0.615466", "0....
0.6410072
9
Encodes provided value via string literal representation. The string length, defined as the number of bytes needed to store its UTF8 representation, is represented as an integer with a seven bits prefix. If the string length is strictly less than 127, it is represented as one byte. If the bit 7 of the first byte is 1, the string value is represented as a list of Huffman encoded octets (padded with bit 1's until next octet boundary). If the bit 7 of the first byte is 0, the string value is represented as a list of UTF8 encoded octets.
def string(str) plain, huffman = nil, nil unless @cc.options[:huffman] == :always plain = integer(str.bytesize, 7) << str.dup.force_encoding(Encoding::BINARY) end unless @cc.options[:huffman] == :never huffman = Huffman.new.encode(str) huffman = integer(huffman.bytesize, 7) << huffman huffman.setbyte(0, huffman.ord | 0x80) end case @cc.options[:huffman] when :always huffman when :never plain else huffman.bytesize < plain.bytesize ? huffman : plain end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_string(value)\n [value.bytesize, value].pack(\"L>A*\")\n end", "def encode\n s = \"#{@value}\\000\"\n\n n = 0\n @lengths.each do |l|\n s << [@types[n]].pack(\"#{punpack_string(l)}\")\n n += 1\n end\n s\n end", "def string(val)\n val = val.to_s\n\n ...
[ "0.7783764", "0.7556677", "0.7142996", "0.66459244", "0.6623687", "0.6470349", "0.64218134", "0.634321", "0.6327513", "0.63255495", "0.62813073", "0.6268489", "0.6249359", "0.6175414", "0.61428356", "0.61352587", "0.609698", "0.60947096", "0.6025181", "0.59066164", "0.5883613...
0.61943966
13
Encodes header command with appropriate header representation.
def header(h, buffer = Buffer.new) rep = HEADREP[h[:type]] case h[:type] when :indexed buffer << integer(h[:name] + 1, rep[:prefix]) when :changetablesize buffer << integer(h[:value], rep[:prefix]) else if h[:name].is_a? Integer buffer << integer(h[:name] + 1, rep[:prefix]) else buffer << integer(0, rep[:prefix]) buffer << string(h[:name]) end buffer << string(h[:value]) end # set header representation pattern on first byte fb = buffer.ord | rep[:pattern] buffer.setbyte(0, fb) buffer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_header\n # Include Header and encryption version indicator\n flags = @cipher.version || 0 # Same as 0b0000_0000_0000_0000\n\n # If the data is to be compressed before being encrypted, set the\n # compressed bit in the version byte\n flags |= 0b1000_0000_0000_0000 if @compress\n\...
[ "0.6816964", "0.6779552", "0.67109", "0.66448355", "0.6628868", "0.6581902", "0.6562327", "0.65284586", "0.649618", "0.64652216", "0.64319503", "0.6409977", "0.63275754", "0.62981105", "0.62900347", "0.6186424", "0.61738485", "0.6157627", "0.6086973", "0.6039257", "0.5950689"...
0.6653956
3