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 |
|---|---|---|---|---|---|---|
One method of adding a Writer to the Reader. Use this method to add an a) already instantiated Writer object, or b) a Writers from a class of Writer objects. | def add_writer(obj, *args)
if obj.is_a? Class
@writers << obj.new(*args, @write_to_channel)
elsif obj.kind_of?(Pants::Writers::BaseWriter) || obj.kind_of?(Pants::Seam)
@writers << obj
else
raise Pants::Error, "Don't know how to add a writer of type #{obj.class}"
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(writer)\n writers.push writer\n end",
"def add_writer(arg)\n chg_permission(writers, arg, :add)\n end",
"def <<(d)\n @writer << d\n self\n end",
"def new_writer\n Writer.create(user_id: self.id)\n end",
"def writer_instance!(additional_settings = {})\n wri... | [
"0.6691615",
"0.63735884",
"0.592196",
"0.5902543",
"0.5832235",
"0.57956177",
"0.5789892",
"0.5789892",
"0.5549548",
"0.55316883",
"0.5486336",
"0.5486336",
"0.54762197",
"0.538283",
"0.53712696",
"0.53412396",
"0.53280133",
"0.5287441",
"0.524044",
"0.5159466",
"0.51317084"... | 0.7049936 | 0 |
Removes a writer object from the internal list of writers. | def remove_writer(obj, key_value_pairs=nil)
if obj.is_a? Class
@writers.delete_if do |writer|
writer.is_a?(obj) &&
key_value_pairs.all? { |k, v| writer.send(k) == v }
end
elsif obj.is_a? String
writer = begin
uri = obj.is_a?(URI) ? obj ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_writer(arg)\n chg_permission(writers, arg, :remove)\n end",
"def remove( name ) @appenders.delete(name) end",
"def remove!\n @queue_for_removal.each do |path|\n FileUtils.rm(path) if File.exist?(path)\n end\n @removed = @queue_for_removal.dup\n @queue_for_rem... | [
"0.6900828",
"0.5679344",
"0.5657728",
"0.5495062",
"0.54532427",
"0.5255295",
"0.52433705",
"0.5241268",
"0.5226347",
"0.5213829",
"0.51903915",
"0.5168315",
"0.5155222",
"0.51433635",
"0.5081921",
"0.5071292",
"0.50704503",
"0.50506544",
"0.5034922",
"0.5026338",
"0.5016601... | 0.6204645 | 1 |
Allows for adding a Pants::Seam (or child) object to the reader's list of internal writers. For more info on Seams, see the docs for Pants::Seam. | def add_seam(klass, *args)
@writers << klass.new(@core_stopper_callback, @write_to_channel, *args)
@writers.last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register(writer)\n writers.push writer\n end",
"def add_writer(obj, *args)\n if obj.is_a? Class\n @writers << obj.new(*args, @write_to_channel)\n elsif obj.kind_of?(Pants::Writers::BaseWriter) || obj.kind_of?(Pants::Seam)\n @writers << obj\n else\n ... | [
"0.60782564",
"0.5997263",
"0.5905136",
"0.5729065",
"0.54244435",
"0.5340022",
"0.5340022",
"0.52894986",
"0.51102716",
"0.5107858",
"0.5082832",
"0.50654894",
"0.5057617",
"0.5053927",
"0.5039814",
"0.50022846",
"0.49746993",
"0.49501264",
"0.49347126",
"0.4932496",
"0.4917... | 0.62770003 | 0 |
The block to be called when starting up. Writers should all have been added before calling this; if writers are started after this, they won't get the first bytes that are read (due to startup time). This is used internally by child Readers to signal that they're up and running. If implementing your own Reader, make su... | def starter
@starter ||= EM.Callback { @running = true }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize &blk\n @writers = []\n instance_exec &blk if block_given?\n end",
"def start(callback)\n start_loop = EM.tick_loop do\n if @writers.empty? || @writers.all?(&:running?)\n :stop\n end\n end\n start_loop.on_stop { callback.call }\n\n ... | [
"0.58466977",
"0.57775176",
"0.5740258",
"0.5599169",
"0.55987746",
"0.5596814",
"0.5592669",
"0.55088377",
"0.5373049",
"0.5361889",
"0.5360914",
"0.53532785",
"0.53254265",
"0.5324899",
"0.53091824",
"0.530607",
"0.52245736",
"0.52230525",
"0.52178955",
"0.52041423",
"0.518... | 0.50718004 | 29 |
The callback that gets called when the Reader is done reading. Tells all of the associated writers to finish up. | def stopper
return @stopper if @stopper
@stopper = EM.Callback do
log "Got called back after finished reading. Starting shutdown..."
# remove this next_tick?
EM.next_tick do
start_loop = EM.tick_loop do
if @writers.empty? || @writers.none?(&:run... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finish_reading!\n @finished_read = true\n end",
"def read_finished\n\n # Stop current timer\n stop_current_timer\n\n # Update GUI state\n @view.update_notification({\n :type => :ok,\n :text => tr(\"Read ID3 Tags\")\n })\n\n # Log results\n log.debug \"... | [
"0.6910622",
"0.6482738",
"0.6401038",
"0.62295353",
"0.60542345",
"0.60161895",
"0.60009307",
"0.59498626",
"0.59166574",
"0.58850235",
"0.5846208",
"0.58284277",
"0.575084",
"0.5712729",
"0.5710742",
"0.57101",
"0.5650568",
"0.56385285",
"0.55771786",
"0.55467606",
"0.55312... | 0.623267 | 3 |
add category into item_id | def add_categories_into_items(category_id)
client = create_db_client
client.query("insert into item_categories values (#{@id}, #{category_id})")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_item_category\n @item_category = current_company.item_categories.friendly.find(params[:id]) || []\n end",
"def set_category_item\n @category_item = CategoryItem.find(params[:id])\n end",
"def set_cat_item\n @cat_item = CatItem.find(params[:id])\n end",
"def create\n # Create an... | [
"0.72034746",
"0.71460885",
"0.6904595",
"0.67684084",
"0.66900504",
"0.66821164",
"0.66591746",
"0.651109",
"0.64570916",
"0.64153457",
"0.6332145",
"0.6328727",
"0.6322493",
"0.6315312",
"0.62928563",
"0.62829673",
"0.625383",
"0.62394005",
"0.6231845",
"0.618317",
"0.61767... | 0.7770275 | 0 |
GET /myers_briggs_types GET /myers_briggs_types.xml | def index
@myers_briggs_types = MyersBriggsType.find(:all)
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @myers_briggs_types }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @myers_briggs_type = MyersBriggsType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @myers_briggs_type }\n end\n end",
"def new\n @myers_briggs_type = MyersBriggsType.new\n\n respond_to do |format|\n format.html ... | [
"0.68329453",
"0.62519324",
"0.6211533",
"0.61807585",
"0.61748195",
"0.6173207",
"0.6118134",
"0.6116261",
"0.6110931",
"0.6065394",
"0.60546505",
"0.5989447",
"0.59616137",
"0.5950081",
"0.5939582",
"0.59352565",
"0.58856505",
"0.5850482",
"0.58425087",
"0.5841118",
"0.5837... | 0.7645575 | 0 |
GET /myers_briggs_types/1 GET /myers_briggs_types/1.xml | def show
@myers_briggs_type = MyersBriggsType.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @myers_briggs_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @myers_briggs_types = MyersBriggsType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @myers_briggs_types }\n end\n end",
"def new\n @myers_briggs_type = MyersBriggsType.new\n\n respond_to do |format|\n format.html # n... | [
"0.76050615",
"0.6489409",
"0.61874324",
"0.6178703",
"0.60910976",
"0.6041398",
"0.595851",
"0.5927461",
"0.59012544",
"0.5892343",
"0.5868469",
"0.5831686",
"0.5790962",
"0.5788308",
"0.577645",
"0.57706606",
"0.5760919",
"0.57584167",
"0.5729124",
"0.57250416",
"0.57221794... | 0.706231 | 1 |
GET /myers_briggs_types/new GET /myers_briggs_types/new.xml | def new
@myers_briggs_type = MyersBriggsType.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @myers_briggs_type }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @rtype = Rtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rtype }\n end\n end",
"def new\n @uri_type = UriType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uri_type }\n ... | [
"0.6940473",
"0.6894322",
"0.67932004",
"0.67797035",
"0.67021185",
"0.6641797",
"0.6641797",
"0.663585",
"0.66189986",
"0.6610868",
"0.6606356",
"0.6603027",
"0.6599699",
"0.65957487",
"0.6592694",
"0.6585176",
"0.65770566",
"0.65624523",
"0.6555169",
"0.65445375",
"0.653501... | 0.7568663 | 0 |
POST /myers_briggs_types POST /myers_briggs_types.xml | def create
@myers_briggs_type = MyersBriggsType.new(params[:myers_briggs_type])
respond_to do |format|
if @myers_briggs_type.save
flash[:notice] = 'Myers Briggs Type was successfully created.'
format.html { redirect_to(@myers_briggs_type) }
format.xml { render :xml => @myers_brig... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @myers_briggs_types = MyersBriggsType.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @myers_briggs_types }\n end\n end",
"def new\n @myers_briggs_type = MyersBriggsType.new\n\n respond_to do |format|\n format.html # n... | [
"0.6064794",
"0.5972651",
"0.56494147",
"0.56494147",
"0.5627043",
"0.5627043",
"0.56159604",
"0.55545235",
"0.554836",
"0.55376303",
"0.5360704",
"0.5352549",
"0.53476596",
"0.5341233",
"0.533156",
"0.53171223",
"0.5301289",
"0.52770096",
"0.5267236",
"0.5265467",
"0.5249399... | 0.6419707 | 0 |
PUT /myers_briggs_types/1 PUT /myers_briggs_types/1.xml | def update
@myers_briggs_type = MyersBriggsType.find(params[:id])
respond_to do |format|
if @myers_briggs_type.update_attributes(params[:myers_briggs_type])
flash[:notice] = 'Myers Briggs Type was successfully updated.'
format.html { redirect_to(@myers_briggs_type) }
format.xml {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @gearbox_type = GearboxType.find(params[:id])\n\n respond_to do |format|\n if @gearbox_type.update_attributes(params[:gearbox_type])\n format.html {... | [
"0.5970668",
"0.5878723",
"0.5810079",
"0.5726711",
"0.5658409",
"0.56433713",
"0.5598862",
"0.55303013",
"0.5505016",
"0.54793936",
"0.547814",
"0.54609215",
"0.5457872",
"0.54495424",
"0.5436078",
"0.5411374",
"0.53964573",
"0.5395248",
"0.5393557",
"0.53703135",
"0.5345636... | 0.6572758 | 0 |
DELETE /myers_briggs_types/1 DELETE /myers_briggs_types/1.xml | def destroy
@myers_briggs_type = MyersBriggsType.find(params[:id])
@myers_briggs_type.destroy
respond_to do |format|
format.html { redirect_to(myers_briggs_types_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def destroy\n @browsenodeid = Browsenodeid.find(params[:id... | [
"0.6484036",
"0.64258844",
"0.63592803",
"0.6299006",
"0.62733924",
"0.6211483",
"0.6103692",
"0.6088288",
"0.60662526",
"0.6028026",
"0.6016175",
"0.6011274",
"0.59977317",
"0.5986943",
"0.59856546",
"0.598148",
"0.5980391",
"0.59544593",
"0.59471613",
"0.5945351",
"0.593289... | 0.7074993 | 0 |
Sets database variables from remote database.yaml | def prepare_env(load_stage = stage)
load_stage = load_stage.to_s
if !db_config
Wpcap::Utility.error("No Database Configurations Found")
abort
end
if remote_config(:db_priv_pass).nil?
Wpcap::Utility.error "This no privileged user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_from_yaml\n set(:db_backup_path) { \"#{shared_path}/backup/\" }\n\n set(:db_local_file) { \"tmp/\" }\n set(:db_user) { db_config[rails_env.to_s][\"username\"] }\n set(:db_pass) { db_config[rails_env.to_s][\"password\"] }\n set(:db_host) { db_config[rails_env.to_s][\"... | [
"0.76494503",
"0.7541654",
"0.7534222",
"0.74918544",
"0.7032091",
"0.6986846",
"0.698128",
"0.6928563",
"0.6928563",
"0.6793512",
"0.6572976",
"0.6572976",
"0.6552539",
"0.6552539",
"0.6364681",
"0.6355535",
"0.629339",
"0.6278586",
"0.62180614",
"0.61794144",
"0.6178285",
... | 0.6279337 | 17 |
Show all wiki pages | def index
@doc_pu_wikis = @doc_pu.doc_pu_wiki_pages
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @wiki_pages = @wiki.wiki_pages.paginate(:page => params[:page]).order(\"title\") #.select(\"id, title, url_title, updated_at\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wiki }\n end\n end",
"def index\n @wikis = Wiki.all\n end",
... | [
"0.7386143",
"0.73658514",
"0.7183498",
"0.7152049",
"0.70866925",
"0.70650345",
"0.7007615",
"0.6997158",
"0.6997158",
"0.6911223",
"0.68943846",
"0.68872404",
"0.687679",
"0.6871017",
"0.6795946",
"0.6786315",
"0.6754463",
"0.6653217",
"0.665096",
"0.66442823",
"0.66402835"... | 0.70405006 | 6 |
ajax call for autocomplete of wiki page | def list_wiki_pages
results = WikiPage.joins(wiki: :project)
.where("CONCAT_WS(':', `projects`.`name`, `wiki_pages`.`title`) LIKE ? ", "%#{params[:term]}%")
.select('projects.name, wiki_pages.title')
.limit(10)
render :json => results.map { |x| "#{x.name}:#{x... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ajax_auto_complete\n type = params[:type].to_s\n instr = params[:id].to_s\n letter = ' '\n scientific = false\n user = login_for_ajax\n if user\n scientific = (user.location_format == :scientific)\n end\n @items = []\n if instr.match(/^(\\w)/)\n letter = $1\n case typ... | [
"0.6733329",
"0.66892415",
"0.66337985",
"0.65949047",
"0.6527417",
"0.6479581",
"0.6464483",
"0.6398871",
"0.63889277",
"0.6353983",
"0.63410056",
"0.63061416",
"0.63036525",
"0.6238409",
"0.6234445",
"0.62256503",
"0.61868024",
"0.618344",
"0.6175767",
"0.61703235",
"0.6167... | 0.0 | -1 |
Create new wiki page | def new
@doc_pu_wiki = DocPuWikiPage.new()
@doc_pu_wiki.use_doc_flags = true
if request.post?
# Save object
reorder_pages(@doc_pu.doc_pu_wiki_pages.all)
@doc_pu_wiki = @doc_pu.doc_pu_wiki_pages.create(parse_form params[:doc_pu_wiki])
@doc_pu_wiki.w... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(p)\n puts \"Creating page #{p}\"\n Dir.mkdir p unless File.exists? p\n Content.new(\"#{@dir}\", @extension).page p\n end",
"def new\n @page = Page.new\n @document = \"\"\n @title = \"\"\n if !params[:url].nil? then\n #load openwiki page using Hpricot (http://code.whythelucky... | [
"0.7504952",
"0.74567825",
"0.72706044",
"0.72197396",
"0.7209928",
"0.71967715",
"0.7100447",
"0.70950675",
"0.70785",
"0.70654976",
"0.70473176",
"0.7015652",
"0.7015492",
"0.69244486",
"0.6904364",
"0.6901134",
"0.68840015",
"0.6833289",
"0.6829759",
"0.6818507",
"0.679539... | 0.68098575 | 20 |
GET /displays/1 GET /displays/1.xml | def show
@display = Display.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @display }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def show\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actuator }\n end\n end",
"def show\n @host = Host.find(params[:id])\n\n respond_to do |format|\n ... | [
"0.6898433",
"0.6287658",
"0.62850976",
"0.6278213",
"0.6266228",
"0.6251977",
"0.6251977",
"0.6246793",
"0.6237264",
"0.62365615",
"0.6225728",
"0.62201416",
"0.6197986",
"0.6196384",
"0.6182358",
"0.6180226",
"0.6171212",
"0.61681527",
"0.61539435",
"0.6151431",
"0.61470324... | 0.6743643 | 1 |
GET /displays/new GET /displays/new.xml | def new
@display = Display.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @display }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end",
"def new\n @title = \"New Networks\"\n @network = Network.new\n @computers = Computer.find(:all)\n\n respond_to do |format|\n format.html # new.h... | [
"0.69655865",
"0.68386364",
"0.6809077",
"0.664608",
"0.6572203",
"0.65641415",
"0.6540883",
"0.65294814",
"0.650088",
"0.650088",
"0.64840966",
"0.64767367",
"0.6470807",
"0.6449951",
"0.64489025",
"0.6431256",
"0.6431256",
"0.6431256",
"0.6431256",
"0.6431256",
"0.6431256",... | 0.73301536 | 0 |
POST /displays POST /displays.xml | def create
@display = Display.new(params[:display])
respond_to do |format|
if @display.save
flash[:notice] = 'Display was successfully created.'
format.html { redirect_to(@display) }
format.xml { render :xml => @display, :status => :created, :location => @display }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @displays = Display.all\n end",
"def create\n @display = Display.new(display_params)\n\n respond_to do |format|\n if @display.save\n format.html { redirect_to @display, notice: 'Display was successfully created.' }\n format.json { render :show, status: :created, location:... | [
"0.63249105",
"0.60859734",
"0.6034223",
"0.5935044",
"0.5782737",
"0.5683307",
"0.55434287",
"0.5531766",
"0.55228657",
"0.54969484",
"0.54694146",
"0.5466413",
"0.54659986",
"0.5390871",
"0.5379902",
"0.52862734",
"0.52248627",
"0.51915056",
"0.5177322",
"0.51737076",
"0.51... | 0.62413985 | 1 |
PUT /displays/1 PUT /displays/1.xml | def update
@display = Display.find(params[:id])
respond_to do |format|
if @display.update_attributes(params[:display])
flash[:notice] = 'Display was successfully updated.'
format.html { redirect_to(@display) }
format.xml { head :ok }
else
format.html { render :actio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @display = Display.find(params[:id])\n\n respond_to do |format|\n if @display.update_attributes(params[:display])\n format.html { redirect_to @display, :notice => 'Display was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render... | [
"0.5980196",
"0.57430494",
"0.57275265",
"0.5639965",
"0.5613882",
"0.5567246",
"0.555233",
"0.55268484",
"0.5503012",
"0.5478614",
"0.5476996",
"0.5462383",
"0.5450341",
"0.5427907",
"0.54196304",
"0.5414602",
"0.5373381",
"0.5371028",
"0.5362262",
"0.53532904",
"0.53370774"... | 0.6250101 | 0 |
DELETE /displays/1 DELETE /displays/1.xml | def destroy
@display = Display.find(params[:id])
@display.destroy
respond_to do |format|
format.html { redirect_to(displays_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @display = Display.find(params[:id])\n @display.destroy\n\n respond_to do |format|\n format.html { redirect_to displays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def... | [
"0.65213645",
"0.6513333",
"0.6336367",
"0.63099784",
"0.6306484",
"0.63017845",
"0.6280379",
"0.6252489",
"0.6216513",
"0.62132806",
"0.6203538",
"0.6198441",
"0.617636",
"0.617597",
"0.615815",
"0.6157086",
"0.6129867",
"0.6123923",
"0.61080265",
"0.61079806",
"0.6107227",
... | 0.7225462 | 0 |
Creates a new map. Parameters: [t_w] The width of the tiles. [t_h] The height of the tiles. [t_x_count] The horizontal count of tiles in the map. [t_y_count] The vertical count of tiles in the map. [scr_w] Width of the viewport for the map. [scr_h] Height of the viewport for the map. [isometric] Whether to use a isomet... | def initialize(t_w, t_h, t_x_count, t_y_count, scr_w = 800, scr_h = 600, isometric = false, limit_cam = true)
@tile_size = Vector.new t_w, t_h
@size = Vector.new t_x_count, t_y_count
@cam = Rectangle.new 0, 0, scr_w, scr_h
@limit_cam = limit_cam
@isometric = isometric
if isometric
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_tiles\n # Screen fits exactly 15x10 tiles (for 480x320), but it has a buffer around it\n # so the game has time to refresh without showing a black border during movement.\n tiles = []\n (TOTALSIZE).times { tiles << TileSprite.new($visuals.viewport) }\n @array = tiles\n star... | [
"0.57705647",
"0.56661403",
"0.5595331",
"0.55007136",
"0.54122466",
"0.5389546",
"0.53849167",
"0.5376593",
"0.5329303",
"0.53284156",
"0.5267978",
"0.5228539",
"0.517244",
"0.5100698",
"0.50863105",
"0.5080919",
"0.5079992",
"0.5069421",
"0.5043266",
"0.502768",
"0.49769884... | 0.7376335 | 0 |
Returns a Vector with the total size of the map, in pixels (x for the width and y for the height). | def get_absolute_size
return Vector.new(@tile_size.x * @size.x, @tile_size.y * @size.y) unless @isometric
avg = (@size.x + @size.y) * 0.5
Vector.new (avg * @tile_size.x).to_i, (avg * @tile_size.y).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pixelSize()\n GoogleMap.getPixelSize(@zoom)\n end",
"def height\n @map.size\n end",
"def size\n @map.size\n end",
"def width\n @map[0].size\n end",
"def pixel_size; size.x * size.y; end",
"def size\n @size ||= raster_size\n end",
"def map_size()\n Config... | [
"0.7648035",
"0.7614727",
"0.7253204",
"0.7145321",
"0.7062736",
"0.7062605",
"0.6956013",
"0.68316156",
"0.68050504",
"0.6765245",
"0.6755138",
"0.6744056",
"0.67305183",
"0.67247355",
"0.6707618",
"0.6707618",
"0.66786516",
"0.66726035",
"0.66223794",
"0.65577483",
"0.65226... | 0.695383 | 7 |
Returns a Vector with the coordinates of the center of the map. | def get_center
abs_size = get_absolute_size
Vector.new(abs_size.x * 0.5, abs_size.y * 0.5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center()\n Vector.new(x + w / 2, y + h / 2, z)\n end",
"def getCenter\n\t\tbox = self.bbox\n\t\t[ (box[0] + box[2])/2, (box[1] + box[3])/2 ]\n\tend",
"def compute_center\n x_center = center_value(@points, :x)\n y_center = center_value(@points, :y)\n [x_center, y_center]\n ... | [
"0.7962217",
"0.77004033",
"0.7400012",
"0.73574615",
"0.7339079",
"0.73190045",
"0.7192179",
"0.71815586",
"0.6963735",
"0.695686",
"0.6944348",
"0.68800384",
"0.68800384",
"0.68777966",
"0.6874306",
"0.68616635",
"0.6847194",
"0.6825216",
"0.673377",
"0.67009664",
"0.667950... | 0.8074472 | 0 |
Returns the position in the screen corresponding to the given tile indices. Parameters: [map_x] The index of the tile in the horizontal direction. It must be in the interval 0..t_x_count. [map_y] The index of the tile in the vertical direction. It must be in the interval 0..t_y_count. | def get_screen_pos(map_x, map_y)
return Vector.new(map_x * @tile_size.x - @cam.x, map_y * @tile_size.y - @cam.y) unless @isometric
Vector.new ((map_x - map_y - 1) * @tile_size.x * 0.5) - @cam.x + @x_offset,
((map_x + map_y) * @tile_size.y * 0.5) - @cam.y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pos(tilew, tileh, hmul, x,y)\n r = $map[y] || []\n my = 0\n tile = \"grass\"\n if r.is_a?(Array)\n my = r[x] || 0\n else\n # I apply a factor of 0.7 here, as pure\n # integer multiples of the tile height looks\n # odd. In a proper map representation I may\n # make the height much more granu... | [
"0.6829454",
"0.6819093",
"0.6814476",
"0.6584052",
"0.63942003",
"0.63604987",
"0.628155",
"0.62434983",
"0.62184316",
"0.6146021",
"0.61283803",
"0.611162",
"0.6101842",
"0.60007316",
"0.59845454",
"0.5955803",
"0.5939827",
"0.59359604",
"0.5884325",
"0.5881471",
"0.5868904... | 0.6881615 | 0 |
Returns the tile in the map that corresponds to the given position in the screen, as a Vector, where x is the horizontal index and y the vertical index. Parameters: [scr_x] The xcoordinate in the screen. [scr_y] The ycoordinate in the screen. | def get_map_pos(scr_x, scr_y)
return Vector.new((scr_x + @cam.x) / @tile_size.x, (scr_y + @cam.y) / @tile_size.y) unless @isometric
# Gets the position transformed to isometric coordinates
v = get_isometric_position scr_x, scr_y
# divides by the square size to find the position in the matrix
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_screen_pos(map_x, map_y)\n return Vector.new(map_x * @tile_size.x - @cam.x, map_y * @tile_size.y - @cam.y) unless @isometric\n Vector.new ((map_x - map_y - 1) * @tile_size.x * 0.5) - @cam.x + @x_offset,\n ((map_x + map_y) * @tile_size.y * 0.5) - @cam.y\n end",
"def tile_at x,... | [
"0.6814025",
"0.67372864",
"0.6500907",
"0.6401976",
"0.63973475",
"0.63642216",
"0.6255233",
"0.6253802",
"0.6198596",
"0.6187386",
"0.6009839",
"0.5954056",
"0.59172225",
"0.58900154",
"0.5808503",
"0.5764479",
"0.57178754",
"0.5684719",
"0.56590194",
"0.5627168",
"0.562377... | 0.75934327 | 0 |
Verifies whether a tile is inside the map. Parameters: [v] A Vector representing the tile, with x as the horizontal index and y as the vertical index. | def is_in_map(v)
v.x >= 0 && v.y >= 0 && v.x < @size.x && v.y < @size.y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def detect_invalid_tile(x, y, width, height, tile_id)\n ox = Yuki::MapLinker.get_OffsetX\n oy = Yuki::MapLinker.get_OffsetY\n rangex = (x + ox)...(x + ox + width)\n rangey = (y + oy)...(y + oy + height)\n gm = $game_map\n return rangex.any? { |tx| rangey.any? { |ty| gm.get_tile(tx, ty) == tile_id... | [
"0.6460443",
"0.6080932",
"0.5796649",
"0.5733084",
"0.57130104",
"0.5701673",
"0.5701673",
"0.56836677",
"0.5683086",
"0.5680691",
"0.566915",
"0.5645393",
"0.56440896",
"0.5634073",
"0.5631142",
"0.5602193",
"0.558726",
"0.54998946",
"0.54913884",
"0.54658854",
"0.5455951",... | 0.729486 | 0 |
Sets the top left corner of the viewport to the given position of the map. Note that this is not the position in the screen. Parameters: [cam_x] The xcoordinate inside the map, in pixels (not a tile index). [cam_y] The ycoordinate inside the map, in pixels (not a tile index). | def set_camera(cam_x, cam_y)
@cam.x = cam_x
@cam.y = cam_y
set_bounds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_camera(x, y)\n @cam.x += x\n @cam.y += y\n set_bounds\n end",
"def center(x, y)\n return unless $game_map.target_camera == self\n if $game_map.camera_x_locked?\n $game_map.set_display_pos($game_map.display_x, y - center_y)\n elsif $game_map.camera_y_locked?\n $game_m... | [
"0.59298563",
"0.5873903",
"0.5575657",
"0.5575657",
"0.55264723",
"0.5455591",
"0.5439367",
"0.5389722",
"0.5325746",
"0.519993",
"0.5148393",
"0.51106757",
"0.50886595",
"0.50679374",
"0.50395536",
"0.49906254",
"0.4988172",
"0.4955838",
"0.4955838",
"0.4941819",
"0.4936359... | 0.72332877 | 0 |
Moves the viewport by the given amount of pixels. Parameters: [x] The amount of pixels to move horizontally. Negative values will cause the camera to move to the left. [y] The amount of pixels to move vertically. Negative values will cause the camera to move up. | def move_camera(x, y)
@cam.x += x
@cam.y += y
set_bounds
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move(y, x)\n Ncurses.wmove(pointer, y, x)\n end",
"def move(y, x)\n update(y, x)\n apply_pos\n end",
"def move(x,y)\n @x +=x\n @y +=y\n end",
"def set_at(x, y)\n self.x = x\n self.x = 0 if x < 0\n self.y = y\n if x + self.width > 640\n self.x -= ... | [
"0.6627188",
"0.6498104",
"0.6352321",
"0.6342348",
"0.63037044",
"0.62818986",
"0.62552917",
"0.6142135",
"0.6079051",
"0.6059708",
"0.6054541",
"0.60489655",
"0.6048842",
"0.6022349",
"0.60205305",
"0.6013409",
"0.59928054",
"0.59859014",
"0.5952436",
"0.5949813",
"0.593084... | 0.72183836 | 0 |
Iterates through the currently visible tiles, providing the horizontal tile index, the vertical tile index, the xcoordinate (in pixels) and the ycoordinate (in pixels), of each tile, in that order, to a given block of code. Example: map.foreach do |i, j, x, y| draw_tile tiles[i][j], x, y end | def foreach
for j in @min_vis_y..@max_vis_y
for i in @min_vis_x..@max_vis_x
pos = get_screen_pos i, j
yield i, j, pos.x, pos.y
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_tile level\n\t\t\tsize = tile_size level\n\t\t\t(0...size).each do |y|\n\t\t\t\t(0...size).each do |x|\n\t\t\t\t\tyield(x, y) if block_given?\n\t\t\t\tend\n\t\t\tend\n\t\tend",
"def each_cell\n @grid_w.times.with_index do |x|\n @grid_h.times.with_index do |y|\n yield x, y, @grid[x][y]\n ... | [
"0.70020133",
"0.6765044",
"0.66449785",
"0.65406144",
"0.64914685",
"0.6411187",
"0.6299239",
"0.6291487",
"0.6274615",
"0.6091659",
"0.6089028",
"0.607284",
"0.60251963",
"0.60177046",
"0.5989984",
"0.5943617",
"0.59208155",
"0.5908707",
"0.5885215",
"0.5851062",
"0.584154"... | 0.64382076 | 5 |
GET /hhcodes/1 GET /hhcodes/1.json | def show
@hhcode = Hhcode.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @hhcode }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @hhcode = Hhcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hhcode }\n end\n end",
"def show\n @code = Code.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @code... | [
"0.6878163",
"0.6492495",
"0.62977266",
"0.62722933",
"0.61714095",
"0.61641675",
"0.6133235",
"0.6123549",
"0.6120615",
"0.61172646",
"0.6098885",
"0.6064811",
"0.60231227",
"0.6002764",
"0.59532213",
"0.59147775",
"0.5914495",
"0.5909503",
"0.5900448",
"0.58810735",
"0.5880... | 0.7749577 | 0 |
GET /hhcodes/new GET /hhcodes/new.json | def new
@hhcode = Hhcode.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @hhcode }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @code = Code.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @code }\n end\n end",
"def new\n @code = Code.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @code }\n end\n end",
... | [
"0.765749",
"0.7606538",
"0.71452856",
"0.71222556",
"0.71136427",
"0.7078451",
"0.6959365",
"0.69521093",
"0.6944883",
"0.6921973",
"0.686044",
"0.68388295",
"0.68304646",
"0.6804687",
"0.6803501",
"0.6799387",
"0.6789731",
"0.67413825",
"0.6727616",
"0.67152756",
"0.6679678... | 0.79868233 | 0 |
POST /hhcodes POST /hhcodes.json | def create
@hhcode = Hhcode.new(params[:hhcode])
respond_to do |format|
if @hhcode.save
format.html { redirect_to @hhcode, notice: 'Hhcode was successfully created.' }
format.json { render json: @hhcode, status: :created, location: @hhcode }
else
format.html { render action:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @hhcode = Hhcode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hhcode }\n end\n end",
"def create_phaxcode(options)\n send_post(\"/createPhaxCode\", options)\n end",
"def create\n @code = Code.new(params[:code])\n\n respo... | [
"0.63325405",
"0.6239791",
"0.6023199",
"0.58668584",
"0.58668584",
"0.58668584",
"0.58668584",
"0.58668584",
"0.5825359",
"0.57614285",
"0.5753874",
"0.5734863",
"0.5682116",
"0.56430966",
"0.55832165",
"0.55808944",
"0.5549123",
"0.55486554",
"0.5541529",
"0.55406904",
"0.5... | 0.71614146 | 0 |
PUT /hhcodes/1 PUT /hhcodes/1.json | def update
@hhcode = Hhcode.find(params[:id])
respond_to do |format|
if @hhcode.update_attributes(params[:hhcode])
format.html { redirect_to @hhcode, notice: 'Hhcode was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @hhcode = Hhcode.new(params[:hhcode])\n\n respond_to do |format|\n if @hhcode.save\n format.html { redirect_to @hhcode, notice: 'Hhcode was successfully created.' }\n format.json { render json: @hhcode, status: :created, location: @hhcode }\n else\n format.html { r... | [
"0.62289304",
"0.6213805",
"0.61013657",
"0.6086993",
"0.6086993",
"0.6086993",
"0.6086993",
"0.5966481",
"0.59601593",
"0.5954607",
"0.58698857",
"0.5862989",
"0.5858707",
"0.5849312",
"0.5837602",
"0.58326924",
"0.58304477",
"0.57956177",
"0.5714643",
"0.5712974",
"0.570859... | 0.7236599 | 0 |
DELETE /hhcodes/1 DELETE /hhcodes/1.json | def destroy
@hhcode = Hhcode.find(params[:id])
@hhcode.destroy
respond_to do |format|
format.html { redirect_to hhcodes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n f... | [
"0.72784287",
"0.7278392",
"0.7186408",
"0.71761674",
"0.7170671",
"0.7120848",
"0.71156013",
"0.71109134",
"0.71109134",
"0.71109134",
"0.71109134",
"0.7103984",
"0.7094442",
"0.7091103",
"0.70873666",
"0.7073925",
"0.7053701",
"0.7047829",
"0.70327795",
"0.7028068",
"0.7020... | 0.80184865 | 0 |
Before filters Confirms a loggedin user. | def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Please log in."
redirect_to login_url
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end",
"def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end",
"def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\... | [
"0.6569167",
"0.6431158",
"0.64242524",
"0.6414525",
"0.63993794",
"0.62910813",
"0.6250187",
"0.6250068",
"0.6219974",
"0.6173334",
"0.6124951",
"0.61156535",
"0.6079899",
"0.6063604",
"0.6040224",
"0.60305846",
"0.60231",
"0.60203457",
"0.60158736",
"0.6001517",
"0.5994017"... | 0.0 | -1 |
Confirms an professor user. | def professor_user
unless this_is_professore?(current_user)
flash[:danger] = "You don't have the rights for this action."
redirect_to(root_url)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"You don't have the rights for this page.\"\n redirect_to(root_url)\n end\n end",
"def professor_user\n unless this_is_professore?(current_user)\n flash[:danger] = \"... | [
"0.72647953",
"0.72355074",
"0.72355074",
"0.6584748",
"0.6506757",
"0.6477231",
"0.64447457",
"0.64315003",
"0.64139545",
"0.6323066",
"0.63205206",
"0.6289205",
"0.62765735",
"0.6255378",
"0.62477815",
"0.6246606",
"0.6235846",
"0.622187",
"0.6198859",
"0.61904633",
"0.6185... | 0.731625 | 0 |
Removes and returns the last stack item off the stack | def pop
curr = items
ret = curr.pop
serialize(curr)
ret.nil? ? nil : ret
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n if @items.empty?\n return nil\n end\n return @items.pop()\n end",
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n ... | [
"0.8429342",
"0.84022385",
"0.83648664",
"0.8283202",
"0.828011",
"0.82560664",
"0.8192215",
"0.8185307",
"0.8168911",
"0.8154981",
"0.8154981",
"0.81548786",
"0.8147984",
"0.8147984",
"0.8123437",
"0.8119894",
"0.8091392",
"0.80878365",
"0.80248827",
"0.80248827",
"0.8022276... | 0.0 | -1 |
Serializes the item stack into two ENV variables. This is done to preserve backward compatibility with earlier versions of cli/ui. This ensures that any code that relied upon previous stack behavior should continue to work. | def serialize(items)
colors = []
styles = []
items.each do |item|
colors << item.color.name
styles << item.frame_style.name
end
ENV[COLOR_ENVVAR] = colors.join(':')
ENV[STYLE_ENVVAR] = styles.join(':')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stack(app_env)\n name, env = app_env.split(SEPARATOR)\n stack = settings['stack'] || {}\n (stack[name] && stack[name][env]) || stack['all']\n end",
"def to_s()\n var_Message = \"ENVS Stack:\"\n if(@VAR_STACK == nil)\n return var_Message += \" nil\"\n end\n\n var_M... | [
"0.59097683",
"0.57777065",
"0.5704752",
"0.54769045",
"0.5438409",
"0.53761274",
"0.5374299",
"0.5332974",
"0.5312766",
"0.5256297",
"0.5255796",
"0.5217127",
"0.5209143",
"0.5165678",
"0.51413095",
"0.5115162",
"0.51110685",
"0.5076458",
"0.50466824",
"0.50395757",
"0.50312... | 0.6463443 | 0 |
options: :scope ActiveRecord scope with school, federation, ref_date, etc. scope should be query of stats to reduce EXCEPT for the names. | def reduce_dropout_rate(stats_scope)
if stats_scope.nil?
raise 'need stats_scope to reduce dropout_rate'
end
cache_key = "reduced_dropout_rate_#{Digest::SHA256.hexdigest(stats_scope.to_sql)}"
ret = Rails.cache.read(cache_key)
if ret.nil?
students_sum = stats_scope.where(nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope_options; end",
"def scope_options; end",
"def scope\n @options[:scope]\n end",
"def collection_scope options={}\n scope = Rcpref.where(\n options.slice(\n :in_collection, :private, :entity_type).merge( user_id: id )\n )\n scope = scope.where.not(entity_typ... | [
"0.6565767",
"0.6565767",
"0.63635504",
"0.6076102",
"0.60470104",
"0.59976107",
"0.5985235",
"0.5949138",
"0.58105695",
"0.58105695",
"0.5801547",
"0.57555735",
"0.5739941",
"0.5685954",
"0.5671397",
"0.5664277",
"0.5654476",
"0.56128675",
"0.55663985",
"0.55601555",
"0.5509... | 0.0 | -1 |
Returns defaults for known compute providers | def images
@images ||= begin
json_file = File.join(
File.dirname(__FILE__), %w(.. .. .. data), "#{config[:compute_provider][:name]}.json"
)
if File.exist?(json_file)
Smash.new(JSON.load(IO.read(json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_defaultproviders\n basic = @type.provide(:basic) do\n defaultfor :operatingsystem => :somethingelse,\n :operatingsystemrelease => :yayness\n end\n\n assert_equal(basic, @type.defaultprovider)\n @type.defaultprovider = nil\n\n greater = @type.provide(:greater) do\n defaultfo... | [
"0.6559081",
"0.63103974",
"0.61723715",
"0.602395",
"0.59635705",
"0.5920473",
"0.579364",
"0.5792111",
"0.57723284",
"0.575007",
"0.5742357",
"0.56998396",
"0.56988686",
"0.56226295",
"0.5590662",
"0.5573966",
"0.5529757",
"0.5501289",
"0.54980755",
"0.5496682",
"0.54806304... | 0.51296645 | 64 |
Returns the default image ID for the compute provider's given region. | def default_image_id
region_name = config[:compute_provider]["#{config[:compute_provider][:name]}_region".to_sym]
region_map = images.fetch('regions', {}).fetch(region_name, {})
image_id = region_map && region_map[instance.platform.name]
if image_id.nil?
error("Could not deter... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_flavor_id\n flavor_id = images['default_flavor_id']\n\n if flavor_id.nil?\n error(\"Could not determine default flavor_id for platform #{instance.platform.name} via #{config[:compute_provider][:name]}\")\n end\n\n flavor_id\n end",
"def default_region(regions... | [
"0.67499083",
"0.6647887",
"0.6604855",
"0.6143729",
"0.610665",
"0.6087705",
"0.5995971",
"0.5959126",
"0.5844714",
"0.5769531",
"0.5752764",
"0.5740688",
"0.5699502",
"0.56587404",
"0.5644639",
"0.5626639",
"0.5609522",
"0.555976",
"0.5509345",
"0.5456396",
"0.54471064",
... | 0.89231974 | 0 |
Retrieve provider's default flavor id from image map | def default_flavor_id
flavor_id = images['default_flavor_id']
if flavor_id.nil?
error("Could not determine default flavor_id for platform #{instance.platform.name} via #{config[:compute_provider][:name]}")
end
flavor_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_image_id\n region_name = config[:compute_provider][\"#{config[:compute_provider][:name]}_region\".to_sym]\n region_map = images.fetch('regions', {}).fetch(region_name, {})\n image_id = region_map && region_map[instance.platform.name]\n\n if image_id.nil?\n error(\"C... | [
"0.6733904",
"0.63649005",
"0.6316956",
"0.63158745",
"0.61581194",
"0.61154085",
"0.611372",
"0.59483033",
"0.5947848",
"0.59453064",
"0.5928503",
"0.5835736",
"0.58296233",
"0.5813933",
"0.57547593",
"0.5728559",
"0.56779355",
"0.56743383",
"0.56597304",
"0.5629541",
"0.562... | 0.7984402 | 0 |
gets date & time from system | def get_time()
arr = []
x = Time.now.utc + Time.zone_offset('EST')
# x.zone = "-04:00"
arr << x.strftime('%H:%M')
arr << x.strftime('%m/%d/%Y')
arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def system_datetime\r\n request(HTTPMethods::GET, PATH_SYSTEMDATETIME)\r\n end",
"def sys_time()\n time_now = Time.now.to_s\n time = time_now[11..18] #get h,m,s \n return time\nend",
"def system_modified_dtsi\n Time.parse get('system_modified_dtsi')\n end",
"def get_current_date\n ... | [
"0.8003561",
"0.7556754",
"0.7264386",
"0.71348006",
"0.7094894",
"0.70669067",
"0.70129496",
"0.70032746",
"0.6990091",
"0.6826336",
"0.6794816",
"0.6780098",
"0.67710257",
"0.67413837",
"0.6735112",
"0.6679648",
"0.6674807",
"0.66683125",
"0.66558266",
"0.6649423",
"0.66184... | 0.0 | -1 |
checks if email is in the database | def login_check?(email)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT * FROM email WHERE email = '#{email}'")
db.clos... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def email_exist(email)\n if $db.execute(\"SELECT email from users WHERE email = ?\", email) != []\n return true\n else\n return false\n end\nend",
"def email_exists?(email)\n if self.find_by_email(email).nil?\n false\n else\n true\n end\n ... | [
"0.78592014",
"0.78499204",
"0.7806811",
"0.7806811",
"0.77519834",
"0.77137244",
"0.76905537",
"0.75628406",
"0.7561598",
"0.7540281",
"0.75004536",
"0.7482144",
"0.74770045",
"0.74024004",
"0.73466545",
"0.72213125",
"0.7154732",
"0.71088976",
"0.7103295",
"0.7070834",
"0.7... | 0.70010597 | 22 |
submits time and date into timesheet | def submit_time_in(user_id,location,time,date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
# db.exec("UPDATE info SET status= 'in' WHERE user_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_timesheet\n rows = []\n last_date = nil\n filled_in = false\n\n parse_timesheet.each do |data|\n department = data[6]\n employee_id = data[7]\n date = Date.parse(CGI.unescape(data[1])).strftime('%m/%d/%Y')\n\n # skip days with data already filled (like holidays)\n ... | [
"0.6691811",
"0.6645599",
"0.66224104",
"0.6618926",
"0.6567099",
"0.6523794",
"0.64556247",
"0.6428036",
"0.6359893",
"0.6326953",
"0.6326953",
"0.62718415",
"0.62570274",
"0.6252689",
"0.62371254",
"0.62290025",
"0.61894983",
"0.61729234",
"0.6141437",
"0.61298156",
"0.6118... | 0.60915023 | 23 |
submits time out to timesheet table | def submit_time_out(user_id,time,date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
# db.exec("UPDATE info SET status= 'out' WHERE user_id ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_schedule_timeout (timeout)\n\n return unless timeout\n return if timeout.strip == ''\n\n h.timeout_schedule_id = @context.storage.put_schedule(\n 'at',\n h.fei,\n timeout,\n 'action' => 'cancel',\n 'fei' => h.fei,\n 'flavour' => 'timeout')\n end",
... | [
"0.6197139",
"0.6131681",
"0.6021518",
"0.60208434",
"0.60163224",
"0.60163224",
"0.60163224",
"0.6002143",
"0.5952524",
"0.5882988",
"0.5825567",
"0.58234984",
"0.58012754",
"0.58012754",
"0.58012754",
"0.58012754",
"0.58012754",
"0.5800228",
"0.5793782",
"0.57766443",
"0.57... | 0.61982393 | 0 |
Gets user_id from email table | def get_id(email)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
user_id = db.exec("SELECT user_id FROM email WHERE email = '#{email}'").values
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def query_id_for_github_email(email)\n User.by_any_email(email).pluck(:id).first\n end",
"def email\n user.emails.where( email: self.email_id ).first\n end",
"def email\n userid.try(:match, / <(.*@.*)>/).try(:[], 1)\n end",
"def obtener_identificador_moodle(email)\n params ... | [
"0.7890154",
"0.7539801",
"0.72926605",
"0.72642225",
"0.71878034",
"0.7117514",
"0.71174514",
"0.7013694",
"0.69417393",
"0.6878429",
"0.6866263",
"0.68568563",
"0.6847073",
"0.6819515",
"0.6813733",
"0.6791819",
"0.6783925",
"0.6750623",
"0.669552",
"0.66716826",
"0.663612"... | 0.76421624 | 1 |
returns true if user isnt clocked in | def time_in_check?(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT * FROM timesheet_new WHERE user_id = '#{user_id}' AND t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loged_in?\n !current_user.nil?\n end",
"def loged_in?\n !current_user.nil?\n end",
"def ever_logged_in?\n @data[:has_ever_logged_in]\n end",
"def update_user_state\n user.clocked_in? ? user.clock_out : user.clock_in\n end",
"def shadow_user?\n return !session[:shadow_user_id].b... | [
"0.7155059",
"0.71249497",
"0.6968187",
"0.6961767",
"0.6874243",
"0.68089014",
"0.6742917",
"0.6742917",
"0.67370856",
"0.672364",
"0.6719866",
"0.6719866",
"0.6719866",
"0.6719866",
"0.671279",
"0.6711947",
"0.67003095",
"0.6699595",
"0.6699595",
"0.6699595",
"0.6699595",
... | 0.0 | -1 |
returns true if user is not clocked out | def time_out_check?(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT * FROM timesheet_new WHERE user_id = '#{user_id}' AND ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lockout?\n @lockout\n end",
"def session_check\n return if (t_last = last_operation_time).zero?\n return if (t_boot = BOOT_TIME.to_i) < t_last\n __debug { \"last_operation_time #{t_last} < BOOT_TIME #{t_boot}\" }\n Log.info { \"Signed out #{current_user&.to_s || 'user'} after reboot.... | [
"0.724834",
"0.69792616",
"0.687879",
"0.6735069",
"0.67347544",
"0.66544354",
"0.65984917",
"0.6554799",
"0.6537544",
"0.65245897",
"0.6514173",
"0.6479846",
"0.6469015",
"0.64653754",
"0.6461231",
"0.6453922",
"0.64439917",
"0.64438635",
"0.6410798",
"0.6404159",
"0.6400201... | 0.0 | -1 |
pull_data_for_pay_period("lukeid",pay_period(Time.new)) database_email_check('devid') fuction that send the admin an email for pto request | def send_email(start_vec, end_vac, full_name, pto, type)
Mail.defaults do
delivery_method :smtp,
address: "email-smtp.us-east-1.amazonaws.com",
port: 587,
:user_name => ENV['a3smtpuser'],
:password => ENV['a3smtppass'],
:enable_ssl => true
end
email_body = "#{full_name[0]} #{full_name[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_email_reminder_for_paper_proof\n url_with_port = request.host_with_port\n request_array = url_with_port.split(\".\")\n company_code = request_array[0]\n company = Setup::Company.find_by_sql [\"select schema_name from main.dbo.main_companies where code=?\",company_code]# if ActiveRecord::Base.... | [
"0.63784254",
"0.63511145",
"0.63478386",
"0.6156314",
"0.6142842",
"0.61422276",
"0.6107045",
"0.6018609",
"0.6000919",
"0.5994661",
"0.5989516",
"0.5963694",
"0.595169",
"0.5948429",
"0.5948085",
"0.59467",
"0.59308577",
"0.5925512",
"0.5886167",
"0.58815116",
"0.5865122",
... | 0.60855454 | 7 |
returns true if lunch hasnt already been started | def check_lunch_in(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT * FROM timesheet_new WHERE user_id = '#{use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_starting?\n @launching\n end",
"def auto_start?\n autostart\n end",
"def for_startup?\n self.stage_id > 1\n end",
"def already_started?\n if started?\n ::NewRelic::Agent.logger.error('Agent Started Already!')\n true\n end\n end",
... | [
"0.7086004",
"0.6901259",
"0.6878017",
"0.68556935",
"0.6854331",
"0.6735986",
"0.6633623",
"0.66166097",
"0.6607973",
"0.6599024",
"0.65876925",
"0.6560246",
"0.6547247",
"0.6542683",
"0.6516496",
"0.65156364",
"0.64946526",
"0.6491389",
"0.6491389",
"0.64870626",
"0.6437202... | 0.0 | -1 |
submits lunch start time | def submit_lunch_in(user_id,time)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
db.exec("UPDATE timesheet_new SET lunch_start = '#{time}' WHE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time\n date.to_time + kickoff_time.hour.hours\n end",
"def start\n @workflow[:started_at] = timeString\n end",
"def start_time\n # merge the schedule weekday, hour and minute with today's year, month, weekday to form the next start_time\n t = Time.now\n s = DateTime.parse(time_input)... | [
"0.6536206",
"0.6308605",
"0.5991884",
"0.59707433",
"0.59315705",
"0.5898424",
"0.5865876",
"0.58451265",
"0.5840829",
"0.58034354",
"0.57716566",
"0.5753612",
"0.5753612",
"0.5729927",
"0.57273406",
"0.57106954",
"0.5702558",
"0.56973034",
"0.5693611",
"0.5661107",
"0.56581... | 0.5860378 | 7 |
returns true if lunch has started | def check_lunch_out(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT *FROM timesheet_new WHERE user_id = '#{use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def app_starting?\n @launching\n end",
"def auto_start?\n autostart\n end",
"def start?\r\n start\r\n end",
"def for_startup?\n self.stage_id > 1\n end",
"def has_started?\n Time.now >= start_time\n end",
"def punching?\n return data.punch\n end",
"def runnin... | [
"0.7356126",
"0.7039809",
"0.7021403",
"0.68707037",
"0.6771168",
"0.67415917",
"0.6720101",
"0.6675691",
"0.6673778",
"0.66560215",
"0.66415006",
"0.66289467",
"0.6606049",
"0.6595248",
"0.654896",
"0.6535463",
"0.65182954",
"0.6489805",
"0.6477956",
"0.6477956",
"0.6475585"... | 0.0 | -1 |
function for submitting lunch end | def submit_lunch_out(user_id,time)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
db.exec("UPDATE timesheet_new SET lunch_end = '#{time}' WHER... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lunch(day)\n\nend",
"def submits; end",
"def put_to_sleep\n if self.program_player.present?\n self.update_attributes(:num_crows => self.num_crows+1, :day_of_budge => NEEDS_REVIVING)\n self.program_player.user.contact_them(:email, :moment_of_truth, self) \n end\n end",
"def enter_pendi... | [
"0.60782045",
"0.604119",
"0.58133596",
"0.57395035",
"0.5722827",
"0.567099",
"0.5668205",
"0.5640854",
"0.56312305",
"0.5612521",
"0.5590457",
"0.5588639",
"0.5509488",
"0.55083513",
"0.55081177",
"0.5500814",
"0.5497136",
"0.5488559",
"0.5465878",
"0.54557234",
"0.54505587... | 0.57421243 | 3 |
func to get the user pto time | def pto_time(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
user_pto = db.exec("SELECT pto FROM pto WHERE user_id = '#{user_id}'"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time\r\n\t\t@usr_time\r\n\tend",
"def utime(*) end",
"def prep_time_passed\n return \"7:34\"\n end",
"def get_time_pos \n send_cmd(\"get_time_pos\")\n end",
"def sys_time()\n time_now = Time.now.to_s\n time = time_now[11..18] #get h,m,s \n return time\nend",
"def time\n start... | [
"0.7564279",
"0.7434327",
"0.7047678",
"0.7031626",
"0.69977254",
"0.6954211",
"0.69336605",
"0.69135886",
"0.68968266",
"0.67971855",
"0.67686176",
"0.6745466",
"0.67016333",
"0.66973895",
"0.66884243",
"0.6665708",
"0.664692",
"0.66441756",
"0.6639167",
"0.6639167",
"0.6594... | 0.638533 | 48 |
func for getting vac time | def get_vacation_time(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
user_vac = db.exec("SELECT vacation FROM pto WHERE user_id =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flight_time; end",
"def tv_sec() end",
"def lead_time\n 4\n end",
"def ctime\n end",
"def trip_time\n # puts scheduled_date.ai\n # puts scheduled_time.ai\n # DateTime.new(scheduled_date.year, scheduled_date.month, scheduled_date.day,\n # scheduled_time.hour, scheduled_time.min, 0, sc... | [
"0.71318424",
"0.6678938",
"0.6548462",
"0.65101933",
"0.6485524",
"0.6477431",
"0.6443558",
"0.64266866",
"0.64255625",
"0.64207554",
"0.6378586",
"0.63554657",
"0.633344",
"0.6328004",
"0.6326956",
"0.63183093",
"0.63109195",
"0.6298185",
"0.62977093",
"0.62923366",
"0.6273... | 0.0 | -1 |
func for getting sic time | def sic_time(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
user_sic = db.exec("SELECT sick FROM pto WHERE user_id = '#{user_id}'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cstime(*) end",
"def cstime=(*) end",
"def ctime\n end",
"def ctime() end",
"def ctime() end",
"def ctime() end",
"def sec() time[2] end",
"def time_sec; Time.now.sec; end",
"def sys_time()\n time_now = Time.now.to_s\n time = time_now[11..18] #get h,m,s \n return time\nend",
"def ... | [
"0.7724569",
"0.76630926",
"0.7553489",
"0.75232095",
"0.75219715",
"0.75219715",
"0.74546534",
"0.7291627",
"0.71158683",
"0.71041256",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.7087851",
"0.70463103",
"0.70313... | 0.0 | -1 |
func that sends email for user that has no pto days | def email_for_no_pto(full_name, pto, pto_type)
Mail.defaults do
delivery_method :smtp,
address: "email-smtp.us-east-1.amazonaws.com",
port: 587,
:user_name => ENV['a3smtpuser'],
:password => ENV['a3smtppass'],
:enable_ssl => true
end
email_body = "#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_user_reminder_notice(user)\n return if user.email.nil?\n return if user.last_reminder.sent_at < one_week_ago\n EmailSender.send_notice_to(user.email)\nend",
"def notify\n return if @user.email.blank?\n\n Notifier.user_event_analisys(@user, @user.events.future.analisys.first).deliver_now if @use... | [
"0.68916905",
"0.67645997",
"0.6762204",
"0.673638",
"0.66997075",
"0.66773576",
"0.6652575",
"0.66310155",
"0.6619794",
"0.6515473",
"0.6497281",
"0.6439049",
"0.6432846",
"0.63805234",
"0.6373084",
"0.6368005",
"0.6338944",
"0.63358784",
"0.63148695",
"0.63116884",
"0.63080... | 0.683413 | 1 |
time stamps for current day function area | def todays_year_stamp()
d = Time.now.strftime("%Y")
d
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_day; Time.now.day; end",
"def localtime() end",
"def t_stamp\n Time.now.strftime(\"%m-%d_%H-%M-%S\")\nend",
"def day() end",
"def now; end",
"def now; end",
"def yday() end",
"def yday\n end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
"def timestamp; end",
... | [
"0.71003187",
"0.69220245",
"0.67747796",
"0.6755476",
"0.66851777",
"0.66851777",
"0.6657772",
"0.6630978",
"0.662387",
"0.662387",
"0.662387",
"0.662387",
"0.662387",
"0.662387",
"0.65956986",
"0.65694135",
"0.6535952",
"0.65293705",
"0.6499946",
"0.64638114",
"0.6461807",
... | 0.0 | -1 |
comment_filter removes all sets of comments that contain blanks | def comment_filter(comments)
# p comments
comments.each do |info|
# p info
# p info[1].values
info[1].values.each do |item|
if item.gsub(/\s+/, "") == ""
comments.delete(info[0])
end
end
end
if comments.empty?
"empty"
else
c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strip_comments!\n @content.reject! { |item| item[:type] == :comment }\n end",
"def postprocess_comments(comment_lines)\n comment_lines.map! {|l| l.sub(/^\\s([^\\s])/, '\\\\1').rstrip }\n comment_lines.delete_at(0) while comment_lines.size > 0 && comment_lines[0].empty?\n comment_lines.dele... | [
"0.7186589",
"0.6494515",
"0.64081734",
"0.6341126",
"0.62435764",
"0.62427074",
"0.61625916",
"0.616214",
"0.6158681",
"0.6110204",
"0.6089941",
"0.60340303",
"0.59810376",
"0.5950777",
"0.59127975",
"0.5897872",
"0.5810293",
"0.5776016",
"0.5737291",
"0.57065886",
"0.569467... | 0.76927185 | 0 |
makes comments into nested hash of client_name=>date=>[comment] | def comment_reformat(comments)
# p comments
info = {}
comments.each_pair do |key,value|
# p "#{key},#{value}"
if info[value['client']] == nil
info[value['client']] = {value['date']=>[value['comment']]}
elsif info[value['client']].keys.include?(value['date'])
info[val... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_comments\n comments = self.comments.order(:created_at).to_a\n comments_hash = {}\n while comments.any? do\n comment = comments.shift\n comment_comments = comment.comments.order(:created_at)\n comments_hash[\"#{comment.id}\"] = comment_comments\n comments.concat(co... | [
"0.6839336",
"0.6443243",
"0.6237378",
"0.59391755",
"0.5809019",
"0.57809544",
"0.5724803",
"0.5666727",
"0.56515694",
"0.56303746",
"0.5603799",
"0.5600935",
"0.558313",
"0.55279684",
"0.5495948",
"0.5467655",
"0.5459434",
"0.5459434",
"0.544667",
"0.544667",
"0.544667",
... | 0.81134593 | 0 |
Makes clients match their count for billing | def billable_hashing(billable, clients)
week_client = []
2.times do
clients.each do |client|
week_client << client
end
end
client_arr = []
count = 1
week_client.each do |client|
client_has = {}
if billable.include?(count.to_s)
client_has["#... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def populate_client_usage(client)\n client_id = client.id\n registration_count = User.using_client_shard(client: client).where(client_id: client_id).count\n kyc_submissions_count = UserKycDetail.using_client_shard(client: client).\n where(client_id: client_id).sum(:submission_count)\n\n ... | [
"0.6751676",
"0.61463004",
"0.61218613",
"0.6032845",
"0.593481",
"0.59157014",
"0.59097606",
"0.588225",
"0.58762795",
"0.58266073",
"0.5806203",
"0.5718232",
"0.5717917",
"0.56760055",
"0.56709063",
"0.5640246",
"0.56235117",
"0.56099373",
"0.5605351",
"0.56035924",
"0.5581... | 0.6081557 | 3 |
To add a blank array to show clients, even if you've worked, but no commits for them | def adding_blank_clients(clients, cli_to_rep)
clients.each do |client|
if cli_to_rep.has_key?(client) == false
cli_to_rep["#{client}"] = []
end
end
cli_to_rep
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_all_clients\n @clients = Array.new\n end",
"def empty?\n @clients.empty?\n end",
"def initialize\n @clients = []\n end",
"def empty?\n @commits.empty?\n end",
"def index\n if @clients.count > 0\n @client = params[:client_id].blank? ? @clients[0] :\n Client.... | [
"0.63907063",
"0.6120237",
"0.58580047",
"0.5578254",
"0.5544745",
"0.54220426",
"0.53998965",
"0.5384853",
"0.53312975",
"0.53283954",
"0.5325888",
"0.52904546",
"0.52400035",
"0.52034366",
"0.51626956",
"0.515465",
"0.5152703",
"0.51466125",
"0.5122819",
"0.5119965",
"0.511... | 0.72824836 | 0 |
To make sure when billed isn't check for any client, it stops nil from breaking app | def billable_nil(clients)
week_client = []
2.times do
clients.each do |client|
week_client << client
end
end
client_arr = []
count = 1
week_client.count.times do
client_has = {}
client_has["#{count}"] = "No"
client_arr << client_has
cou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_and_validate_client\n @client = Client.get_from_memcache(@client_id)\n\n return error_with_identifier('invalid_client_id','sb_2') if\n @client.blank? || @client.status != GlobalConstant::Client.active_status\n\n success\n end",
"def reachable?\n !!client\n ... | [
"0.6480847",
"0.6395443",
"0.6395443",
"0.61851066",
"0.61508644",
"0.6067734",
"0.59924823",
"0.59096175",
"0.58953327",
"0.5825761",
"0.57993436",
"0.57837063",
"0.575926",
"0.57260406",
"0.5713785",
"0.5710291",
"0.57043463",
"0.5694083",
"0.56877196",
"0.56791395",
"0.567... | 0.0 | -1 |
To Add Hours Per Week | def paycycle_hours(user_id, hours, start_date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
check = db.exec("SELECT * FROM payperiod_hours WHERE use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours_per_week= (hours_per_week)\n # fill in later\n end",
"def weekly_hours\n worked_hours\n end",
"def weeks() 7 * days end",
"def weeks ; self * 7.days ; end",
"def add_hours(hours = 1)\n hours = hours.to_i\n cur_hour = @t_hour\n next_hour = cur_hour + hours\n \n if next... | [
"0.72241443",
"0.7061508",
"0.6919755",
"0.6844094",
"0.6757893",
"0.67039",
"0.660973",
"0.6549843",
"0.6505951",
"0.64781886",
"0.6465881",
"0.64519626",
"0.644946",
"0.6411861",
"0.64023995",
"0.6382394",
"0.6382394",
"0.6375554",
"0.63188016",
"0.6283755",
"0.62485677",
... | 0.0 | -1 |
For Deleting any Extra Hours(Dev Purpose Only) | def delete_paycycle_hours(user_id, start_date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
db.exec("DELETE FROM payperiod_hours WHERE user_id = '#{... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @operation_hour = OperationHour.find(params[:operation_hour_id])\n end",
"def destroy\n @operation_hours = OperationHour.paginate(:page => params[:page], :per_page => 30).order('updated_at DESC')\n @operation_hour = OperationHour.find(params[:id])\n @error = nil\n\n begin\n @ope... | [
"0.6770918",
"0.6485753",
"0.64654064",
"0.640405",
"0.6383513",
"0.6325177",
"0.62902236",
"0.62482053",
"0.62383205",
"0.6236112",
"0.61841035",
"0.61733294",
"0.61337996",
"0.613159",
"0.6108626",
"0.6095505",
"0.6092703",
"0.6061712",
"0.60586625",
"0.60427225",
"0.603845... | 0.56371564 | 62 |
For users to see hours from the current paycycle(USERS) | def display_user_hours_date(user_id, start_date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
week_hours = db.exec("SELECT * FROM payperiod_hour... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hours(user_id)\n return self.user_events.find_by(user_id: user_id).hours || 0\n end",
"def index\n @learning_hours = LearningHour.where(user_id: current_user.id)\n end",
"def display_user_hours_all(user_id)\n db_params = {\n host: ENV['host'],\n port: ENV['port'],\n dbname: ... | [
"0.71455014",
"0.7061097",
"0.69829947",
"0.6973809",
"0.6910106",
"0.6898162",
"0.68780345",
"0.675504",
"0.6691929",
"0.66755825",
"0.6656388",
"0.66044885",
"0.66040164",
"0.65555847",
"0.65552735",
"0.6553557",
"0.64797366",
"0.6476844",
"0.6426243",
"0.6370673",
"0.63408... | 0.67598486 | 7 |
Checks for all weeks from the user who logs into | def display_user_hours_all(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
week_hours = db.exec("SELECT * FROM payperiod_hours WHERE user_id =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_new_users_on_saturday\n\t\tif Time.now.wday == 6\n\t\t\terrors[:base] << \"No new users on saturday.\"\n\t\tend\n\tend",
"def people_tracked_for_a_week_from(start_date)\n end_date = start_date + 6.days\n Timing.users_for_client_in_period(self.id, start_date, end_date)\n end",
"def checkWeekends\n... | [
"0.652069",
"0.6390334",
"0.63478637",
"0.6184045",
"0.6177806",
"0.6125453",
"0.6074555",
"0.6007098",
"0.59694684",
"0.59424525",
"0.59412974",
"0.5924528",
"0.59166294",
"0.5872571",
"0.5855154",
"0.584269",
"0.5839178",
"0.580849",
"0.57969177",
"0.57857054",
"0.5784431",... | 0.0 | -1 |
For admins to see hours from all users | def display_admin_hours(start_date)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
week_hours = []
week_hours << db.exec("SELECT * FROM payperiod_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @learning_hours = LearningHour.where(user_id: current_user.id)\n end",
"def admin_view_hours_exec(params)\n return -1 if params[:start_time].nil? || params[:end_time].nil?\n\n start_date = synthesize_start_date(params)\n end_date = synthesize_end_date(params)\n\n return unless current... | [
"0.7536682",
"0.7287097",
"0.70906687",
"0.6996039",
"0.69543445",
"0.69509214",
"0.69307065",
"0.686409",
"0.6684159",
"0.66658926",
"0.6649701",
"0.66033846",
"0.65701675",
"0.6522324",
"0.64365625",
"0.64362305",
"0.642767",
"0.64180833",
"0.6399791",
"0.63794607",
"0.6370... | 0.61970645 | 32 |
To check for if the date is a monday(start of the business week) | def monday_check?(start_date)
new_week = Date.parse(start_date)
if new_week.strftime('%A') == "Monday"
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monday(date = Date.today)\n today = date\n day = today.wday\n diff = case day\n when 0\n 6\n when 1..6\n day - 1\n end\n today - diff\n end",
"def monday\n beginning_of_week(:monday)\n end",
"def test_start_of_we... | [
"0.74922377",
"0.7477156",
"0.7455595",
"0.7333744",
"0.73126596",
"0.7257929",
"0.7227245",
"0.7083516",
"0.7083298",
"0.7004672",
"0.7004331",
"0.69843477",
"0.6969153",
"0.68853545",
"0.68747663",
"0.68625903",
"0.6830536",
"0.68019617",
"0.67669195",
"0.6754459",
"0.67439... | 0.8387417 | 0 |
To check if the person is a supervisor logging in. | def supervisor_check?(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
supervisors = db.exec("SELECT supervisor FROM supervisor").values
al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_supervisor?\n not under_supervision_clinics.empty?\n end",
"def super?\n logged_in? && current_user.super\n end",
"def super_user? \n current_user.role.role == \"Super\" \n end",
"def superuser?\n member_of_group?(\"Superusers\")\n end",
"def sign_in_as_supervisor\n sign_... | [
"0.7309726",
"0.6946977",
"0.6836861",
"0.68135417",
"0.6800857",
"0.6727429",
"0.6722902",
"0.6664129",
"0.66448945",
"0.6637874",
"0.6610186",
"0.65535086",
"0.65509003",
"0.6513096",
"0.64759886",
"0.64680845",
"0.6461941",
"0.64603525",
"0.64009964",
"0.6398207",
"0.63982... | 0.60688376 | 80 |
checks for anyone being supervised from the user checking in | def supervisees_check?(user_id)
db_params = {
host: ENV['host'],
port: ENV['port'],
dbname: ENV['dbname'],
user: ENV['user'],
password: ENV['password']
}
db = PG::Connection.new(db_params)
supervisees = db.exec("SELECT user_id FROM supervisor WHERE supervi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eventunscrape?\n @user.is_admin?\n end",
"def advising?(other_user)\n advisees.include?(other_user)\n end",
"def is_potential_user?\n\t\ttrue\n\tend",
"def applies_to?(user); false end",
"def check_chair\n if (!current_user.superadmin_role)\n redirect_to root_path, notice: 'You d... | [
"0.67820287",
"0.6761595",
"0.67279315",
"0.6705926",
"0.66421264",
"0.6604835",
"0.6552678",
"0.6531765",
"0.652857",
"0.65177035",
"0.6508567",
"0.65031767",
"0.64953005",
"0.64889514",
"0.64487386",
"0.644661",
"0.64169806",
"0.6416411",
"0.6381669",
"0.63804376",
"0.63704... | 0.0 | -1 |
Writing all commit data to a csv file | def csv_filler(filing_week,hours,name,hours_total,wage,info,comments,expenses)
CSV.open("#{name}" + '_' + "#{filing_week}.csv", "wb") do |csv|
csv << ["Name","Week","Hourly Wage","Client","Repo","Commits","Type","Mon","Tue","Wed","Thurs","Fri","Sat","Sun","Total"]
csv << ["#{name}", "#{filing_week}"... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generateCSV()\n findCommits\n findLinesOfCode\n\n CSV.open(\"data.csv\", \"wb\") {|csv| @students.to_a.each {|elem| csv << elem} }\nend",
"def updateCSVFile\n\t\tFile.open('accounts.csv', 'w') do |file|\n\t\t\tfile << \"Account,Date,Payee,Category,Outflow,Inflow\\n\"\n\t\t\t@arrayOfRows.each do |line|\n\t... | [
"0.7062323",
"0.6912483",
"0.68700916",
"0.6761351",
"0.66582215",
"0.66187376",
"0.6617418",
"0.6574611",
"0.65293586",
"0.65012294",
"0.64905375",
"0.6451484",
"0.64481324",
"0.64271426",
"0.6421898",
"0.6408548",
"0.63951564",
"0.63899094",
"0.63791245",
"0.63752675",
"0.6... | 0.62392753 | 43 |
Complete the migratoryBirds function below. | def migratoryBirds(ar)
birds = ar.group_by {|v| v}
most_repeated_birds = birds.sort_by{|key,value| value.length}
most_repeated_birds.last.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rebalance!\n return unless @playground.collecting?\n\n score_results = bayes_bandit_score\n set_alternative_probabilities score_results.alts if score_results.method == :bayes_bandit_score\n end",
"def converge_complete\n end",
"def batch_finished\n end",
"def apply_bad... | [
"0.5251044",
"0.51419497",
"0.5110543",
"0.50365245",
"0.49994752",
"0.49817577",
"0.49734515",
"0.49719906",
"0.49601144",
"0.49488246",
"0.49360132",
"0.49220136",
"0.49094853",
"0.48910582",
"0.4881196",
"0.48624647",
"0.4850198",
"0.48318353",
"0.48052153",
"0.47841486",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def event_params
params.permit(:start_date, :duration, :title, :description, :price, :location)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
this is where parameters are taken when the command is called | def initialize(app_id, key)
@app_id = app_id
@key = key
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmdarg; end",
"def cmdarg; end",
"def cmdarg; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def command; end",
"def cmd; end",
"def command_builder; end",
"def command_name=(_arg0); end",
"def commands; end",
"def arguments;... | [
"0.7646118",
"0.7646118",
"0.7646118",
"0.7217742",
"0.7217742",
"0.7217742",
"0.7217742",
"0.7217742",
"0.7217742",
"0.692452",
"0.6852143",
"0.6835569",
"0.6825462",
"0.6792031",
"0.6792031",
"0.6792031",
"0.6766181",
"0.6766181",
"0.6766181",
"0.6758215",
"0.67341256",
"... | 0.0 | -1 |
this is where the result gets returned | def call
JsonWebToken.encode_secret( { app_id: app_id, key: key } )
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result; end",
"def result\n end",
"def next_result()\n #This is a stub, used for indexing\n end",
"def process_result\n end",
"d... | [
"0.7680875",
"0.7680875",
"0.7680875",
"0.7680875",
"0.7680875",
"0.7680875",
"0.7680875",
"0.7680875",
"0.7425856",
"0.73372686",
"0.7257427",
"0.7129892",
"0.7106419",
"0.7106419",
"0.7106419",
"0.7104353",
"0.7099858",
"0.70887625",
"0.70452285",
"0.70281535",
"0.6981303",... | 0.0 | -1 |
def printer(output) output.each do|x| puts end batch_badge_creator(x) end puts printer(["a","b","c"]) | def printer(attendees)
batch_badge_creator(attendees).each do |badge|
puts badge
end
assign_rooms(attendees).each do |assignment|
puts assignment
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def printer(array) \n batch_badge_creator(array).each do |result|\n puts result\n end\n assign_rooms(array).each do |result|\n puts result\n end\nend",
"def printer(array)\n badges = batch_badge_creator(array)\n rooms = assign_rooms(array)\n badges.each{|badge| puts badge}\n rooms.each{|room| puts ... | [
"0.79314244",
"0.7829807",
"0.7751451",
"0.76561505",
"0.7592962",
"0.7578503",
"0.7577715",
"0.7569557",
"0.7566786",
"0.7561359",
"0.7557106",
"0.75193757",
"0.74790204",
"0.7468605",
"0.74675",
"0.74539715",
"0.74534184",
"0.74066615",
"0.7390113",
"0.73869926",
"0.7357335... | 0.7373353 | 22 |
Returns the total amount of vibration | def total_vibration; @right_force + @left_force + @neutral_force; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_vibration\n $game_system.vibration_rate\n end",
"def vat_rate\n end",
"def vat_amount\n line_total(true) - line_total(false)\n end",
"def kinetic_energy\n velocity.inject(0) { |sum, v| sum + v.abs }\n end",
"def total\n array = @products.values\n if array != []\n tally =... | [
"0.7510286",
"0.6839834",
"0.67109084",
"0.6629151",
"0.64870226",
"0.64648443",
"0.64335847",
"0.6396834",
"0.6367583",
"0.634351",
"0.6333251",
"0.63331044",
"0.6289608",
"0.62865937",
"0.6282777",
"0.62399656",
"0.62107354",
"0.61867267",
"0.6174654",
"0.6162441",
"0.61591... | 0.7090886 | 1 |
Apply vibration on critical damage | def apply_vibration
str = actor? ? VibrationConfig::CRITICAL_ALLY : VibrationConfig::CRITICAL_ENEMY
Input.vibrate(str[0], str[1], str[2])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_vibration(value)\n $game_system.set_vibration_rate(value)\n Input.vibrate(100, 100, 20) if SceneManager.scene_is?(Scene_Options)\n end",
"def perform_damage_effect\n end",
"def perform_damage_effect\n end",
"def get_vibration\n $game_system.vibration_rate\n end",
"def attack_effect_... | [
"0.6988544",
"0.6977959",
"0.6977959",
"0.65331006",
"0.64870226",
"0.6372797",
"0.6347163",
"0.6322854",
"0.62529474",
"0.6190531",
"0.6156407",
"0.6134756",
"0.61175585",
"0.6101292",
"0.6098191",
"0.6045228",
"0.6032542",
"0.6020073",
"0.5991967",
"0.59891444",
"0.59837466... | 0.7671202 | 0 |
Adds vibration check to the animation | def animation_process_timing(timing)
if timing && timing.vibration.total_vibration > 0
left_v = timing.vibration.left_force + timing.vibration.neutral_force
right_v = timing.vibration.right_force + timing.vibration.neutral_force
left_v, right_v = right_v, left_v if @ani_mirror
Input.vibrate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_vibration\n str = actor? ? VibrationConfig::CRITICAL_ALLY : VibrationConfig::CRITICAL_ENEMY\n Input.vibrate(str[0], str[1], str[2])\n end",
"def update_vibration(value)\n $game_system.set_vibration_rate(value)\n Input.vibrate(100, 100, 20) if SceneManager.scene_is?(Scene_Options)\n end",
... | [
"0.69034237",
"0.6842793",
"0.5988061",
"0.5515969",
"0.55000114",
"0.5377526",
"0.5360446",
"0.52620715",
"0.51615167",
"0.50865763",
"0.5080641",
"0.5014724",
"0.50131553",
"0.49582365",
"0.49368528",
"0.49153093",
"0.48750007",
"0.48391208",
"0.48150542",
"0.47859025",
"0.... | 0.6247166 | 2 |
This method implements a wrapper for printing or logging that is shared across the system. I usually use logging as a singleton object, but for simplicity I used these as 'singleton methods'. msg the string message to log level the log level enumeration for enhancing to rsyslog | def lg_helper(msg, level=6)
if level == 6
puts msg
elsif level == 0
puts msg.red
elsif level == 1
puts msg.red
elsif level == 2
puts msg.yellow
elsif level == 3
puts msg.yellow
elsif level == 4
puts msg.blue
elsif level == 5
puts msg... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(level, msg)\n\n case level\n when :fatal then\n logger.fatal (retrieve_caller + msg)\n when :error then\n logger.error (retrieve_caller + msg)\n when :warn then\n logger.warn (retrieve_caller + msg)\n when :info then\n logger.info (retr... | [
"0.73249716",
"0.7039252",
"0.6995857",
"0.69907135",
"0.69236606",
"0.6917238",
"0.68223846",
"0.6821063",
"0.6802332",
"0.67742676",
"0.6770941",
"0.6760696",
"0.67215395",
"0.6718729",
"0.6716066",
"0.67032343",
"0.6701862",
"0.6690609",
"0.66845596",
"0.6680337",
"0.66465... | 0.0 | -1 |
This method implements a wrapper for printing or logging that is shared across the system. I usually use logging as a singleton object, but for simplicity I used these as 'singleton methods'. This method is intended for tracing errors similar to compiling a C/C++ binary that has the debug preprocessor logging enabled. ... | def dlg_helper(msg, level=6, debug=false)
if debug
lg_helper(msg, level)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def log(level, msg)\n\n case level\n when :fatal then\n logger.fatal (retrieve_caller + msg)\n when :error then\n logger.error (retrieve_caller + msg)\n when :warn then\n logger.warn (retrieve_caller + msg)\n when :info then\n logger.info (retr... | [
"0.7258616",
"0.7130217",
"0.711021",
"0.69821143",
"0.6965872",
"0.6916917",
"0.6891101",
"0.685427",
"0.6850666",
"0.6849479",
"0.68353754",
"0.68074524",
"0.6801059",
"0.6773683",
"0.6754196",
"0.67448324",
"0.6703385",
"0.6675331",
"0.6654809",
"0.66509783",
"0.6647095",
... | 0.0 | -1 |
Public interface: instance method | def perform
build_recipes # this returns array of recipes
self # return the scrapper
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance; end",
"def instance; end",
"def instance; end",
"def instance_method(p0) end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def method_of_instance; end",
"def private; end",
"def implementation; end",
"def implementation; end",
"d... | [
"0.81761724",
"0.81761724",
"0.81761724",
"0.71305966",
"0.69613934",
"0.69613934",
"0.69613934",
"0.69613934",
"0.69056416",
"0.68960756",
"0.68960756",
"0.68949383",
"0.679758",
"0.679758",
"0.67293274",
"0.66612905",
"0.66612905",
"0.66612905",
"0.66612905",
"0.66612905",
... | 0.0 | -1 |
Track failed login attempts | def note_failed_signin
flash[:error] = t('labels.name_or_password_error')
logger.warn "Failed login for '#{params[:email]}' from #{request.remote_ip} at #{Time.now.utc}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failed_login!\n @number_of_bad_logins = increment_bad_login_counter\n throttle_user if should_throttle?\n end",
"def note_failed_signin\n error_status(true, :login_failure, {}, false)\n logger.warn \"Failed login for '#{params[:login]}' from #{request.remote_ip} at #{Time.now.utc}\"\n end",
"... | [
"0.8288665",
"0.7961219",
"0.77037996",
"0.7341658",
"0.7305755",
"0.72876155",
"0.72876155",
"0.7263223",
"0.72473574",
"0.7188082",
"0.71714646",
"0.7148526",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.711585",
"0.71... | 0.7056899 | 27 |
GET /users/new GET /users/new.json | def new
@users = User.all
respond_to do |format|
format.html # new.html.erb
format.json { render json: @user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end",
"def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ... | [
"0.82880795",
"0.81698203",
"0.8156065",
"0.804788",
"0.80224085",
"0.8022169",
"0.80095947",
"0.7951073",
"0.7930659",
"0.7930659",
"0.78735185",
"0.78735185",
"0.78735185",
"0.7860989",
"0.7860989",
"0.7860989",
"0.7860989",
"0.7860989",
"0.7860989",
"0.7860989",
"0.7860989... | 0.0 | -1 |
around_action :wrap_in_transaction, only: [:create] | def index
#Cada user puede ver los eventos en los que ha sido elegido como responsable
#El admin puede verlos todos
if current_user.admin or current_user.ingeniero
@gestion_eventos= Gestion::Evento.all if current_user.admin or current_user.ingeniero
elsif
@gestion_eventos= Gestion::Evento.wh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def within_transaction; end",
"def within_transaction; end",
"def within_transaction(object); end",
"def with_transaction\n ActiveRecord::Base.transaction { yield }\n end",
"def spy_transaction!\n @within_transaction = nil\n allow(TestSqlCaller).to receive(:transaction).and_wrap_original do |meth... | [
"0.774746",
"0.774746",
"0.74406075",
"0.7061102",
"0.70258695",
"0.6972197",
"0.6972197",
"0.6972197",
"0.69696903",
"0.6858435",
"0.6832532",
"0.68223035",
"0.6814163",
"0.6814163",
"0.67270994",
"0.6724666",
"0.6724666",
"0.66916984",
"0.66916984",
"0.6676636",
"0.65062404... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_gestion_evento
@gestion_evento =Gestion::Evento.all.find(params[:id])
unless current_user.perfil_id == @gestion_evento.usuario.id or current_user.admin or current_user.ingeniero
flash[:notice] = "Ud no es quien subió este evento"
redirect_back(:fallback_location => root_path)
end
#Le h... | {
"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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def gestion_evento_params
params.require(:gestion_evento).permit(:titulo, :descripcion, :fecha, :email, :direccion, :coordenadas, :type )
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.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
restrics access to adding/editing trips if youre not logged in | def index
@activity = Activity.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n authorize @trip\n end",
"def create\n @trip = Trip.new\n if current_user.has_permission?(:trips)\n @trip.accessible = :all\n end\n\n respond_to do |format|\n if @trip.update_attributes(params[:trip])\n format.html { redirect_to [:admin, @trip], :notice =>... | [
"0.69749206",
"0.6736801",
"0.6695817",
"0.66193986",
"0.6571343",
"0.6552337",
"0.6382327",
"0.6303316",
"0.6293506",
"0.62430745",
"0.61916035",
"0.61870205",
"0.61729395",
"0.6172192",
"0.61565274",
"0.61493534",
"0.6107291",
"0.61033416",
"0.609907",
"0.60978657",
"0.6097... | 0.0 | -1 |
GET /pianos GET /pianos.json | def index
@pianos = Piano.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @processos = Processo.all\n\n render json: @processos\n end",
"def index\n @patrocinios = Patrocinio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patrocinios }\n end\n end",
"def show\n @pessoa = Pessoa.find(params[:id])\n... | [
"0.6486178",
"0.6423689",
"0.6373956",
"0.6337898",
"0.6287751",
"0.62795526",
"0.6270519",
"0.6242095",
"0.62343127",
"0.6213776",
"0.6197704",
"0.6186886",
"0.61809707",
"0.61500424",
"0.6137381",
"0.6108973",
"0.6095648",
"0.6095648",
"0.6086343",
"0.6084385",
"0.60726714"... | 0.6486511 | 0 |
GET /pianos/1 GET /pianos/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @pessoa = Pessoa.find(params[:id])\n\n respond_to do |format|\n # format.html # show.html.erb\n format.json { render json: @pessoa }\n end\n end",
"def show\n @pto = Pto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { rende... | [
"0.6432171",
"0.6430241",
"0.64244163",
"0.64106214",
"0.63576126",
"0.6334824",
"0.6308154",
"0.62815315",
"0.62731034",
"0.6244719",
"0.62342405",
"0.6234026",
"0.6125781",
"0.60672647",
"0.6065823",
"0.60474855",
"0.6036745",
"0.6020483",
"0.6020402",
"0.6017878",
"0.60086... | 0.0 | -1 |
POST /pianos POST /pianos.json | def create
outcome = CreatePiano.run(params: params[:piano], user: User.first)
respond_to do |format|
if outcome.valid?
@piano = outcome.result
format.html { redirect_to @piano, notice: 'Piano was successfully created.' }
format.json { render :show, status: :created, location: @pi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @premio = Premio.new(params[:premio])\n\n respond_to do |format|\n if @premio.save\n format.html { redirect_to @premio, :notice => 'Premio was successfully created.' }\n format.json { render :json => @premio, :status => :created, :location => @premio }\n else\n for... | [
"0.63112754",
"0.62040275",
"0.6200835",
"0.61965317",
"0.6185675",
"0.6180239",
"0.6179046",
"0.61756045",
"0.61389613",
"0.61089754",
"0.6087856",
"0.6078236",
"0.6015917",
"0.5979123",
"0.5976496",
"0.5969288",
"0.596745",
"0.5956239",
"0.592856",
"0.5923053",
"0.59198225"... | 0.61657757 | 8 |
PATCH/PUT /pianos/1 PATCH/PUT /pianos/1.json | def update
respond_to do |format|
if @piano.update(piano_params)
format.html { redirect_to @piano, notice: 'Piano was successfully updated.' }
format.json { render :show, status: :ok, location: @piano }
else
format.html { render :edit }
format.json { render json: @piano.e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def update\n respond_to do |format|\n if @platoon.update(platoon_params)\n format.html { redirect_to @platoon, notice: 'Platoon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' ... | [
"0.6419879",
"0.6405162",
"0.63340795",
"0.6302398",
"0.62371546",
"0.6211569",
"0.6153679",
"0.6082901",
"0.6070306",
"0.60620385",
"0.6046271",
"0.6041863",
"0.60275203",
"0.60002124",
"0.5986255",
"0.5984769",
"0.5943245",
"0.59395933",
"0.59344405",
"0.5919866",
"0.591256... | 0.6417832 | 1 |
DELETE /pianos/1 DELETE /pianos/1.json | def destroy
@piano.destroy
respond_to do |format|
format.html { redirect_to pianos_url, notice: 'Piano was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_a... | [
"0.6976076",
"0.6976076",
"0.6976076",
"0.6976076",
"0.69511956",
"0.69315743",
"0.68384314",
"0.6825963",
"0.68071353",
"0.6805746",
"0.677646",
"0.6753471",
"0.67510533",
"0.6732469",
"0.67227536",
"0.66859925",
"0.6682228",
"0.6670325",
"0.66659594",
"0.6659324",
"0.665766... | 0.6856847 | 6 |
Use callbacks to share common setup or constraints between actions. | def set_piano
@piano = Piano.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.6163754",
"0.6045816",
"0.5944853",
"0.59169096",
"0.58892167",
"0.58342934",
"0.5776148",
"0.57057375",
"0.57057375",
"0.56534296",
"0.56209534",
"0.54244673",
"0.54101455",
"0.54101455",
"0.54101455",
"0.53951085",
"0.5378493",
"0.53563684",
"0.53399915",
"0.5338049",
"0... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def piano_params
params.require(:piano).permit(:name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6979893",
"0.6781746",
"0.6746611",
"0.6742344",
"0.6735229",
"0.6592651",
"0.65027124",
"0.6498011",
"0.648163",
"0.647716",
"0.64556813",
"0.64386255",
"0.63784456",
"0.63756156",
"0.636574",
"0.6319542",
"0.63004524",
"0.6299559",
"0.62925464",
"0.62923217",
"0.6289894"... | 0.0 | -1 |
as a single candidate name. The candidate with the highest number of votes wins the election. In case of a tie, when multiple candidates have the same number of votes, they should be sorted alphabetically in descending order where last name wins. If Albert and Zach both get 5 votes then the winner is Zach. Eg. if votes... | def election_winner(votes)
candidate_votes = Hash.new(0)
votes.each { |vote| candidate_votes[vote] += 1 }
max_votes = candidate_votes.values.max
candidate_votes.select { |_, v| v == max_votes }.sort.reverse[0][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def announce_winner(total_votes)\n winner = total_votes.sort_by {|finalist, vote_count| vote_count}.last\n puts \"#{winner[0].to_s.capitalize.green} is the winner!\"\n winner[0]\n end",
"def winner_name\n comp = Competitor.find_by_id(self.winner)\n name = comp.name\n return name\... | [
"0.67551255",
"0.6401085",
"0.63429785",
"0.62887925",
"0.6245055",
"0.59688103",
"0.5966728",
"0.588163",
"0.57768124",
"0.5772389",
"0.5695645",
"0.5675656",
"0.56661767",
"0.5660584",
"0.5659481",
"0.5654674",
"0.5629925",
"0.5621987",
"0.5618396",
"0.5609306",
"0.55956763... | 0.6751463 | 1 |
Registers new profile __owner__ (not just subscriber) | def create
user = AuthenticationManager.new(
params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))
).register
session_manager.login(user.email, params[:password])
json_redirect create... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_profile\n @profile = current_owner.profile\n end",
"def set_profile\n end",
"def set_profile(profile_contents)\n path = self.api_root + '/register/profile'\n process_firecloud_request(:post, path, profile_contents.to_json)\n end",
"def add_profile(profile)\n @profiles.push(profil... | [
"0.7309449",
"0.6837739",
"0.65825194",
"0.6479376",
"0.64541185",
"0.63524264",
"0.6253137",
"0.62350994",
"0.622435",
"0.622435",
"0.622435",
"0.622435",
"0.6146282",
"0.61248684",
"0.6115135",
"0.6109534",
"0.60633636",
"0.6056191",
"0.6048962",
"0.6046318",
"0.60395753",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.