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
DELETE /vehicle_armies/1 DELETE /vehicle_armies/1.json
def destroy @vehicle_army.destroy respond_to do |format| format.html { redirect_to vehicle_armies_url, notice: (t 'vehicle_armies.title')+(t 'actions.removed') } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to ...
[ "0.74490505", "0.74421865", "0.7384246", "0.7384246", "0.7271506", "0.7171227", "0.7074418", "0.7062491", "0.7062491", "0.70617515", "0.70610195", "0.70610195", "0.70610195", "0.70610195", "0.69880515", "0.69810843", "0.6977454", "0.6972022", "0.6967757", "0.69393635", "0.692...
0.73172456
4
Use callbacks to share common setup or constraints between actions.
def set_vehicle_army @vehicle_army = VehicleArmy.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def vehicle_army_params params.require(:vehicle_army).permit(:v_army_no) 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
Behaves the same as File.dirname from the standard library, except when passed a second argument, n. In this case, dirname is called n times, essentially finding the file's nth parent.
def dirname file_name, n=1 n.times { file_name = _old_dirname(file_name) } return file_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dirname() Path::Name.new(File.dirname(path)) end", "def dirname\n File.dirname(filename)\n end", "def dirname\n File.dirname(filename)\n end", "def dirname( fn )\n ::File.dirname(fn).sub(%r/\\A[^\\/]+\\/?/o, '')\n end", "def dirname(path)\n File.dirname(path)\n end",...
[ "0.64315546", "0.61156213", "0.6018476", "0.5877481", "0.5759991", "0.5744559", "0.56592196", "0.5630027", "0.5505143", "0.54382086", "0.5327235", "0.53073025", "0.5301667", "0.52668536", "0.5137502", "0.5033914", "0.5006094", "0.49970862", "0.49744707", "0.4973133", "0.49430...
0.8302876
0
Converts a string into a valid file name by replacing reserved characters.
def sanitize(file_name, replacement="_") # See http://en.wikipedia.org/wiki/Filename#Reserved_characters_and_words return file_name.gsub(/[\/|\0|\\\?%\*:"<>]/, replacement) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filesystem_safe_name\n name.\n gsub(ReservedCharacters) {|sub| '%%%02X' % sub.ord }.\n gsub(ReservedFilenameRegexp) {|sub| sub.gsub(/[^.]/) {|c| '%%%02X' % c.ord } }\n end", "def fix_name(title)\n result = String.new( title )\n # Replace all invalid characters\n for substitution in $...
[ "0.754329", "0.7450146", "0.7327896", "0.72800845", "0.7246733", "0.7091246", "0.7005828", "0.6967111", "0.693666", "0.6900494", "0.6892696", "0.6807901", "0.6796349", "0.67833716", "0.67274487", "0.6720834", "0.6719827", "0.6714422", "0.6700311", "0.6671916", "0.66450536", ...
0.70906
6
Returns the number of tokens in this text.
def length @tokens.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_tokens()\n @counts = Hash.new(0)\n @tokens.each do |token|\n @counts[token] += 1\n end\n @counts\n end", "def number_of_tokens\r\n return MONOPOLY_GAME[:tokens].count\r\nend", "def word_number\n text.split.size\n end", "def count_tokens(type)\n token_tuples(type).count\nend"...
[ "0.7242187", "0.7057865", "0.7049498", "0.68790025", "0.67769444", "0.67601776", "0.66924983", "0.6657637", "0.6655045", "0.6621071", "0.65733254", "0.64848965", "0.6478677", "0.6475932", "0.6357292", "0.63485956", "0.6332705", "0.6331455", "0.63176686", "0.6304615", "0.62973...
0.77787447
0
appends a single token to the end of this text.
def <<(new_token) @tokens << new_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_token(token)\n process_unknown\n @tokens << token\n @position += token.length\n end", "def text_token text, kind\n @out << text\n end", "def add_extra_token(tok)\n @extra_tokens.push(tok)\n end", "def append_space\n return if @sb_last_was_whitespace\n\n ...
[ "0.70394105", "0.6579808", "0.6335208", "0.62273157", "0.61286646", "0.58965105", "0.58485353", "0.5825494", "0.5797446", "0.5741546", "0.5733852", "0.57329094", "0.57317764", "0.56843024", "0.567202", "0.5655837", "0.5632459", "0.55840707", "0.5575739", "0.5505166", "0.54601...
0.6827971
1
Try to find a single xero record by its xero id
def find_record(xero_id) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_one(id)\n response = request(:get, \"/#{resource_name}/#{id}\")\n #puts response\n construct_record_from_singular(response)\n end", "def find(id); end", "def find(id); end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", ...
[ "0.64689296", "0.63627136", "0.63627136", "0.6335353", "0.6335353", "0.63308114", "0.6325294", "0.6324489", "0.63060206", "0.62488365", "0.62438637", "0.62347865", "0.618941", "0.61826444", "0.61771", "0.6171773", "0.6126213", "0.61185825", "0.6091522", "0.6081643", "0.606306...
0.7981715
0
Try to find a single record by some other predicate Each record type may need a slightly different lookup
def find_record_by(model) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by(**args)\n where(**args).first\n end", "def lookup(predicate)\n hash = crosswalk_hash\n result = hash.select(&find(predicate))\n return result.first unless result.empty?\n end", "def find(predicate)\n filtered = filter_to_array(predicate)\n return nil if filtered....
[ "0.6742034", "0.65746427", "0.652124", "0.64916486", "0.64061916", "0.6363082", "0.63516986", "0.6329928", "0.6293702", "0.6257889", "0.624285", "0.62418455", "0.6212907", "0.6163717", "0.61398023", "0.6096509", "0.6088769", "0.5971114", "0.5958067", "0.5932916", "0.58939534"...
0.5621252
70
Query for a specific type of record using a predicate
def find_records(predicate) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(predicate)\n predicate = class_of predicate\n @set.find {|item| item.is_a? predicate}\n end", "def is_type s, rdf_type\n @subject_types ||= {}\n if @subject_types.has_key? [s, rdf_type]\n @subject_types[s, rdf_type]\n else\n direct_query \"ASK WHERE { <#{s}> a <#{rdf_type}> }\"\n end\nen...
[ "0.6488924", "0.630943", "0.61923885", "0.61918306", "0.5993511", "0.5993511", "0.5957609", "0.58684075", "0.5865582", "0.5865582", "0.5776533", "0.5727638", "0.57067114", "0.5671334", "0.563146", "0.5611301", "0.55389565", "0.5537257", "0.5524043", "0.548871", "0.5486767", ...
0.581817
10
Update a record based on the diff with the local model
def update_record(record, model) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit(diff, value)\n self.record(diff)\n end", "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def update(model)\n id, data = model.primary_key_value, model.changes_for_save\n store.update(id, data, table: table_name)\n end", "def updat...
[ "0.6667564", "0.6306046", "0.62460834", "0.6227222", "0.62146455", "0.61742896", "0.6150635", "0.6113346", "0.6065087", "0.6064845", "0.5976165", "0.59336424", "0.5931565", "0.59181887", "0.5895394", "0.58606786", "0.5840479", "0.5827118", "0.58123684", "0.5804123", "0.580201...
0.0
-1
Create a new xero record. This is called when the find_xero methods return nil
def create_record raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(params = {}, attributes = {})\n raise ArgumentError.new(\"Record already exists for '#{params[:id]}'\") if self.is_exist?(params[:id])\n if self.validates_presence\n self.validates_presence.each do |field|\n raise ArgumentError.new(\"Missing required field '#{field}'\")...
[ "0.6205564", "0.61921287", "0.61640805", "0.6155705", "0.6099409", "0.6047734", "0.603441", "0.60173374", "0.59898525", "0.5988265", "0.59872305", "0.59702504", "0.59666383", "0.5966034", "0.588015", "0.5880089", "0.5878037", "0.5873532", "0.58511186", "0.581118", "0.5809811"...
0.5695655
34
OPTIONAL Update the local status code of the model to match what is in xero. This is needed to avoid status changes that will later cause failure when trying to sync. Example CreditNote: 1. Local status: submitted 2. Remote status: authorized This will be flagged for remote save, but will be updated with the local status of submitted, which will fail xero sync
def sync_local_model_status(model, record) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_status(status)\n self.status = status\n self.save! validate: false\n end", "def set_status\n self.status = Status.find_by(code: \"OPEN\")\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def set_status...
[ "0.69049907", "0.66083694", "0.6511697", "0.65002716", "0.64992464", "0.6466261", "0.64374685", "0.6377628", "0.6367667", "0.6328119", "0.6312454", "0.6278468", "0.6278209", "0.62533057", "0.6251229", "0.62227833", "0.6190832", "0.6148658", "0.6144465", "0.6144465", "0.614016...
0.6694855
1
OPTIONAL Check if this record should be included in the batch save We need to somehow still update the model even if the record should not be saved to xero. This is causing some items to not not archive or void since they the remote server is already voided
def should_save_record?(record, model) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_save\n changed_fields?\n if(@changed_fields && @changed_fields.keys.include?('rmt_product_id') && ((bins = Bin.find_all_by_delivery_id(self.id)).length>0))\n raise \"sorry cannot change rmt_product of this delivery , #{bins.length} bin(s) have already been scanned for this delivery\"\n end...
[ "0.65047795", "0.6364017", "0.6276332", "0.61550593", "0.5994225", "0.5994225", "0.59936094", "0.5985979", "0.58235455", "0.5812989", "0.576609", "0.5761472", "0.5734064", "0.5731392", "0.5731276", "0.5718567", "0.5709049", "0.5705286", "0.5704292", "0.5647444", "0.56390554",...
0.61187327
4
Responsible for finding the local model for this record It is up to the subclass to determine lookup logic or to create a new model if none is found. If nil is returned, the task won't attempt to process the record
def find_model(record) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_model(parent_model, name)\n Roby::Distributed::DRobyModel.anon_model_factory(parent_model, name)\n end", "def find_record\n self.class.model_klass.find(params[:id])\n end", "def find_existing_record\n @record = record_class.find(@locator)\n end", "def find_...
[ "0.603749", "0.5995005", "0.59848475", "0.59848475", "0.5949274", "0.5848526", "0.58224106", "0.58140403", "0.576883", "0.5757326", "0.57531077", "0.57494634", "0.5748348", "0.574255", "0.5742007", "0.5713181", "0.5692753", "0.56859833", "0.567968", "0.56624115", "0.56624115"...
0.61807853
0
Query local models based on last_updated timestamp
def find_models raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_updated\n self.dig_for_datetime(\"lastUpdateOn\")\n end", "def latest_stored_update\n active_model_configurations\n .select(:updated_at)\n .reorder('')\n .order('updated_at desc nulls last')\n .limit(1)\n .pluck(:updated_at)\n .first\n ...
[ "0.6726538", "0.65984106", "0.6496453", "0.6179746", "0.61167836", "0.6106682", "0.61018765", "0.61002785", "0.601975", "0.5984788", "0.59707254", "0.59449846", "0.5910519", "0.59101206", "0.5888773", "0.5863106", "0.58474714", "0.58347046", "0.58101916", "0.5804294", "0.5792...
0.0
-1
Update the local model based on the record
def update_model(model, record) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n record.assign_attributes(data)\n record.save! if record.changed?\n end", "def update(model_data)\n end", "def sync_local_model_status(model, record)\n true\n end", "def update\n upsert do\n # NOTE:\n # 1. update ++then++ valid to set new values in @record to ...
[ "0.70232606", "0.6960855", "0.6915704", "0.6651765", "0.65952986", "0.6541155", "0.64780855", "0.6467646", "0.63877267", "0.63877267", "0.6380397", "0.63756955", "0.63670266", "0.631884", "0.6317961", "0.62795365", "0.62666905", "0.62418365", "0.62305254", "0.62215644", "0.62...
0.6063968
33
Handle post process model
def post_process_model(model) model.mark_synced! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process\n end", "def post_process; end", "def post\n raise NotImplementedError\n end", "def post_task\n end", "def process_post\n true\n end", "def handle_inputs\n collect_inputs(form_model: :post)\n\n if state.post.has_errors?\n set_state post: state.p...
[ "0.7667006", "0.7214776", "0.6657609", "0.6577336", "0.64134496", "0.6403637", "0.6273242", "0.6215441", "0.6150792", "0.61107916", "0.6107989", "0.6065959", "0.60548776", "0.6034995", "0.6032676", "0.60147077", "0.6001319", "0.5976138", "0.5948499", "0.5820877", "0.58141863"...
0.61997324
8
Batch save xero record
def save_records(records) raise_must_override end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n if !persisted?\n gps=EXIFR::JPEG.new(@contents).gps\n @location=Point.new(:lng=>gps.longitude,:lat=>gps.latitude)\n @contents.rewind\n\n description = {}\n description[:content_type]='image/jpeg' \n description[:metadata]={:location=>@location.to_hash} \n\n grid...
[ "0.6062356", "0.59159034", "0.5879312", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58615476", "0.58514076", "0.58272076", "0.5823451", "0.5745785", "0.57090163", "0.5666307", "0.5665053", "0.56631726", "0.56468445", "0...
0.0
-1
GET /milkings GET /milkings.json
def index # if params[:dairy_id] # @current_user.diary @milkings = Milking.all render :index, status: :created, location: v1_milking_url(@milkings) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @milks = Milk.all\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n @li...
[ "0.6508522", "0.6423993", "0.6172123", "0.61475706", "0.6147198", "0.6136396", "0.610696", "0.60163087", "0.60022956", "0.5942831", "0.5885236", "0.58805305", "0.5863591", "0.58632326", "0.5861924", "0.5805214", "0.5802444", "0.57710683", "0.57543284", "0.5748554", "0.5739047...
0.6319401
2
GET /milkings/1 GET /milkings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @milks = Milk.all\n end", "def index\n # if params[:dairy_id]\n # @current_user.diary\n @milkings = Milking.all\n render :index, status: :created, location: v1_milking_url(@milkings)\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def update\n ...
[ "0.65317273", "0.63902444", "0.6352694", "0.607", "0.60412", "0.5985302", "0.5917342", "0.58951455", "0.5890445", "0.58597606", "0.5815225", "0.5804468", "0.5801856", "0.57836586", "0.5753032", "0.5743415", "0.57079464", "0.5707328", "0.570499", "0.5681484", "0.5669039", "0...
0.0
-1
POST /milkings POST /milkings.json
def create @milking = Milking.new(milking_params) @milking.user_id = @current_user.id # @milking.milking_time_id = milk_timeable @milking.milking_datetime = Time.now @milking.type = milking_period #if Time.now - milking.milking_datetime > 4.hours if @milking.save render :show, status: :created, location: v1_milking_url(@milking) else render json: @milking.errors, status: :unprocessable_entity end #else #end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @milk = Milk.new(milk_params)\n\n respond_to do |format|\n if @milk.save\n format.html { redirect_to @milk, notice: 'Milk was successfully created.' }\n format.json { render :show, status: :created, location: @milk }\n else\n format.html { render :new }\n fo...
[ "0.6361471", "0.62964416", "0.6223238", "0.57412857", "0.56359684", "0.5565875", "0.5513819", "0.53283995", "0.5263429", "0.52066356", "0.51924175", "0.51613617", "0.50835055", "0.5072544", "0.5070885", "0.5049614", "0.50411654", "0.5041085", "0.5041061", "0.50187385", "0.500...
0.5449834
7
PATCH/PUT /milkings/1 PATCH/PUT /milkings/1.json
def update if @milking.update(milking_params) render :show, status: :ok, location: v1_milking_url(@milking) else render json: @milking.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @milk.update(milk_params)\n format.html { redirect_to @milk, notice: 'Milk was successfully updated.' }\n format.json { render :show, status: :ok, location: @milk }\n else\n format.html { render :edit }\n format.json { render json: @...
[ "0.67619854", "0.6147035", "0.60891205", "0.59965664", "0.59591866", "0.59155726", "0.59019977", "0.5878373", "0.58765477", "0.5820535", "0.58196926", "0.5813598", "0.5774922", "0.5770615", "0.57634515", "0.57591856", "0.5758659", "0.5740703", "0.572757", "0.5716799", "0.5698...
0.68252116
0
DELETE /milkings/1 DELETE /milkings/1.json
def destroy @milking.destroy render json: {status: "Record Deleted"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @milk.destroy\n respond_to do |format|\n format.html { redirect_to milks_url, notice: 'Milk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted...
[ "0.70463747", "0.68726206", "0.6729877", "0.66869706", "0.66628975", "0.6645407", "0.6580957", "0.65752226", "0.654971", "0.6524203", "0.6483389", "0.64619124", "0.64493763", "0.64493763", "0.6436136", "0.6409707", "0.6403845", "0.63967836", "0.6393506", "0.6393405", "0.63851...
0.69651735
1
Use callbacks to share common setup or constraints between actions.
def set_milking @milking = Milking.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def milking_params params.permit(:cow_id, :quantity, :milked_by) 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
Creates initial variables for class
def initialize @irregulars = {} @single_terminal_consonants = [] @copulars = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def class_variables() end", "def class_variables; end", "def initialize() #method\n @variables = {}\n end", "def custom_initialize_instance_variables\n @open_selector_bracket_detected = false\n @open_function_detected = false\n @open_include_detected = false\n @parents_stash =...
[ "0.76556176", "0.72657776", "0.7223675", "0.71313465", "0.70519733", "0.697794", "0.68869734", "0.688188", "0.6738703", "0.6734629", "0.67098147", "0.6674511", "0.6652949", "0.66485995", "0.65990674", "0.6592449", "0.6578748", "0.6561843", "0.6550256", "0.65364623", "0.653646...
0.0
-1
Determines irregular verbs from the expression Params: infinitive, the given verb preterite, denote events that took place in the past past_participle, form of a verb, ending in 'ed' &blk, block of code that may be run
def irregular(infinitive, preterite = nil, past_participle = nil, &blk) if block_given? # create new Verb object with infinitive and &blk irregular = ::Verbs::Verb.new infinitive, &blk else unless preterite && past_participle raise ArgumentError, 'Standard irregular verbs must specify preterite and past participle forms' end # create new Verb object with infinitive, preterite and past_participle irregular = ::Verbs::Verb.new infinitive, preterite: preterite, past_participle: past_participle end @irregulars[infinitive] = irregular end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_pret...
[ "0.67030674", "0.6077263", "0.6065101", "0.58036715", "0.5788162", "0.5759099", "0.5536372", "0.5522279", "0.5517326", "0.5503346", "0.5483458", "0.5430552", "0.5430552", "0.5430552", "0.5430552", "0.5430552", "0.5410265", "0.5384527", "0.53753406", "0.5351846", "0.52921104",...
0.6417911
1
Find single terminal consonant with the infinitive Params: infinitive, the given verb
def single_terminal_consonant(infinitive) @single_terminal_consonants << infinitive end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_pret...
[ "0.73817706", "0.711924", "0.70941365", "0.65594834", "0.6314694", "0.6147397", "0.59960026", "0.5960542", "0.58173", "0.5754453", "0.572694", "0.57061327", "0.57061327", "0.57061327", "0.57061327", "0.57061327", "0.5661531", "0.5596303", "0.5588099", "0.5554679", "0.55406475...
0.70596194
3
Runs a block of code if given in a class instance else only class instance is created
def conjugations if block_given? yield Conjugations.instance else Conjugations.instance end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize (&block)\n instance_exec(&block)\n end", "def in_the(instance, &block)\n instance.instance_eval(&block)\n end", "def onblock(object, id, client = $client)\n if object.class != Class then\n object = ON_INSTANCES[object]\n return 'Error: Unknown instance name given' if obj...
[ "0.6470346", "0.64424914", "0.6314247", "0.6301736", "0.62834764", "0.61965704", "0.60885876", "0.60499984", "0.59943265", "0.5957604", "0.59174836", "0.5916899", "0.5915013", "0.58891463", "0.5831524", "0.58090216", "0.5808106", "0.5806176", "0.57914156", "0.5780442", "0.577...
0.0
-1
Using options given, determine the conjugation and the subject Return the subject, if there is one, and the proper conjugation Params: infinitive, the given verb options, the list of parameters to alter the conjugation
def conjugate(infinitive, options = {}) infinitive = infinitive.dup if infinitive.is_a?(String) # set all options according to parameter, or the default tense = options[:tense] || :present # present, past, future person = options[:person] || :third # first, second, third plurality = options[:plurality] || :singular # singular, plural diathesis = options[:diathesis] || :active # active, passive mood = options[:mood] || :indicative # imperative, subjunctive aspect = options[:aspect] || default_aspect(options) # perfective, habitual, progressive, perfect, prospective check_for_improper_constructions(infinitive, tense, person, mood, diathesis) # find incompatabilities form = form_for(tense, aspect, diathesis) # find form array based on tense and aspect # map form array to conjugation array, applying infinitive and options to the array conjugation = form.map { |e| resolve e, infinitive, tense, person, plurality, mood }.join(' ').strip if options[:subject] # When options includes a subject, actor = options.delete(:subject) # remove from options and make subject humanized actor = subject(options).humanize if actor.is_a?(TrueClass) end "#{actor} #{conjugation}".strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject(options)\n case [options[:person], options[:plurality]]\n when %i[first singular]\n 'I'\n when %i[first plural]\n 'we'\n when %i[second singular], %i[second plural]\n 'you'\n when %i[third singular]\n 'he'\n when %i[third plural]\n 'they'...
[ "0.6529123", "0.65073097", "0.6045123", "0.57486117", "0.5731374", "0.54960376", "0.54800636", "0.54773915", "0.5404189", "0.53992635", "0.5382994", "0.5366697", "0.5338393", "0.5319206", "0.522267", "0.5191354", "0.5173851", "0.5173851", "0.5173851", "0.5173851", "0.5173851"...
0.66836923
0
Finds the pronoun associated with the subject for the conjugation Returns the pronoun Params: options, list of options given to determine conjugation
def subject(options) case [options[:person], options[:plurality]] when %i[first singular] 'I' when %i[first plural] 'we' when %i[second singular], %i[second plural] 'you' when %i[third singular] 'he' when %i[third plural] 'they' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subject(options = {})\n options = { :capitalize => true, :case => Grammar::Case::SUBJECT }.merge(options)\n pronoun_or_noun(@subject, @audience, options)\n end", "def pronoun_or_noun(noun, audience, options = {})\n return '' if noun.blank?\n\n options = {\n :force_pronoun => false,\n :...
[ "0.6698815", "0.6589719", "0.6354167", "0.595999", "0.5955789", "0.5820831", "0.5700067", "0.5625391", "0.5625391", "0.5532828", "0.55192965", "0.55046844", "0.55039567", "0.5492829", "0.54838824", "0.5416845", "0.53976643", "0.5361047", "0.53360057", "0.5301646", "0.52704066...
0.63957137
2
Resolves conflictions between options of the conjugation Params: element, infinitive, the given verb tense, an option given by the user person, an option given by the user plurality, an option given by the user mood, an option given by the user
def resolve(element, infinitive, tense, person, plurality, mood) case element when String element when :infinitive infinitive when :present, :past, :present_participle, :past_participle inflect infinitive, element, person, plurality, mood when Symbol inflect element, tense, person, plurality, mood end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_improper_constructions(infinitive, tense, person, mood, diathesis)\n if (mood == :imperative) && !((person == :second) && (tense == :present))\n raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person'\n end\n if (infinitive.to_sym == :be...
[ "0.59932154", "0.5867925", "0.5781977", "0.5624133", "0.55947804", "0.5487107", "0.5361296", "0.5334847", "0.53338236", "0.52916795", "0.52914923", "0.5227277", "0.51904595", "0.5175002", "0.51408833", "0.5113212", "0.50876766", "0.5042484", "0.5030979", "0.501756", "0.499533...
0.63962233
0
Change the form to express the proper grammatical function Params: infinitive,the given verb inflection, form to be changed person, an option given by the user plurality, an option given by the user mood, an option given by the user
def inflect(infinitive, inflection, person, plurality, mood) send(*[inflection, infinitive, person, plurality, mood][0, method(inflection).arity + 1]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def present_third_person_singular_form_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n case infinitive\n when /[a-z&&#{CONSONANT_PATTERN}]y$/i\n \"#{infinitive[0..-2]}ies\"\n when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i\n \"#{infinitive}es\"\n ...
[ "0.65431726", "0.6514812", "0.64740527", "0.60404783", "0.60404783", "0.60404783", "0.60404783", "0.60404783", "0.5996172", "0.5971938", "0.5857706", "0.57010305", "0.5682585", "0.5652952", "0.5631891", "0.5630172", "0.56241417", "0.5618243", "0.5618243", "0.56077284", "0.557...
0.59678096
10
Conjugate verb to past with relevent options determining outcome Params: infinitive, the given verb person, the subject of the verb plurality, an option given by the user mood, an option given by the user
def past(infinitive, person, plurality, mood) if (verb = conjugations.irregulars[infinitive]) conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood) else regular_preterite_for infinitive end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conjugate(infinitive, options = {})\n infinitive = infinitive.dup if infinitive.is_a?(String)\n\n # set all options according to parameter, or the default\n tense = options[:tense] || :present # present, past, future\n person = options[:person] || :third # first, secon...
[ "0.68978065", "0.68696505", "0.6331361", "0.6310309", "0.6310309", "0.6310309", "0.6310309", "0.6310309", "0.62588", "0.6183553", "0.61827284", "0.6049348", "0.5930382", "0.592552", "0.59015024", "0.5640087", "0.56302595", "0.56239164", "0.5499966", "0.548861", "0.54536325", ...
0.6694273
2
Forming verb to apply present tense endings Params: infinitive, the given verb
def present_participle(infinitive) if infinitive.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{CONSONANTS_WITHOUT_C_PATTERN}$/) && !conjugations.single_terminal_consonants.include?(infinitive.to_sym) return present_participle_with_doubled_terminal_consonant_for infinitive end case infinitive.to_s when /c$/ "#{infinitive}k" when /(^be|ye|oe|nge|ee)$/ infinitive.to_s when /ie$/ infinitive.to_s.gsub(/ie$/, 'y') when /#{VOWEL_PATTERN}#{CONSONANT_PATTERN}e$/, /ue$/ infinitive.to_s[0..-2] else # rubocop:disable Lint/DuplicateBranch infinitive.to_s end.dup.concat('ing').to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def to_s\n\t\t\"Verb: #{@infinitive}\"\n\tend", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}...
[ "0.7174836", "0.7174836", "0.7174836", "0.7174836", "0.7174836", "0.6995533", "0.6908299", "0.6889775", "0.6684288", "0.6683907", "0.661355", "0.6508708", "0.6472799", "0.6351976", "0.6307786", "0.62969774", "0.62462217", "0.62344456", "0.6218455", "0.6184186", "0.6149367", ...
0.5668623
45
Forming verb to apply past tense endings Params: infinitive, the given verb
def past_participle(infinitive) if (verb = conjugations.irregulars[infinitive]) conjugate_irregular(verb, tense: :past, derivative: :participle) else regular_preterite_for infinitive end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n ...
[ "0.6933279", "0.6933279", "0.6933279", "0.6933279", "0.6933279", "0.6871663", "0.68478954", "0.68268657", "0.65009624", "0.64425033", "0.64098805", "0.6397607", "0.6354151", "0.6325868", "0.6250032", "0.61869764", "0.6184334", "0.6075305", "0.6049149", "0.59887797", "0.595561...
0.6110706
17
Apply thir person rules to the verb for the conjugation Params: verb, apply proper third person rules to this
def present_third_person_singular_form_for(verb) infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s case infinitive when /[a-z&&#{CONSONANT_PATTERN}]y$/i "#{infinitive[0..-2]}ies" when /(ss|sh|t?ch|zz|x|#{CONSONANT_PATTERN}o)$/i "#{infinitive}es" when /[^s]s$/i "#{infinitive}ses" else "#{infinitive}s" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) &&\n !conjugations.single_terminal_consonants.include?(verb.to_sym)\n return regular_pret...
[ "0.6468106", "0.57955927", "0.5775022", "0.5724713", "0.5706209", "0.5638677", "0.5608252", "0.5470209", "0.5470209", "0.5470209", "0.5470209", "0.5470209", "0.53566796", "0.53566796", "0.52387756", "0.5218787", "0.52186495", "0.5214793", "0.5181069", "0.51657146", "0.5156089...
0.65749305
0
Apply the regular past tense to a given verb for the conjugation Params: verb, apply regular past tense rules to this
def regular_preterite_for(verb) infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTERN}#{DOUBLED_CONSONANT_WITHOUT_C_PATTERN}$/) && !conjugations.single_terminal_consonants.include?(verb.to_sym) return regular_preterite_with_doubled_terminal_consonant_for verb end case verb.to_s when /(#{CONSONANT_PATTERN}e|ye|oe|nge|ie|ee|ue)$/ infinitive.concat('d').to_sym when /#{CONSONANT_PATTERN}y$/ infinitive.gsub(/y$/, 'ied').to_sym when /c$/ infinitive.gsub(/c$/, 'cked').to_sym else infinitive.concat('ed').to_sym end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def past(infinitive, person, plurality, mood)\n if (verb = conjugations.irregulars[infinitive])\n conjugate_irregular(verb, tense: :past, person: person, plurality: plurality, mood: mood)\n else\n regular_preterite_for infinitive\n end\n end", "def get_regular(verb)\n case ve...
[ "0.6472331", "0.6230442", "0.59399843", "0.59242153", "0.5890981", "0.58609486", "0.5734238", "0.5704534", "0.5698733", "0.5698526", "0.5698526", "0.5698526", "0.5698526", "0.5698526", "0.565137", "0.56355035", "0.56106085", "0.551773", "0.5517429", "0.5471704", "0.54675835",...
0.6910308
0
Apply proper rules to consonant endings Params: verb, apply double consonant to this
def regular_preterite_with_doubled_terminal_consonant_for(verb) regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def present_participle_with_doubled_terminal_consonant_for(verb)\n if /c$/ =~ verb.to_s\n present_participle verb.to_sym\n else\n present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb...
[ "0.65740854", "0.64425373", "0.64022726", "0.62513596", "0.614279", "0.60967696", "0.6093948", "0.59111714", "0.5892954", "0.5832512", "0.5821658", "0.5784825", "0.5760285", "0.5752394", "0.5713888", "0.57036954", "0.5686028", "0.5668624", "0.56383115", "0.5635191", "0.563257...
0.6933846
0
Apply proper rules to consonant endings Params: verb, apply double consonant to this
def present_participle_with_doubled_terminal_consonant_for(verb) if /c$/ =~ verb.to_s present_participle verb.to_sym else present_participle verb.to_s.concat(verb.to_s[-1, 1]).to_sym end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regular_preterite_with_doubled_terminal_consonant_for(verb)\n regular_preterite_for verb.to_s.concat(verb.to_s[-1, 1]).to_sym\n end", "def regular_preterite_for(verb)\n infinitive = verb.is_a?(Verb) ? verb.infinitive.to_s : verb.to_s\n\n if verb.to_s.match(/#{CONSONANT_PATTERN}#{VOWEL_PATTE...
[ "0.6933846", "0.64425373", "0.64022726", "0.62513596", "0.614279", "0.60967696", "0.6093948", "0.59111714", "0.5892954", "0.5832512", "0.5821658", "0.5784825", "0.5760285", "0.5752394", "0.5713888", "0.57036954", "0.5686028", "0.5668624", "0.56383115", "0.5635191", "0.5632572...
0.65740854
1
Add appropriate aspects to the tense of the conjugation Params: tense, an option given by the user aspect, an option given by the user diathesis, an option given by the user
def form_for(tense, aspect, diathesis) form = [] case diathesis when :active if tense == :future form << 'will' form << :infinitive if aspect == :habitual form.concat ['have', :past_participle] if aspect == :perfect form.concat ['be having', :past_participle] if aspect == :perfective form.concat ['be', :present_participle] if aspect == :progressive form.concat ['be about to', :infinitive] if aspect == :prospective else form.concat ['used to', :infinitive] if [tense, aspect] == %i[past habitual] form.concat %i[have past_participle] if aspect == :perfect form << :past if [tense, aspect] == %i[past perfective] form.concat %i[be present_participle] if aspect == :progressive form.concat [:be, 'about to', :infinitive] if aspect == :prospective form << :present if [tense, aspect] == %i[present habitual] form.concat [:be, 'having', :past_participle] if [tense, aspect] == %i[present perfective] end when :passive if tense == :future form << 'will' form.concat ['be', :past_participle] if aspect == :habitual form.concat ['have been', :past_participle] if aspect == :perfect form.concat ['be being', :past_participle] if aspect == :progressive form.concat ['be about to be', :past_participle] if aspect == :prospective else form.concat ['used to be', :past_participle] if [tense, aspect] == %i[past habitual] form.concat [:have, 'been', :past_participle] if aspect == :perfect form.concat %i[be past_participle] if [tense, aspect] == %i[past perfective] form.concat [:be, 'being', :past_participle] if aspect == :progressive form.concat [:be, 'about to be', :past_participle] if aspect == :prospective form.concat %i[be past_participle] if [tense, aspect] == %i[present habitual] end end form end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aspects(context={})\n \n app = context[:app]\n \n aspects = []\n aspects << ::Plugins::Aspect.new(:comments, app.t.aspect.comments, ContentManagerSystem::FieldSet::Commentable, CommentAspectDelegate.new,\n [Plugins::AspectConfigurationAttribute.new...
[ "0.5956828", "0.5761539", "0.5691567", "0.5603815", "0.5601502", "0.55969757", "0.5583276", "0.552205", "0.5505569", "0.5460117", "0.54165137", "0.5380422", "0.5377104", "0.53649026", "0.5359932", "0.53535897", "0.5346977", "0.5334277", "0.53219116", "0.5309818", "0.53012383"...
0.5515574
8
Confirm an imperative mood contains the present tense and second person Params: tense, an option given by the user person, how the conjugation refers to the subject mood, an option given by the user diathesis, an option given by the user
def check_for_improper_constructions(infinitive, tense, person, mood, diathesis) if (mood == :imperative) && !((person == :second) && (tense == :present)) raise Verbs::ImproperConstruction, 'The imperative mood requires present tense and second person' end if (infinitive.to_sym == :be) && (diathesis == :passive) raise Verbs::ImproperConstruction, 'There is no passive diathesis for the copula' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mood\n #it \"has a method 'mood' that returns 'happy' when the user is more happy than nauseous\" do\n if self.happiness && self.nausea\n if self.happiness > self.nausea\n \"happy\"\n #it \"has a method 'mood' that returns 'sad' when the user is more nauseous than happy\" do\n elsif sel...
[ "0.66450334", "0.6400529", "0.62736136", "0.62602985", "0.6254086", "0.62043893", "0.6188759", "0.61202973", "0.6102706", "0.6100484", "0.60802263", "0.6074935", "0.60642534", "0.6056229", "0.60277253", "0.59890866", "0.59468627", "0.5888301", "0.5876436", "0.5869608", "0.585...
0.65158516
1
Get valid email address
def get_email() email_regex = /\A([\w+\-].?)+@[a-z\d\-]+(\.[a-z]+)*\.[a-z]+\z/i user_email = "" loop do puts "\nEnter your email address to receive scraped data:" user_email = gets.chomp break if email_regex.match? user_email puts "Sorry, it's an invalid email address." end return user_email end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def match_email( val )\n\t\tmatch = RFC822_EMAIL_ADDRESS.match( val )\n\t\tself.log.debug \"Validating an email address %p: %p\" %\n\t\t\t[ val, match ]\n\t\treturn match ? match[0] : nil\n\tend", "def get_email_address\n response = get_current_user_meta('email')\n email = response['query']['us...
[ "0.7712637", "0.7432787", "0.7431383", "0.74003136", "0.7394317", "0.7358094", "0.7357009", "0.73475564", "0.7336202", "0.7323558", "0.72153693", "0.7215354", "0.71899533", "0.7152718", "0.71313155", "0.70545745", "0.70545745", "0.70340085", "0.7001648", "0.69930464", "0.6989...
0.6667052
54
Send a file to the given email address
def send_email_by_passing_file(sendto, attachmnent_filename, path='./public') Pony.mail({ :to => sendto, :from => 'Magic Team', :subject => 'Your web scrapper successfully finished', :body => 'Thanks for using web scrapper service offered by MAGiC', :attachments => {attachmnent_filename => File.read(File.join(path, attachmnent_filename))}, :via => :smtp, :via_options => { :address => 'smtp.gmail.com', :port => '587', :enable_starttls_auto => true, :user_name => 'osu.magic.team@gmail.com', :password => 'OSUCSE3901', :authentication => :plain, # :plain, :login, :cram_md5, no auth by default :domain => "localhost.localdomain" # the HELO domain provided by the client to the server }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email(url, email)\n file = open(url).read\n filename = get_name(url)\n\t\tPony.mail(:to => email,\n :from => 'Send To Kindle',\n\t\t :subject => 'Convert',\n\t\t :attachments => {filename => file},\n\t\t :via => :smtp, \n :via_options => @email_config\n ) \n\tend", "def send_em...
[ "0.75949174", "0.7006693", "0.6991517", "0.6812473", "0.67422605", "0.6665113", "0.6662956", "0.6589446", "0.6575592", "0.6488019", "0.637528", "0.63480085", "0.6231508", "0.62107563", "0.619263", "0.6165146", "0.61543673", "0.61523694", "0.6135452", "0.6134288", "0.61196935"...
0.7974564
0
Send a jsonobject to the given email address
def send_email_by_passing_jsonobject(sendto, json_object, filename) Pony.mail({ :to => sendto, :from => 'Magic Team', :subject => 'Your web scrapper successfully finished', :body => 'Thanks for using web scrapper service offered by MAGiC', :attachments => {filename => "json_object"}, :via => :smtp, :via_options => { :address => 'smtp.gmail.com', :port => '587', :enable_starttls_auto => true, :user_name => 'osu.magic.team@gmail.com', :password => 'OSUCSE3901', :authentication => :plain, # :plain, :login, :cram_md5, no auth by default :domain => "localhost.localdomain" # the HELO domain provided by the client to the server }, }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send(email_name, email_to, data = {})\n payload = {\n :email_name => email_name,\n :email_to => email_to,\n :email_data => data\n }\n return api_request(\"send\", payload)\n end", "def sendmail(object)\n email\n end", "...
[ "0.672504", "0.6705468", "0.65184516", "0.63990325", "0.6251436", "0.62277734", "0.6200909", "0.6138903", "0.6072342", "0.6067826", "0.60566854", "0.60341907", "0.59921646", "0.5970218", "0.5907847", "0.58910036", "0.589", "0.58713377", "0.5851138", "0.58451957", "0.58270913"...
0.7889941
0
in this method we want to continue printing out the contents of :data until there is no data left to be printed (the base :next is set to nil) the boolean value of nil is false
def print_list(list) while list puts list[:data] #print out the value assigned to the data key for each node in the list list = list[:next] #assign the next node to the list variables end #this means that the next time list[:data] is printed the next value down the node will be puts to stdout end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n @current = @head\n until @current == nil\n puts @current.data\n @current = @current.next\n end\n end", "def print\n node = @head\n until node.eql?(nil) do\n puts node.data\n node = node.next\n end\n end", "def print\n current = @head\n while (current.ne...
[ "0.6897771", "0.6564448", "0.65563524", "0.6539994", "0.6514462", "0.65077573", "0.6503468", "0.64534813", "0.64151883", "0.6411897", "0.6411897", "0.63850516", "0.6303497", "0.6303497", "0.63030833", "0.6259743", "0.6229117", "0.62016344", "0.61454207", "0.61438835", "0.6133...
0.58109105
55
this really speeds the game up
def first_move(game) if self.ai_player == "X" self.choice = "C3" return 10 elsif self.ai_player == "O" first_play = { "A1" => "B2", "B1" => "B3", "C1" => "B2", "A2" => "A3", "B2" => "C3", "C2" => "C3", "A3" => "B2", "B3" => "C3", "C3" => "B2" } m = Matrix[*game.board.cells].index{|a| a} coord = "#{alphabetize(m[0])}#{m[1]+1}" self.choice = first_play[coord] return "10" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pedal_faster\n\t\t@speed += 10\n\tend", "def game_loop\n end", "def game_loop\n end", "def run\n @speed = 5\n end", "def update\n return if self.disposed?\n @sprites[\"bg\"].update\n @sprites[\"streak\"].update\n @sprites[\"shine\"].angle += 8.delta_sub if $PokemonSystem.screensize ...
[ "0.69348323", "0.6866969", "0.6811415", "0.6798399", "0.66997725", "0.6592775", "0.6558307", "0.6535065", "0.65336496", "0.65191466", "0.64944625", "0.64943075", "0.64943075", "0.64674276", "0.6438396", "0.6432269", "0.63875616", "0.63875616", "0.63875616", "0.63875616", "0.6...
0.0
-1
Generate IIIF Presentation 2.0 manifest
def manifest seed = { 'label' => title } manifest = IIIF::Presentation::Manifest.new(seed) manifest['@id'] = uri(image_server, "#{id}/manifest") manifest.attribution = 'University of Pennsylvania Libraries' manifest.viewing_hint = viewing_hint manifest.viewing_direction = viewing_direction sequence = IIIF::Presentation::Sequence.new( '@id' => uri(image_server, "#{id}/sequence/normal"), 'label' => 'Current order' ) assets.map.with_index do |asset, i| index = i + 1 # Retrieve image information from image server url = uri(image_server, "#{asset[:file]}/info.json") info = JSON.parse(Faraday.get(URI.parse(url)).body) # Adding canvas that contains image as an image annotation. sequence.canvases << canvas( index: index, label: asset[:label], height: info['height'], width: info['width'], profile: info['profile'][0], filepath: asset[:file], additional_downloads: asset[:additional_downloads] ) # Adding table of contents, if label and table of contents entries are provided. if asset[:label] && asset[:table_of_contents]&.any? manifest.structures << range( index: index, label: asset[:label], table_of_contents: asset[:table_of_contents] ) end end manifest.sequences << sequence manifest.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest\n anno = IIIF::Presentation::Annotation.new('on' => path)\n anno.resource = create_resource\n canvas.images << anno\n canvas.other_content = [annotations]\n manifest = IIIF::Presentation::Manifest.new(\n '@id' => path,\n 'label' => \"Histonets - Collection Template #{id}\"\n ...
[ "0.68924505", "0.6339366", "0.63171244", "0.61669075", "0.6130286", "0.613018", "0.6116419", "0.5985955", "0.59582496", "0.58460945", "0.5833622", "0.5813625", "0.57900375", "0.57154995", "0.5670805", "0.56653976", "0.56653976", "0.5660883", "0.56424326", "0.56255674", "0.560...
0.6982323
0
Returns canvas with one annotated image. The canvas and image size are the same.
def canvas(index:, width:, height:, profile:, label: nil, filepath:, additional_downloads: nil) canvas = IIIF::Presentation::Canvas.new canvas['@id'] = uri(image_server, "#{id}/canvas/p#{index}") canvas.label = label || "p. #{index}" canvas.height = height canvas.width = width annotation = IIIF::Presentation::Annotation.new # By providing width, height and profile, we avoid the IIIF gem fetching the data again. annotation.resource = IIIF::Presentation::ImageResource.create_image_api_image_resource( service_id: uri(image_server, filepath), width: width, height: height, profile: profile, ) annotation['on'] = canvas['@id'] canvas.images << annotation if additional_downloads canvas['rendering'] = additional_downloads.map { |download_info| rendering(download_info) } end canvas end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_canvas(w, h, bkg_col)\n @draw = Magick::Draw.new\n @draw.pointsize = @@pointsize # TODO Use height\n @draw.pointsize = @options[:font_size] if @options.has_key?(:font_size)\n @canvas = Magick::Image.new(w , h) { self.background_color = bkg_col }\n\n # Make room for label and last value\n ...
[ "0.5890029", "0.58261883", "0.5790082", "0.5738972", "0.57041544", "0.55744606", "0.55509293", "0.5486989", "0.5475784", "0.54657716", "0.54566514", "0.54434323", "0.54019684", "0.5386677", "0.535922", "0.52910435", "0.51799273", "0.5154018", "0.5146952", "0.5146834", "0.5140...
0.6389344
0
Returns range with sub ranges for each table of contents entry. For each table of contents entry will point to the entire canvas. Note: If at some point coordinates are provided for each table of contents entry we can point directly to the coordinates given.
def range(index:, label:, table_of_contents:) subranges = table_of_contents.map.with_index do |entry, subrange_index| IIIF::Presentation::Range.new( '@id' => uri(image_server, "#{id}/range/r#{index}-#{subrange_index + 1}"), 'label' => entry[:text], 'canvases' => [uri(image_server, "#{id}/canvas/p#{index}")] ) end IIIF::Presentation::Range.new( '@id' => uri(image_server, "#{id}/range/r#{index}"), 'label' => label, 'ranges' => subranges ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subgrid(cords)\n subgrid = []\n x_pos = cords[0] - cords[0] % 3\n (x_pos..x_pos + 2).each do |row_num|\n y_pos = cords[1] - cords[1] % 3\n subgrid += @grid[row_num][y_pos, 3]\n end\n subgrid\n end", "def getIndexRange()\n rangeTime = { :min => nil, :max => nil} ;\n rangeX ...
[ "0.59189934", "0.5628868", "0.55733085", "0.5564517", "0.54756737", "0.54711795", "0.5434841", "0.541947", "0.5410844", "0.5381737", "0.5369286", "0.5367695", "0.5333022", "0.53319293", "0.52209187", "0.51913506", "0.51913506", "0.51832837", "0.5172692", "0.51633716", "0.5162...
0.66865855
0
calls the 'predicted_deaths' and 'speed_of_spread' methods
def report STATE_DATA.each do |key, value| initialize(key, value[:population_density], value[:population]) virus_effects end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def virus_effects\n speed_of_spread(predicted_deaths()) \n\n end", "def virus_effects \n predicted_deaths(@population_density, @population, @state)\n speed_of_spread(@population_density, @state)\n end", "def virus_effects #looks DRY but not using the full scope of the variables \r\n predicted_de...
[ "0.7511844", "0.7408945", "0.7403951", "0.7190252", "0.7174762", "0.713513", "0.71295446", "0.71237284", "0.7105321", "0.709898", "0.709898", "0.70612663", "0.7036168", "0.69943273", "0.6977844", "0.6963928", "0.69545174", "0.6938901", "0.69381225", "0.69381225", "0.69218564"...
0.0
-1
Returns a printed statement about the number of deaths in each state based on the population density
def predicted_deaths # predicted deaths is solely based on population density if @population_density >= 200 x = 0.4 elsif @population_density >= 150 x = 0.3 elsif @population_density >= 100 x = 0.2 elsif @population_density >= 50 x = 0.1 else x = 0.05 end number_of_deaths = (@population * x).floor print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population *...
[ "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.80558383", "0.8053934", "0.8036161", "0.8025466", "0.8024912", "0.7996972", "0.79627085", "0.7949235", "0.7907591", "0.79051864", "0.7905018", "0.7899588", "0.7897426", "0.78958964", "0.78949034", "0.788...
0.0
-1
returns a printed report stating the speed of spread of the virus in each state base on the population density.
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. if @population_density >= 200 speed = 0.5 elsif @population_density >= 150 speed = 1 elsif @population_density >= 100 speed = 1.5 elsif @population_density >= 50 speed = 2 else speed = 2.5 end puts " and will spread across the state in #{speed} months.\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report\r\n\r\n STATE_DATA.each do |key, value|\r\n\r\n initialize(key, value[:population_density], value[:population]) \r\n virus_effects\r\n end\r\n \r\n end", "def report\n STATE_DATA.each do |state, population_stats|\n state = VirusPredictor.new(state, population_stats[:population_...
[ "0.718225", "0.70743805", "0.6986951", "0.6967058", "0.684492", "0.68064386", "0.6774673", "0.6764509", "0.67411405", "0.6729949", "0.67116207", "0.66903806", "0.6687948", "0.6672898", "0.6672898", "0.6672898", "0.6672898", "0.6672268", "0.66603863", "0.6649109", "0.6625182",...
0.0
-1
Public because the old tests depend on it
def update_source(source, instance) begin data = instance.fetch publish_data(source, data) ensure @after_update_callback.call end rescue Exception => ex puts "Failed to update #{source}: #{ex.message}" puts ex.backtrace @error_callback.call(ex) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def __dummy_test__\n end", "def testing\n # ...\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; ...
[ "0.74151176", "0.72776586", "0.72776586", "0.72265184", "0.72265184", "0.71033937", "0.6814611", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358", "0.6718358...
0.0
-1
Returns the full title on a perpage basis. Documentation comment
def full_title(page_title = '') # Method def, optional arg base_title = "WikiSpyder" # Variable assignment if page_title.empty? # Boolean test base_title # Implicit return else page_title + " | " + base_title # String concatenation end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end", "def page_title\n end", "def page_title\n page.title\n end", "def page_title; end", "def page_title(title)\n content_for_wrapper(:page_title, title)\n end", "def page_title title= nil\n\t\tif...
[ "0.81353635", "0.79831505", "0.79214835", "0.79139054", "0.78620046", "0.7833554", "0.78068256", "0.77831745", "0.77285194", "0.7703534", "0.7679732", "0.7657891", "0.7596595", "0.7592429", "0.7588978", "0.758632", "0.75854963", "0.75828916", "0.7582482", "0.75700885", "0.755...
0.7310941
98
GET /disciplines GET /disciplines.json
def index if( current_user.admin? ) @disciplines = Discipline.where( users_id: current_user.id) @discipline = Discipline.new else @disciplines = Discipline.joins(:Discuser).where("user_id = (?)", current_user.id) @discipline = Discipline.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\r\n @discipline...
[ "0.7563355", "0.737941", "0.69488347", "0.68785405", "0.68470913", "0.68470913", "0.66711926", "0.66570663", "0.6402935", "0.63357234", "0.63255787", "0.62968266", "0.6293139", "0.62052494", "0.60936415", "0.6086569", "0.60492694", "0.60479945", "0.5941633", "0.59115756", "0....
0.53188944
50
GET /disciplines/1 GET /disciplines/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def index\n @disciplines = Discipline.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @disciplines }\n end\n end", "def show\r\n @discipline...
[ "0.7529931", "0.72701716", "0.7118794", "0.6864396", "0.6851406", "0.6851406", "0.6748693", "0.6650709", "0.6613909", "0.6610088", "0.65520805", "0.6441681", "0.63481295", "0.6318803", "0.6186632", "0.61141104", "0.60904294", "0.60593903", "0.60107917", "0.5940344", "0.592861...
0.0
-1
POST /disciplines POST /disciplines.json
def create @discipline = Discipline.new(discipline_params) @discipline.users_id = current_user.id respond_to do |format| if @discipline.save @discipline.codigo = "DISC-%04d" % [@discipline.id] @discipline.save if params[:anexos] params[:anexos].each { |anx| @discanexo = Discanexo.new @discanexo.anexo = anx @discanexo.Discipline_id = @discipline.id @discanexo.save } end flash[:success] = "Disciplina cadastrada com sucesso." format.html { redirect_to @discipline} format.json { render :show, status: :created, location: @discipline } else format.html { render :new } format.json { render json: @discipline.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @disciplina = Disciplina.new(disciplina_params)\n\n respond_to do |format|\n if @disciplina.save\n format.html { redirect_to @disciplina, notice: 'Disciplina was successfully created.' }\n format.json { render :show, status: :created, location: @disciplina }\n else\n ...
[ "0.6741397", "0.6674541", "0.6447001", "0.64453655", "0.6355771", "0.6280285", "0.62502515", "0.6205332", "0.6174669", "0.6125261", "0.6068471", "0.6018947", "0.59821904", "0.5956798", "0.59501576", "0.5922544", "0.5913997", "0.58800006", "0.5771545", "0.5771339", "0.57146233...
0.61840695
8
PATCH/PUT /disciplines/1 PATCH/PUT /disciplines/1.json
def update respond_to do |format| @senha = @discipline.senha if @discipline.update(discipline_params) if @discipline.senha == "" @discipline.senha = @senha @discipline.update( senha: @senha) end if params[:anexos] params[:anexos].each { |anx| @discanexo = Discanexo.new @discanexo.anexo = anx @discanexo.Discipline_id = @discipline.id @discanexo.save } end flash[:success] = "Disciplina atualizada com sucesso." format.html { redirect_to disciplines_url} format.json { render :show, status: :ok, location: @discipline } else format.html { render :edit } format.json { render json: @discipline.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @disciplines_study.update_attributes(params[:disciplines_study])\r\n format.html { redirect_to @disciplines_study, notice: 'Disciplines study was successfully updated.' }\r\n format...
[ "0.67884976", "0.6629243", "0.66211563", "0.6596267", "0.643633", "0.64091945", "0.63279796", "0.63279796", "0.623272", "0.61511624", "0.61428094", "0.61188614", "0.611134", "0.6013912", "0.59895605", "0.5963061", "0.59538025", "0.5952531", "0.59276366", "0.5926949", "0.59225...
0.60988015
13
DELETE /disciplines/1 DELETE /disciplines/1.json
def destroy @discanexos = Discanexo.where("id in (?)", @discipline.discanexo_ids) if @discanexos @discanexos.each { |anx| anx.anexo = nil anx.save } end @discipline.save @discipline.destroy respond_to do |format| format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n @disciplines_study = DisciplinesStudy.find(params[:id])\r\n @disciplines_study.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to disciplines_studies_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @discipline = Discipline.fi...
[ "0.7327468", "0.72913164", "0.7197245", "0.70610714", "0.7055863", "0.7003196", "0.6911375", "0.69047564", "0.6863932", "0.6808991", "0.6802402", "0.6741909", "0.66570747", "0.6641207", "0.6636415", "0.6610322", "0.6560786", "0.6549286", "0.64375323", "0.6431985", "0.64283997...
0.66695124
12
Use callbacks to share common setup or constraints between actions.
def set_discipline @discipline = Discipline.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def discipline_params params.require(:discipline).permit(:nome, :cargahoraria, :Course_id, :users_id, :anexos, :disciplineMat, :senha) 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
stop rails CSRF protection for this action
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_request_forgery_protection; end", "def disable_request_forgery_protection=(_arg0); end", "def clean_up_csrf?; end", "def clean_up_csrf?; end", "def skip_forgery_protection(options = T.unsafe(nil)); end", "def csrf; end", "def clean_up_csrf?\n false\n end", "def clean_up_csrf?\...
[ "0.77760774", "0.76563007", "0.7332915", "0.7332915", "0.70371854", "0.70363104", "0.70097077", "0.7002428", "0.6828669", "0.6828669", "0.6679377", "0.66760176", "0.66671306", "0.6602603", "0.65869737", "0.6586769", "0.6585341", "0.6585341", "0.6585341", "0.6585341", "0.65853...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def presence_params params.require(:chat).permit(:user_id, :message) 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
Removes Valkyrie::StorageAdapter::File member Objects for any given Resource (usually a FileSet) (see Jp2DerivativeServicecleanup_derivatives)
def cleanup_derivatives change_set_persister.buffer_into_index do |buffered_changeset_persister| hocr_derivative_service(buffered_changeset_persister).cleanup_derivatives if parent.try(:ocr_language).present? && hocr_derivative_service(buffered_changeset_persister).valid? jp2_derivative_service(buffered_changeset_persister).cleanup_derivatives if jp2_derivative_service(buffered_changeset_persister).valid? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_derivatives\n deleted_files = []\n image_derivatives = resource.file_metadata.select { |file| (file.derivative? || file.thumbnail_file?) && file.mime_type.include?(image_mime_type) }\n image_derivatives.each do |file|\n storage_adapter.delete(id: file.id)\n deleted_files << file.id\n...
[ "0.72492737", "0.70773214", "0.7026422", "0.689567", "0.64730227", "0.6375465", "0.6354057", "0.634123", "0.6319921", "0.6319921", "0.6316164", "0.6285858", "0.6285858", "0.62583184", "0.6211574", "0.61412525", "0.59582675", "0.59561074", "0.59173876", "0.582647", "0.5823364"...
0.5612231
34
def find_close_storeid(zipcode) get_stores_by_zip(zipcode)[0]["StoreID"] end storeid = find_close_storeid(zipcode)
def get_store_items(storeid, item) response = Services::SupermarketClient.new.item_search(storeid, item) response.parsed_response["ArrayOfProduct_Commercial"]["Product_Commercial"].each do |item| StoreItem.create(name: item["Itemname"], image: item["ItemImage"], description: item["ItemDescription"], price: item["Pricing"]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def city_id_by_zipcode(zipcode)\n zipcode = canonical_zipcode(zipcode)\n return unless valid_zipcode?(zipcode)\n\n @city_id_by_zipcode[zipcode] ||= begin\n hash = info_by_zipcode(zipcode)\n city = canonical_city(hash[\"city\"])\n pref = canonical_pref(hash[\"state\"])\n c...
[ "0.63949776", "0.6310586", "0.6254937", "0.59753096", "0.59648424", "0.58376473", "0.5700187", "0.55684125", "0.5559361", "0.55249655", "0.5516873", "0.5516873", "0.5491974", "0.5439712", "0.5428212", "0.5426226", "0.5407457", "0.5399532", "0.5391572", "0.53318137", "0.531791...
0.0
-1
Perform Author: Aman Date: 03/05/2018 Reviewed By:
def perform r = validate return r unless r.success? r = fetch_and_validate_client return r unless r.success? r = fetch_and_validate_admin return r unless r.success? fetch_admins set_api_response_data success_with_data(@api_response_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def performed_by(params = {})\n #TODO\n end", "def submission_decision_author(submission)\n @submission = submission\n\n @authors_text = @submission.get_authors_submitted.map{ |a| a.full_name }.join(', ')\n @title_text = @submission.get_text_submitted.title rescue ''\n\n @...
[ "0.57573503", "0.5661803", "0.55977404", "0.55977404", "0.5587524", "0.5585778", "0.55594635", "0.55303", "0.5473246", "0.54642594", "0.54571205", "0.54489654", "0.54016453", "0.5393717", "0.5393545", "0.5384417", "0.5375331", "0.5365639", "0.5353112", "0.5305779", "0.5301214...
0.0
-1
fetch normal admins Author: Aman Date: 03/05/2018 Reviewed By:
def fetch_admins admin_objs = Admin.not_deleted.where(default_client_id: @client_id).order({id: :desc}).all admin_objs.each do |admin| @admin_user_count += 1 @curr_page_data << { id: admin.id, name: admin.name, email: admin.email, status: admin.status, role: admin.role } end @can_invite_new_user = (@admin.role == GlobalConstant::Admin.super_admin_role && @admin_user_count < 20) ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_admins\n self._get_reviewers(\"admin\")\n end", "def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orcid')\n ...
[ "0.6662955", "0.6633926", "0.6613804", "0.6562823", "0.6477282", "0.6415453", "0.6395146", "0.63915116", "0.63783455", "0.63680047", "0.6360578", "0.6352775", "0.63430667", "0.63223124", "0.63193387", "0.6306201", "0.6306187", "0.62977344", "0.62870693", "0.6261089", "0.62606...
0.0
-1
Set API response data Author: Aman Date: 03/05/2018 Reviewed By:
def set_api_response_data meta = { page_payload: { } } data = { meta: meta, result_set: 'admin_user_list', admin_user_list: @curr_page_data, can_invite_new_user: @can_invite_new_user.to_i } @api_response_data = data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_api_response_data\n users_list = []\n @users.each do |u|\n ukd = @user_kyc_details[u.id]\n ukd_present = ukd.present?\n users_list << {\n user_id: u.id,\n case_id: ukd_present ? @user_kyc_details[u.id].id : 0,\n email: u.email,...
[ "0.6194693", "0.6076281", "0.590754", "0.59030014", "0.5798301", "0.57328176", "0.5616093", "0.5567093", "0.54666394", "0.5437539", "0.5358093", "0.53480023", "0.53397286", "0.53344935", "0.5303863", "0.5264913", "0.52462995", "0.52160853", "0.52081645", "0.5206502", "0.51895...
0.62009466
0
GET /questionnairedetails GET /questionnairedetails.json
def index @questionnairedetails = Questionnairedetail.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.8038944", "0.7929013", "0.7929013", "0.73681575", "0.6950631", "0.6825404", "0.68188745", "0.6809282", "0.6809282", "0.6764444", "0.6757636", "0.67383695", "0.6724907", "0.67115724", "0.67073476", "0.66774744", "0.6634457", "0.66314304", "0.6630871", "0.6630871", "0.663087...
0.7275353
4
GET /questionnairedetails/1 GET /questionnairedetails/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.8036341", "0.79174465", "0.79174465", "0.7342866", "0.729452", "0.6920519", "0.69137335", "0.68918395", "0.68870836", "0.687951", "0.6828549", "0.68277174", "0.68047523", "0.6796576", "0.6796576", "0.67809135", "0.67606616", "0.6750744", "0.67384803", "0.6690748", "0.66398...
0.0
-1
POST /questionnairedetails POST /questionnairedetails.json
def create @questionnairedetail = Questionnairedetail.new(questionnairedetail_params) respond_to do |format| if @questionnairedetail.save format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully created.' } format.json { render :show, status: :created, location: @questionnairedetail } else format.html { render :new } format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @questionnaire = Questionnaire.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def create\n @questionnaire = @participant.build_questionnaire(params[:questionnaire])\n @questionnaire.step = 1\n \n r...
[ "0.7216791", "0.6832053", "0.6813558", "0.675791", "0.6712738", "0.66761154", "0.6660387", "0.66497654", "0.6632976", "0.6620636", "0.6606846", "0.65971565", "0.65459937", "0.6528876", "0.6524684", "0.6524684", "0.6503811", "0.64895904", "0.64724636", "0.64200264", "0.6409102...
0.7683533
0
PATCH/PUT /questionnairedetails/1 PATCH/PUT /questionnairedetails/1.json
def update respond_to do |format| if @questionnairedetail.update(questionnairedetail_params) format.html { redirect_to @questionnairedetail, notice: 'Questionnairedetail was successfully updated.' } format.json { render :show, status: :ok, location: @questionnairedetail } else format.html { render :edit } format.json { render json: @questionnairedetail.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n e...
[ "0.7308285", "0.7213015", "0.7071084", "0.7018416", "0.69889027", "0.6822846", "0.6793808", "0.67804736", "0.6752946", "0.6743366", "0.67090183", "0.66666895", "0.66576016", "0.6638422", "0.66212744", "0.66160965", "0.66143805", "0.66142154", "0.65997505", "0.6597809", "0.657...
0.7357181
0
DELETE /questionnairedetails/1 DELETE /questionnairedetails/1.json
def destroy @questionnairedetail.destroy respond_to do |format| format.html { redirect_to questionnairedetails_url, notice: 'Questionnairedetail was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n f...
[ "0.7912191", "0.7899743", "0.7899743", "0.7664643", "0.7662665", "0.7552165", "0.7463885", "0.7459275", "0.7426304", "0.7374384", "0.72807974", "0.7231025", "0.7203824", "0.7194857", "0.7178297", "0.71466076", "0.7134271", "0.7126231", "0.71232283", "0.7109177", "0.7096015", ...
0.7925967
0
Use callbacks to share common setup or constraints between actions.
def set_questionnairedetail @questionnairedetail = Questionnairedetail.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def questionnairedetail_params params.require(:questionnairedetail).permit(:answerUser, :eval, :idquestion, :questionnaire_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
Little piggy return `:legacy` if columns include legacy timestamp. If not return true if include normal...
def timestamps? if (model_column_names & %w[created_on updated_on]).any? :legacy else (model_column_names & %w[created_at updated_at]).any? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legacy_sql?\n val = @gapi.configuration.query.use_legacy_sql\n return true if val.nil?\n val\n end", "def legacy?\n false\n end", "def timestamp?\n type == \"TIMESTAMP\"\n end", "def must_convert?\n big_query_conversion_column.prese...
[ "0.64281315", "0.63737583", "0.6359907", "0.6264884", "0.61880654", "0.6122293", "0.6117424", "0.6066156", "0.6033362", "0.6009418", "0.57517433", "0.57485795", "0.57454", "0.5692984", "0.5685877", "0.5685877", "0.5685877", "0.5665288", "0.5634653", "0.55782837", "0.5557073",...
0.7235441
0
is there `acts_as_customizable` on Class ?
def custom_fields? model.included_modules.include?(Redmine::Acts::Customizable::InstanceMethods) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def acts_as_msfte\n extend ClassMethods\n end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def meta_eval &blk; metaclass.instance_eval &blk; end", "def klass_with_custom_fields(name)\n # Rails.logger.debug \"[CustomFields] klass_with_custom_fields #{self.send(name).metadata.klass}...
[ "0.646508", "0.6167005", "0.6167005", "0.6126345", "0.59056693", "0.5834514", "0.57772166", "0.57772166", "0.57196903", "0.5717793", "0.56755", "0.56755", "0.56188565", "0.5602623", "0.5602623", "0.5602623", "0.5577615", "0.5550352", "0.5502718", "0.5488895", "0.54771125", ...
0.51518357
48
This is veryvery experimental, security issue, ugly, piggy thing
def example_entity @example_entity ||= model&.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe; end", "def exploit\n end", "def secret_method_1\n end", "def spice; end", "def anchored; end", "def private; end", "def secret_method_2 # :nodoc:\n end", "def ygg_attacker() ; return nil ; end", "def weber; end", "def whitelist; end", "def silly_adjective; end", "def sharded?; tr...
[ "0.6003868", "0.56604725", "0.5629768", "0.5558828", "0.5526343", "0.5507268", "0.54845643", "0.54528475", "0.5367055", "0.5361867", "0.533751", "0.53168344", "0.52989703", "0.52928954", "0.528961", "0.5288071", "0.52869457", "0.52734876", "0.52698797", "0.5259207", "0.525114...
0.0
-1
GET /subscriptions GET /subscriptions.xml
def index respond_to do |format| format.html do # index.html.erb @subscriptions_col1 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 0',session['user_id']], :order => "pos_x, pos_y") @subscriptions_col2 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 1',session['user_id']], :order => "pos_x, pos_y") @subscriptions_col3 = Subscription.find(:all, :conditions=>['user_id = ? and pos_x = 2',session['user_id']], :order => "pos_x, pos_y") end format.xml do @subscriptions = Subscription.find(:all, :conditions=>['user_id = ?',session['user_id']]) render :xml => @subscriptions end format.rss do @subscriptions = Subscription.find(:all, :conditions=>['user_id = ?', session['user_id']]) @lastUpdated = Subscription.find(:first, :conditions=>['mes.user_id = ?', session['user_id']], :include => 'me', :order => 'mes.updated_at DESC') render :layout => false # uses index.rss.builder end format.js do if session['user_id'].nil? render :json => {:error => 'login failed'}, :status => 403 else @subscriptions = Subscription.find(:all, :conditions=>['subscriptions.user_id = ? and subscriptions.me_id is not null',session['user_id']], :include => 'me', :order => 'mes.updated_at DESC') render :json => @subscriptions.to_json(:include => { :me => { :include => { :me_sections => { :include => :section }, :comments => { :include => :user } } } }) end #render :json => @subscriptions.to_json end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(u...
[ "0.7869455", "0.77837133", "0.7622544", "0.73053646", "0.71226656", "0.70991266", "0.70027924", "0.70021904", "0.70021904", "0.6990712", "0.6937564", "0.6847288", "0.6847288", "0.6840999", "0.6803458", "0.68026453", "0.67664814", "0.674352", "0.6728131", "0.6720264", "0.66875...
0.0
-1
GET /subscriptions/1 GET /subscriptions/1.xml
def show @subscription = Subscription.find(params[:id], :conditions => "user_id = #{session['user_id']}") respond_to do |format| format.html { redirect_to(subscriptions_path) } format.xml { render :xml => @subscription } format.rss { render :layout => false } # uses show.rss.builder end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_my_subscriptions() path = \"/api/v2/utilities/subscriptions\"\n get(path, {}, AvaTax::VERSION) end", "def all_subscriptions\n get(url_(\"subscription\"))\n end", "def subscriptions\n url = url_with_api_version(@base_url, 'subscriptions')\n resp = rest_get(u...
[ "0.7497943", "0.7364156", "0.7267464", "0.6911617", "0.6845736", "0.6845736", "0.68284655", "0.6813624", "0.6813624", "0.6813624", "0.68099", "0.6787222", "0.6787222", "0.6767736", "0.67374855", "0.6695964", "0.663072", "0.66019106", "0.65869284", "0.65484625", "0.6540597", ...
0.6611024
17
POST /subscriptions POST /subscriptions.xml
def create @me = Me.find_by_subscribe_token(params[:subscription][:subscription_token]) if @me.validate_auth(User.find(session['user_id']).login, params[:auth]) @subscription = Subscription.new(params[:subscription]) @subscription.collapsed = false @subscription.me = @me @subscription.pos_x = 0; @subscription.pos_y = Subscription.find_last_y_pos(session['user_id']) + 1; respond_to do |format| if @subscription.save flash[:notice] = 'Subscription was successfully created.' format.html { redirect_to(subscriptions_path) } format.xml { render :xml => @subscription, :status => :created, :location => @subscription } else format.html { render :action => "new" } format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity } end end else flash[:notice] = 'You are not authorized to subscribe to this Me' respond_to do |format| format.html { redirect_to(subscriptions_path) } format.xml { render :xml => "invalid auth", :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post body=nil, headers={}\n @connection.post \"subscriptions.json\", body, headers\n end", "def create\n megam_rest.post_subscriptions(to_hash)\n end", "def create\n s_params = params[:subscription]\n s_params.delete(:id)\n @subscription = Subscription.new(s_param...
[ "0.7304615", "0.7219175", "0.69837844", "0.6862137", "0.6852749", "0.67479473", "0.6738934", "0.66649455", "0.66104853", "0.65223575", "0.65149474", "0.6507773", "0.64986247", "0.6443814", "0.6442383", "0.6438569", "0.6434718", "0.6380689", "0.63804936", "0.63492006", "0.6346...
0.0
-1
PUT /subscriptions/1 PUT /subscriptions/1.xml
def update @subscription = Subscription.find(params[:id]) respond_to do |format| if @subscription.update_attributes(params[:subscription]) flash[:notice] = 'Subscription was successfully updated.' format.html { redirect_to(@subscription) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @subscription.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @subscription = Subscription.get(params[:id])\n @subscription.update(params[:subscription])\n respond_with(@subscription.reload)\n end", "def create / update_subscriptions\n end", "def update\n @subscription = Subscription.find(params[:id])\n \n respond_to do |format|\n \n...
[ "0.6891499", "0.6844888", "0.6808242", "0.6775752", "0.67569554", "0.66222286", "0.6586289", "0.658252", "0.6581488", "0.65234166", "0.64916587", "0.64916587", "0.64916587", "0.64698297", "0.6449815", "0.64154965", "0.6396771", "0.6381251", "0.63667613", "0.63647616", "0.6362...
0.6826774
2
DELETE /subscriptions/1 DELETE /subscriptions/1.xml
def destroy @subscription = Subscription.find(params[:id]) @subscription.destroy respond_to do |format| format.html { redirect_to(subscriptions_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_subscriptions\n end", "def delete options={}, headers={}\n @connection.delete \"subscriptions.json\", options, headers\n end", "def delete_subscription(id)\n delete(\"/subscriptions/#{id}\")\n end", "def destroy\n @subscription = Subscription.find(params[:id])\n ...
[ "0.7548857", "0.73906046", "0.7138068", "0.713801", "0.7084096", "0.7068341", "0.70394236", "0.69738996", "0.69690835", "0.68415743", "0.68415743", "0.68415743", "0.68415743", "0.682856", "0.6815658", "0.68120563", "0.68061584", "0.67701143", "0.67555594", "0.6751333", "0.673...
0.73187655
4
Check additional resource control for current_user
def load_additional_resource(url,type=0) # type = 0 => print, 1 => revise if url.present? authorize = authorize_url(url) if authorize == true user_group = UserGroup.find(current_user.try(:user_group_id)) menu_id = UserMenu.where(:url => url).first.try(:id) user_access = UserGroupUserMenu.where(:user_menu_id => menu_id.to_i, :user_group_id => user_group.id.to_i).last if user_access.present? if type.to_i == 0 # Print allow = user_access.can_print elsif type.to_i == 1 # Revise allow = user_access.can_revise else allow = false end else allow = false end else # raise CanCan::AccessDenied allow = false end else # raise CanCan::AccessDenied allow = false end return allow end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "def verify_current_user\n instance_variable_set '@' + resource_name, resource.find_by_id(params[:id])\n if resou...
[ "0.75220776", "0.7280885", "0.7205381", "0.7129503", "0.71083885", "0.70416296", "0.6992293", "0.69898707", "0.69209075", "0.6856839", "0.6771319", "0.67674065", "0.6732081", "0.6716401", "0.6706421", "0.6704076", "0.66965", "0.6696417", "0.6660515", "0.6652633", "0.6641228",...
0.0
-1
Use this authorise method to change authorize_resource cancan if object has query string parameter
def authorize_access(url,param_value=nil) user = User.find(current_user.id) # if @split_tax_and_non_tax_transaction == 1 if param_value.present? if param_value.to_s == 'x' || param_value.to_s == 'l' || param_value.to_s == 'm' status = authorize_url("/#{url}?tt=#{param_value.to_s}") elsif param_value.is_a? Integer status = authorize_url("/#{url}?type=#{param_value.to_i}") else status = authorize_url("/#{url}") end else status = authorize_url("/#{url}") end # else # status = authorize_url("/#{url}") # end if status == false raise CanCan::AccessDenied end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_resource(*args); end", "def authorize_access\r\n # authorize!(action_name.to_sym, \"#{controller_name}_controller\".camelcase.constantize)\r\n end", "def authorize_resource\n EffectiveResources.authorize!(self, action_name.to_sym, resource)\n end", "def authorize_inherited_resou...
[ "0.73736644", "0.67596465", "0.66647476", "0.65768886", "0.65241265", "0.65162224", "0.65162224", "0.64994466", "0.6498702", "0.643495", "0.64326775", "0.6420728", "0.64088786", "0.62827724", "0.62812984", "0.62691534", "0.6244034", "0.62302434", "0.6226325", "0.6211437", "0....
0.59370476
61
only admins or team leads can swap duties
def swap? sid = record.duty_day.season_id user.has_role?(:admin) or user.has_role?(:leader, user.roster_spots.find_by(season_id: sid, team_id: record.duty_day.team_id)) or user.has_role?(:staff, user.roster_spots.find_by(season_id: sid)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pass_on_double_kill_assignment(assassin_id, deceased_id)\n assassin_id = assassin_id.to_i\n deceased_id = deceased_id.to_i\n assassin_assignment = Player.find(assassin_id).assignments.where(:active => true).last\n deceased_assignment = Player.find(deceased_id).assignments.where(:active => true).las...
[ "0.5938554", "0.5792789", "0.5743663", "0.5689024", "0.56889033", "0.56475407", "0.5573941", "0.55691195", "0.55393565", "0.5538354", "0.5515899", "0.55106276", "0.5466506", "0.5458252", "0.539861", "0.53938746", "0.53305703", "0.5319151", "0.531423", "0.530832", "0.5306062",...
0.7076485
0
Update:: Updates the surrent scene
def update syn_ht_update wait(1, true) if @wait_time != SynHT::Frames_hunger_down wait(1, false) if @wait_time_thirst != SynHT::Frames_thirst_down if @wait_time == SynHT::Frames_hunger_down or @wait_time2 == SynHT::Frames_thirst_down for i in 0...$game_party.actors.size $game_party.actors[i].hunger += 1 if @wait_time == SynHT::Frames_hunger_down $game_party.actors[i].thirst += 1 if @wait_time2 == SynHT::Frames_thirst_down call_ht_event(0, 0) if $game_party.actors[i].hunger == 200 call_ht_event(1, 0) if $game_party.actors[i].hunger == 175 call_ht_event(2, 0) if $game_party.actors[i].hunger == 150 call_ht_event(3, 0) if $game_party.actors[i].hunger == 125 call_ht_event(4, 0) if $game_party.actors[i].hunger == 100 call_ht_event(5, 0) if $game_party.actors[i].hunger == 75 call_ht_event(6, 0) if $game_party.actors[i].hunger == 50 call_ht_event(7, 0) if $game_party.actors[i].hunger == 25 call_ht_event(8, 0) if $game_party.actors[i].hunger == 0 call_ht_event(0, 1) if $game_party.actors[i].thirst == 200 call_ht_event(1, 1) if $game_party.actors[i].thirst == 175 call_ht_event(2, 1) if $game_party.actors[i].thirst == 150 call_ht_event(3, 1) if $game_party.actors[i].thirst == 125 call_ht_event(4, 1) if $game_party.actors[i].thirst == 100 call_ht_event(5, 1) if $game_party.actors[i].thirst == 75 call_ht_event(6, 1) if $game_party.actors[i].thirst == 50 call_ht_event(7, 1) if $game_party.actors[i].thirst == 25 call_ht_event(8, 1) if $game_party.actors[i].thirst == 0 end end @wait_time = 0 if @wait_time == SynHT::Frames_hunger_down @wait_time2 = 0 if @wait_time2 == SynHT::Frames_thirst_down end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\r\n $scene.update\r\n end", "def update\n @timer.update(Window.fps)\n case @scene\n when 'intro'\n update_intro\n when 'level'\n update_level\n when 'transition'\n update_transition\n when 'credits'\n updat...
[ "0.8933385", "0.8210681", "0.7823911", "0.72394294", "0.718427", "0.6857931", "0.682344", "0.6813313", "0.68010473", "0.6784102", "0.66485065", "0.65682155", "0.6563758", "0.6475375", "0.6439149", "0.6392886", "0.63785446", "0.63681626", "0.6360896", "0.6351463", "0.6310126",...
0.0
-1
Wait:: Allows Wait Times
def wait(duration, variable) for i in 0...duration @wait_time += 1 if variable @wait_time_thirst if variable == false break if i >= duration / 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait(seconds)\n @waiting = seconds * 1000\n end", "def wait\n sleep 0.0001\n end", "def brute_wait(delay)\n sleep(delay)\n end", "def wait\n sleep WAIT_TIME unless @skip_wait\n end", "def wait; end", "def wait; end", "def wait; end", "def wait!\n sleep(@sleep)\n end", ...
[ "0.78716975", "0.7800188", "0.7775478", "0.7672473", "0.76712835", "0.76712835", "0.76712835", "0.7640355", "0.75598574", "0.75467193", "0.7525073", "0.7525073", "0.7493897", "0.74822223", "0.7462065", "0.74085295", "0.7378307", "0.73702794", "0.7359364", "0.7239225", "0.7155...
0.6905547
34
Call_HT_Event:: Call the specified Common Event
def call_ht_event(event_id, mode) case mode when 0 $game_temp.common_event_id = SynHT::Call_event_hunger[event_id] when 1 $game_temp.common_event_id = SynHT::Call_event_thirst[event_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_common_event(id)\n if $imported[\"TH_SceneInterpreter\"] == true\n @interpreter.setup($data_common_events[id].list)\n @phone_command.activate\n else\n dispose_phone_background\n @phone_command.dispose\n $game_temp.reserve_common_event(id)\n SceneManager.return\n ...
[ "0.65438694", "0.65334266", "0.6190544", "0.61736244", "0.6131936", "0.6086461", "0.60568136", "0.5956838", "0.5893094", "0.585501", "0.5850222", "0.5801438", "0.57707983", "0.57518286", "0.57309884", "0.56581235", "0.5645046", "0.5623829", "0.5601605", "0.55773646", "0.55717...
0.6648459
0
Note that this method is mixed into each example, and so the instance variable we created here gets cleared automatically after each example
def config_override(hash) @config_override ||= {} @config_override.update(hash) @config = nil config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def examples\n @examples ||= HappinessExercises::Example.new\nend", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "d...
[ "0.6768202", "0.6369563", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", "0.62668824", ...
0.0
-1
ssh_login attempts to log in as host_admin on all hosts from current user
def ssh_login deploy_test_on_hosts_as self.host_admin, self.hosts, "/home/#{self.host_admin}\n", "should be able to connect via ssh" do 'pwd' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ssh_login_as_root\n deploy_test_on_hosts_as 'root', self.hosts, '/root', \"Should be able to connect as root via ssh\" do\n 'pwd'\n end\n end", "def ssh_login(do_tail, ssh_hostname, ssh_username, ssh_password)\n if ssh_hostname == '' or ssh_username == '' or ssh_password == ''\n puts ...
[ "0.69868636", "0.6118218", "0.60860646", "0.59994775", "0.5974996", "0.59332573", "0.5883073", "0.58120173", "0.58066857", "0.577147", "0.5739237", "0.5737033", "0.5695896", "0.5680103", "0.5666923", "0.5657754", "0.56322855", "0.5620444", "0.5586391", "0.55781394", "0.555690...
0.7970251
0
ssh_login_as_root attempts to log in as root on all hosts from current user
def ssh_login_as_root deploy_test_on_hosts_as 'root', self.hosts, '/root', "Should be able to connect as root via ssh" do 'pwd' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_root(host)\n if host['user'] != 'root'\n copy_ssh_to_root(host, @options)\n enable_root_login(host, @options)\n host['user'] = 'root'\n host.close\n end\n end", "def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify...
[ "0.76720446", "0.69390243", "0.69206846", "0.68384326", "0.6656752", "0.6541249", "0.6207311", "0.5973428", "0.58412856", "0.58041894", "0.57782066", "0.57202286", "0.57118976", "0.57045114", "0.5697089", "0.5685545", "0.56372404", "0.56215596", "0.55808175", "0.55271655", "0...
0.8573499
0
Make sure we end up with a flat array of probe_sets
def probe_sets=(probe_sets) @probe_sets = Array(probe_sets).flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def reset\n probe_sets.each(&:reset)\n end", "def set_up_test(input_plates)\n input_plates.each do |plate|\n sample = plate.parts.first.sample\n plate.add_samples(Array.new(plate.get_empty.length, sample))\n end\n end", "def...
[ "0.75054365", "0.58259267", "0.57316756", "0.5596252", "0.5537638", "0.54014885", "0.53901535", "0.53901535", "0.53901535", "0.53779405", "0.53712785", "0.5337241", "0.52932304", "0.5266021", "0.5200192", "0.5173299", "0.5155054", "0.512626", "0.5119021", "0.50681007", "0.506...
0.7023269
1
Grab some probe_sets or an array
def probe_sets @probe_sets ||= Array.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def search_handsets(proc)\n rez = @handsets.values.select do |hand| \n x = proc.call(hand) \n end\n return rez if rez != nil\n return Array::new\n end", "def probe_set\n attrs = {}\n ...
[ "0.673225", "0.5703736", "0.55009794", "0.5247279", "0.5132042", "0.51177025", "0.51177025", "0.51152086", "0.51013553", "0.50957507", "0.5056", "0.5043404", "0.50407255", "0.49609417", "0.49414137", "0.49347275", "0.49272776", "0.49272048", "0.49239904", "0.4921173", "0.4915...
0.7685559
0
Hash representation of all the probe_sets. This gives is an intermediate format that we can parse from other systems or code that needs reporting data for formatting, or whatever.
def to_hash # Drop the probes into the report probe_sets.inject({}) { |report, set| report[set.name.to_s] = set.probes.inject({}) { |memo, (_, probe)| # round the values to 2 decimal places memo[probe.name] = (probe.value.to_f * 100).round().to_f/100 memo } report } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def hash\n @__set.to_a.hash\n end", "def to_hash\n {:hashes => @hashes}\n end", "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def hashes\n return @hashes\n end...
[ "0.6722785", "0.64648277", "0.6322738", "0.6222438", "0.61927485", "0.6073966", "0.6037135", "0.6010736", "0.60016704", "0.5999653", "0.5960808", "0.5914729", "0.58373827", "0.58327526", "0.57916284", "0.5787507", "0.57529336", "0.5749161", "0.57395744", "0.5723585", "0.57222...
0.7712999
0
Reset all the counters in each probe.
def reset probe_sets.each(&:reset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_checks\n @counter = 0\n end", "def reset_stats; reset!; end", "def reset\n @count = 0\n end", "def reset!\n default_tags.clear\n adapters.clear\n groups.each_key { |group| singleton_class.send(:remove_method, group) if group && respond_to?(group) }\n @groups = ni...
[ "0.68230873", "0.65737253", "0.65549266", "0.6529333", "0.6486084", "0.6453623", "0.6449965", "0.6429226", "0.64178956", "0.63817275", "0.6360621", "0.63248456", "0.6299693", "0.6275549", "0.6275549", "0.62741816", "0.62735903", "0.62514997", "0.6224748", "0.620902", "0.62010...
0.8291183
0
String representation of all the probe_sets that's suitable for flushing out over a socket.
def to_s Psych.dump to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def probe_sets\n @probe_sets ||= Array.new\n end", "def to_s\n \"AppSpec[#{title}], #{@conf.keys.length} keys]\"\n end", "def inspect\n out = []\n out << string_name\n out << string_mappings\n out << string_data\n out.compact.join(' ') + '>'\n end", "def to_s\n [\n ...
[ "0.5404738", "0.5323262", "0.52991694", "0.5246874", "0.5230674", "0.5225777", "0.5210622", "0.51636946", "0.51473784", "0.511663", "0.5114243", "0.5110735", "0.5053343", "0.5040588", "0.5038903", "0.50256956", "0.50032705", "0.49998236", "0.4988689", "0.49810973", "0.4973306...
0.0
-1
The remodel method takes an Xml object as parameter. Output is expected to be the same. Modify the node in place. is preferred. An "information" hash is also passed in.
def remodel( node, info={} ) level = info[:count] || 1 node.attributes['level'] = level node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rexml!\n @@parser = USE_REXML\n end", "def node_to_model(node)\n\t\tlog(\"node_to_model #{node.class}\")\n\t\tinstance = @factory.instantiate_transformed(node)\n\t\tmetaclass = instance.class\n\t\tmetaclass.ecore.eAllAttributes.each do |attr|\n\t\t\tpopulate_attr(node,attr,instance)\n\t\tend\n\t\...
[ "0.5833564", "0.56044257", "0.5586835", "0.5562701", "0.5546754", "0.554131", "0.55039716", "0.5457295", "0.5360595", "0.52798563", "0.5271179", "0.5258607", "0.5215591", "0.52146006", "0.52047265", "0.5188132", "0.51628274", "0.5159342", "0.5098895", "0.5082334", "0.5082334"...
0.6260259
0