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 |
|---|---|---|---|---|---|---|
Create functions for each type of calculation | def add(x,y)
return x+y
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculation\n end",
"def calculate(op, x, y)\n case op\n when 'plus'\n x.to_f + y.to_f\n when 'minus'\n x.to_f - y.to_f\n when 'divide'\n x.to_f / y.to_f\n when 'multiple'\n x.to_f * y.to_f\n end\nend",
"def initialize_math_functions\n Math.methods(false).each do |method|\n ... | [
"0.64664227",
"0.64462453",
"0.6396917",
"0.63650674",
"0.6326608",
"0.622571",
"0.60824007",
"0.6058057",
"0.5995272",
"0.5966932",
"0.59520245",
"0.58974355",
"0.5875614",
"0.5864852",
"0.58419603",
"0.5812087",
"0.5804868",
"0.58033824",
"0.57976884",
"0.5793591",
"0.57574... | 0.0 | -1 |
Multilevel beam(observation)based followup trigger logic.\ 1. If no followup pending on the observation, triggers a separate followup for any real signals signals found. 2. If an ONx followup pending on the observation, triggers the next stage if any real signals are found in it. Reports the one with highest confidence... | def check_followup fup
if fup
if ( fup.current_stage + 1 ).even?
# OFFx: Trigger only on no signals in candidate beam
trigger_followup(fup, nil, false) if signal_groups.count == 0
else
# ONx: Trigger on highest confidence valid signal
confidence = 0
sig_grp_best ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def follower_dependent_event\n $PokemonGlobal.dependentEvents.each_with_index do |event,i|\n next if !event[8][/FollowerPkmn/]\n return @realEvents[i]\n end\n return nil\n end",
"def update_follow_up_flag_fields(patient, params)\n clear_flag = params.permit(:clear_flag)[:clear_flag]\n h... | [
"0.5618439",
"0.53948885",
"0.53830814",
"0.5347094",
"0.5224325",
"0.5132092",
"0.51182806",
"0.50978523",
"0.50430095",
"0.50239825",
"0.501384",
"0.49912384",
"0.49647087",
"0.4961539",
"0.49536547",
"0.49455437",
"0.4920662",
"0.49098077",
"0.49013418",
"0.48998424",
"0.4... | 0.8536292 | 0 |
private def consecutive(arr, consec=5) count = [] (1...arr.length).each do |idx| (arr[idx] 1 == arr[idx 1])? (count += 1) : (count = 0) return true if count >= consec 1 end false end | def consecutive
consec_cards = []
card_vals = @cards.map { |card| [card.value, card.suit]}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_consecutive_repeats?(arr)\n no_consecutives = true\n arr.each_with_index do |elem, idx|\n no_consecutives = false if elem == arr[idx+1]\n end\n return no_consecutives\nend",
"def no_consecutive_repeats?(arr)\n\n (0...arr.length-1).all? { |idx| arr[idx] != arr[idx+1] }\n\nend",
"def... | [
"0.7540591",
"0.7423898",
"0.7386789",
"0.73609823",
"0.7353272",
"0.7333562",
"0.73274505",
"0.72971004",
"0.72962683",
"0.7294323",
"0.72941595",
"0.729086",
"0.72866964",
"0.7284706",
"0.7275026",
"0.7275026",
"0.7252556",
"0.7248746",
"0.7242554",
"0.7233625",
"0.7226226"... | 0.0 | -1 |
Controls have different values depending on the control type. This class parses the Values string and save them according to the type of the control | def set_values(values)
case @type
when /Dword/ # n .. n, step size: n
if values =~ /(\d+)\s*\.\.\s*(\d+)\s*,\s*step size:\s*(\d+)/
@min = $1.to_f
@max = $2.to_f
@step = $3.to_f
else
puts "-E- Unrecognized value format: #{values}"
end
when /Choice/ # 'choice... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_values; end",
"def parse_labels\n @labels.split.each do |lbl|\n vals = lbl.split(':')\n v = vals.first\n case v\n when \"form\"\n handle_form_label vals\n when \"instrument\"\n handle_instrument_label vals\n when \"references\"\n handle_references_l... | [
"0.5912515",
"0.5780413",
"0.5509115",
"0.55035776",
"0.5498467",
"0.543333",
"0.5419669",
"0.5379222",
"0.53411365",
"0.5326487",
"0.5310837",
"0.52901816",
"0.52873284",
"0.52873284",
"0.52873284",
"0.52814275",
"0.52796626",
"0.52796626",
"0.52796626",
"0.52796626",
"0.527... | 0.68772036 | 0 |
Camera controls Send a command to the external program tha actually talks to the camera | def send_command(comd, value)
cmd = "#{@@uvctrl} -s '#{comd}' -- #{value}"
log_info(cmd)
`#{cmd}`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def centro\n @control_url = \"#{@control_url}camctrl.cgi\"\n send_command(\"PanTiltSingleMove\" => 4)\n end",
"def switchCamera _obj, _args\n \"_obj switchCamera _args;\" \n end",
"def camCommand _obj, _args\n \"_obj camCommand _args;\" \n end",
"def camera\n end",
"def camera\n en... | [
"0.658982",
"0.65050036",
"0.64426035",
"0.6242799",
"0.6242799",
"0.6048526",
"0.58346707",
"0.57440716",
"0.5731063",
"0.5620154",
"0.560164",
"0.55802494",
"0.5562057",
"0.55431575",
"0.5509074",
"0.549745",
"0.547982",
"0.54769707",
"0.54647064",
"0.5458173",
"0.5442112",... | 0.511261 | 70 |
Find out what the camera supports Save controls in the appropriate control Hash. Different controls are handled differently so I group like controls in their own separate Hash | def save_control(control)
return if control.nil?
case control.name
when /Pan/, /Tilt/
@motor_controls[control.name] = control
else
case control.type
when /Dword/
@slider_controls[control.name] = control
when /Button/
# This should be taken care of by the Pan and T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def supported_controls\n\t\treturn self.supported_control_oids.collect {|oid| CONTROL_NAMES[oid] || oid }\n\tend",
"def supported_control_oids\n\t\treturn self.root_dse[:supportedControl]\n\tend",
"def parse_controls()\n puts \"-I- Querying the camera...\"\n\n @motor_controls = Hash.new # Pan, Tilt\n ... | [
"0.62818086",
"0.57890457",
"0.5292976",
"0.5137371",
"0.50571764",
"0.5007246",
"0.49220824",
"0.4860716",
"0.47701332",
"0.4749477",
"0.47366393",
"0.47255963",
"0.47247824",
"0.47231305",
"0.46938783",
"0.46688136",
"0.46685016",
"0.46665937",
"0.46664333",
"0.4657064",
"0... | 0.5397847 | 2 |
Call the external program to find out all the controls supported by the camera Parse the result, creating and saving new controls as needed | def parse_controls()
puts "-I- Querying the camera..."
@motor_controls = Hash.new # Pan, Tilt
@slider_controls = Hash.new # Brightness, Contrast, ...
@toggle_controls = Hash.new # Auto (WB, exposure...)
@choice_controls = Hash.new # Freq, exposure
@device = ''
current_control = nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_controls\n finder = \"/resource/object[@name='#{base_id}']//*[@name]\"\n REXML::XPath.each(@xml_src, finder) do | elem |\n ctrl_name = elem.attributes['name']\n # skip default names\n next if ctrl_name =~ /^wx/\n next if ctrl_name =~ /^ID_/\n ctrl_subclass = elem.attributes[... | [
"0.59955734",
"0.58035296",
"0.5779585",
"0.56569207",
"0.56569207",
"0.55982447",
"0.554245",
"0.5510279",
"0.5405752",
"0.5382163",
"0.5358335",
"0.5294138",
"0.5238792",
"0.52122587",
"0.5138107",
"0.5107139",
"0.50667155",
"0.5051972",
"0.50132036",
"0.5005232",
"0.498261... | 0.7678447 | 0 |
These assume the GUI has been created hey should probably be merged into one function Write out an Info message to the message area of the GUI | def log_info(msg)
# puts "-I- #{msg}"
@msg_text.insert('end', "-I- #{msg}\n")
@msg_text.see('end')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cmdh_info(msg_details)\n @log.debug \"INFO handler called\"\n @cup_gui.log_sometext(\"<Server>: #{msg_details}\\n\")\n end",
"def show_info\n @font.draw_text(@message, 10, SIZE_GRID + 8, 5)\n end",
"def infobox(msg, title, height = 5, width = 40)\n @dialog.title = \"\\\"#{titl... | [
"0.71472985",
"0.6918499",
"0.667029",
"0.6615782",
"0.65945596",
"0.64044464",
"0.6358732",
"0.6344983",
"0.629825",
"0.62886614",
"0.6234908",
"0.62042415",
"0.61912364",
"0.61044383",
"0.60653865",
"0.60503453",
"0.6046712",
"0.6026415",
"0.6007042",
"0.59896684",
"0.59793... | 0.6266007 | 10 |
The GUI creation Huge function to create the GUI Tk is pretty verbose so this function is quite large. It probably needs to be split into separate functions | def create_gui
# The root
root = TkRoot.new { title "Camera Control" }
TkGrid.columnconfigure root, 0, :weight => 1
TkGrid.rowconfigure root, 0, :weight => 1
# Enclosing frame
content = Tk::Tile::Frame.new(root) { padding "5 5 12 12" }
content.grid :sticky => 'nsew'
# ------... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_gui\n \n end",
"def create_window\n set_buffer_modified() # required still ??\n # first create the main top window with the tab buttons on it.\n $log.debug \" TPane create_buff Top #{@row}, Left #{@col} H #{@height} W #{@width} \"\n #$log.debug \" parentwin #{@parentwin.left} #{... | [
"0.69782734",
"0.64456636",
"0.633564",
"0.6284223",
"0.62646353",
"0.6136242",
"0.6128257",
"0.60588384",
"0.60412484",
"0.59692186",
"0.59488297",
"0.59256995",
"0.58741397",
"0.5871937",
"0.585756",
"0.5855714",
"0.58111846",
"0.57877386",
"0.57684296",
"0.5738881",
"0.571... | 0.67665774 | 1 |
class CamCtrl GUI callbacks Apparently, Tk doesn't have access to instance methods. So I can't use the class methods as callbacks. Motor control | def tk_callback(name, *args)
$ctrl.public_send(name, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_gui\n \n # The root\n \n root = TkRoot.new { title \"Camera Control\" }\n TkGrid.columnconfigure root, 0, :weight => 1\n TkGrid.rowconfigure root, 0, :weight => 1\n\n # Enclosing frame\n\n content = Tk::Tile::Frame.new(root) { padding \"5 5 12 12\" }\n content.grid :sticky => ... | [
"0.6576518",
"0.6194675",
"0.6194675",
"0.58212095",
"0.5736512",
"0.5630633",
"0.5560187",
"0.54735917",
"0.5451669",
"0.53441",
"0.53440624",
"0.53440624",
"0.5341687",
"0.5339395",
"0.5296174",
"0.524801",
"0.52408147",
"0.5214085",
"0.5181008",
"0.51426727",
"0.5132261",
... | 0.60787284 | 3 |
Sets up a Sinatra::Base subclass defined with the block given. Used in setup or individual spec methods to establish the application. | def mock_app(&block)
path = default_views_path
@app = Renee::Core.new(&block).setup {
views_path path
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def mock_app(base=Sinatra::Base, &block)\n @app = Sinatra.new(base, &block)\n end",
"def mock_app(base=Sinatra::Base, &... | [
"0.7336083",
"0.729961",
"0.729961",
"0.729961",
"0.69828427",
"0.69828427",
"0.69828427",
"0.69828427",
"0.621536",
"0.6143759",
"0.606108",
"0.6027653",
"0.59156466",
"0.5850977",
"0.5850014",
"0.5717578",
"0.5621307",
"0.5619881",
"0.56132334",
"0.56087255",
"0.560628",
... | 0.5409882 | 44 |
create_view :index, "test", :haml | def create_view(name, content, engine=:erb)
FileUtils.mkdir_p(default_views_path)
file = File.join(default_views_path, name.to_s + ".#{engine}")
File.open(file, 'w') { |io| io.write content }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n\n render layout: 'views/index'\n\n end",
"def create_index\n template 'index.html.erb', \"app/views/#{namespace}/#{resource}/index.html.erb\"\n template 'filters.html.erb', \"app/views/#{namespace}/#{resource}/_filters.html.erb\"\n end",
"def index\n \t#render(:template => 'demo/hello')\... | [
"0.72146255",
"0.6992544",
"0.69317627",
"0.68682164",
"0.6809471",
"0.6763608",
"0.66834915",
"0.6660733",
"0.6638171",
"0.65413046",
"0.65412956",
"0.65412956",
"0.6482889",
"0.64243394",
"0.6422856",
"0.6408017",
"0.63736564",
"0.63703173",
"0.6361776",
"0.63386965",
"0.63... | 0.63748574 | 16 |
Removes the view folder after the test | def remove_views
FileUtils.rm_rf(File.dirname(__FILE__) + "/views")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def teardown\n FileUtils.remove_dir(File.expand_path(TEST_DIR), true)\n end",
"def teardown\n if File.exist?(modelPath())\n FileUtils.rm(modelPath())\n end\n if File.exist?(reportPath())\n FileUtils.rm(reportPath())\n end \n end",
"def clean_test_dir!\n FileUtils.remove_entr... | [
"0.68824446",
"0.6748661",
"0.6706267",
"0.6646587",
"0.65783733",
"0.6565606",
"0.6508206",
"0.64596343",
"0.6443859",
"0.64031345",
"0.63259834",
"0.6274147",
"0.62673914",
"0.6262305",
"0.6257437",
"0.6257437",
"0.62516177",
"0.6242564",
"0.6242564",
"0.6228406",
"0.622488... | 0.79616725 | 0 |
end method current alias | def original
original_amount
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alias_of; end",
"def aliases; end",
"def aliases; end",
"def aliases; end",
"def aliases\n end",
"def aliases\n\n end",
"def is_alias?; end",
"def aliased_name; end",
"def aliases=(_arg0); end",
"def aliases=(_arg0); end",
"def print_alias(*) end",
"def alt; end",
"def refutal()\n... | [
"0.7734367",
"0.72784394",
"0.72784394",
"0.72784394",
"0.71095395",
"0.7011865",
"0.68438226",
"0.67987204",
"0.6754993",
"0.6754993",
"0.6697365",
"0.65624845",
"0.64668846",
"0.6450145",
"0.64287376",
"0.63587195",
"0.6320139",
"0.6320139",
"0.62955457",
"0.62507737",
"0.6... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_post_comment
@post_comment = PostComment.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def post_comment_params
params.require(:post_comment).permit(:content, :user_id, :post_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7120904",
"0.70538116",
"0.69469863",
"0.6901261",
"0.67348766",
"0.6717708",
"0.66874576",
"0.6676195",
"0.66601187",
"0.65563625",
"0.6525127",
"0.64565873",
"0.64494514",
"0.644928",
"0.64452374",
"0.6433947",
"0.6412815",
"0.6412815",
"0.6391939",
"0.63792473",
"0.6379... | 0.0 | -1 |
Try to find the person in the DB based on their name | def find_person(first_name: nil, last_name: nil, legal_name: nil)
person = nil
# puts "** first and last"
# puts first_name
# puts last_name
if !first_name.blank? && !last_name.blank?
person = Person.find_by({
first_name: first_name.strip,
last_name: last_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_by_name(name)\n end",
"def look_for_user(name)\n User.find_by name: name\nend",
"def find_by_name(name)\n find_by('name', name)\n end",
"def find_person\n puts \"Enter name person or ID of person to find: \"\n id = gets.chomp\n\n # searching_person_in_db\n person = $db.execute(\"... | [
"0.7433348",
"0.74172413",
"0.72596645",
"0.72596186",
"0.72537273",
"0.7101612",
"0.7002061",
"0.69854474",
"0.6910263",
"0.6901316",
"0.6889988",
"0.68700176",
"0.6867261",
"0.68354857",
"0.6803083",
"0.6706234",
"0.6671795",
"0.66717947",
"0.6667915",
"0.66516703",
"0.6650... | 0.6809538 | 14 |
GET /recursos/1 GET /recursos/1.json | def show
@recurso = Recurso.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getOrden \n \t@orden = Orden.where(:rest => params[:id_res])\n \trender json: @orden\n end",
"def index\n @restoras = Restora.all\n end",
"def index\n @recurs = Recur.all\n end",
"def index\n \treclamos = Reclamo.all\n \trender json: reclamos.to_json(include: [:tipo_reclamo, :ubicacion, :use... | [
"0.6761507",
"0.64054894",
"0.64024496",
"0.6310774",
"0.62498873",
"0.623453",
"0.62336755",
"0.6226626",
"0.62070036",
"0.61932695",
"0.6190875",
"0.6148317",
"0.6141219",
"0.61337125",
"0.61211497",
"0.61114705",
"0.61041343",
"0.60951084",
"0.60818183",
"0.60607076",
"0.6... | 0.64330703 | 1 |
GET /recursos/new GET /recursos/new.json | def new
@recurso = Recurso.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @recurso }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end",
"def new\n @reconocimiento = Reconocimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.jso... | [
"0.7196457",
"0.71346617",
"0.71265894",
"0.7085994",
"0.70535",
"0.7018424",
"0.6994049",
"0.6980193",
"0.69768125",
"0.69722456",
"0.69491345",
"0.69473195",
"0.6929617",
"0.6928021",
"0.6926688",
"0.69184977",
"0.6908142",
"0.689686",
"0.6895095",
"0.68879056",
"0.6881655"... | 0.77188647 | 0 |
POST /recursos POST /recursos.json | def create
@recurso = Recurso.new(params[:recurso])
respond_to do |format|
if @recurso.save
format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi criado com sucesso.' }
format.json { render json: @recurso, status: :created, location: @recurso }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #return render json: params[:recursos]\n @area = Area.new(area_params)\n @count = 0\n save_multiples_recursos if params[:recursos][:status] == '1'\n respond_to do |format|\n if @area.save\n format.html { redirect_to areas_path, notice: 'El Área fue creada éxitosamente.' }\n ... | [
"0.63966256",
"0.62540305",
"0.6136997",
"0.6095473",
"0.6035122",
"0.6012932",
"0.5994319",
"0.5976744",
"0.5967401",
"0.5874084",
"0.5827606",
"0.5820931",
"0.58195853",
"0.57893205",
"0.5783801",
"0.57753015",
"0.57565355",
"0.5751805",
"0.57436323",
"0.57420236",
"0.57403... | 0.59964705 | 6 |
PUT /recursos/1 PUT /recursos/1.json | def update
@recurso = Recurso.find(params[:id])
respond_to do |format|
if @recurso.update_attributes(params[:recurso])
format.html { redirect_to @recurso, notice: 'O recurso de auto de infração foi atualizado com sucesso.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if params[:recursos][:status] == '1'\n @count = count_of_resource\n save_multiples_recursos\n end\n respond_to do |format|\n if @area.update(area_params)\n format.html { redirect_to @area, notice: 'El Área fue modificada éxitosamente.' }\n format.json { render :sh... | [
"0.62660486",
"0.6136741",
"0.6029564",
"0.6019402",
"0.5909153",
"0.59062374",
"0.584385",
"0.5838185",
"0.58178926",
"0.5810668",
"0.57796735",
"0.57740146",
"0.57184666",
"0.5717622",
"0.56985444",
"0.56905144",
"0.56718796",
"0.5668012",
"0.56655425",
"0.56620425",
"0.566... | 0.59323925 | 4 |
DELETE /recursos/1 DELETE /recursos/1.json | def destroy
@recurso = Recurso.find(params[:id])
@recurso.destroy
respond_to do |format|
format.html { redirect_to recursos_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @relogio = Relogio.find(params[:id])\n @relogio.destroy\n\n respond_to do |format|\n format.html { redirect_to relogios_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reconocimiento = Reconocimiento.find(params[:id])\n @reconocimiento.destroy\n\n resp... | [
"0.7046253",
"0.6970562",
"0.6962411",
"0.69547665",
"0.6857171",
"0.6832709",
"0.6814089",
"0.6811502",
"0.6803371",
"0.68027234",
"0.6789342",
"0.67684346",
"0.6767353",
"0.6746481",
"0.6727259",
"0.67115474",
"0.67039895",
"0.6699589",
"0.6692721",
"0.6691047",
"0.6689022"... | 0.71149236 | 0 |
Object Initialization viewport : viewport | def initialize(viewport = nil)
super(viewport)
@use_sprite = true # Sprite use flag
@animation_duration = 0 # Remaining animation time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_viewport\r\n # Make viewports\r\n @viewport1 = Viewport.new(0, 0, 640, 320)\r\n @viewport2 = Viewport.new(0, 0, 640, 480)\r\n @viewport3 = Viewport.new(0, 0, 640, 480)\r\n @viewport4 = Viewport.new(0, 0, 640, 480)\r\n @viewport2.z = 101\r\n @viewport3.z = 200\r\n @viewport4.z = 500... | [
"0.824846",
"0.7967158",
"0.7828154",
"0.76513094",
"0.7650741",
"0.75968015",
"0.75768375",
"0.7568873",
"0.7492982",
"0.7289686",
"0.7230731",
"0.7153965",
"0.70452225",
"0.69763243",
"0.69104826",
"0.6894136",
"0.68918765",
"0.68558216",
"0.6814255",
"0.68091595",
"0.67163... | 0.6612674 | 23 |
Determine if animation is being displayed | def animation?
return @animation != nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handles_animation?\n true\n end",
"def handles_animation?\n false\n end",
"def handles_animation?\n false\n end",
"def animated?\n @animated\n end",
"def inPartyAnimation?\r\n return @animations.length>0\r\n end",
"def animating_card?\n Animation.a... | [
"0.8189289",
"0.7923732",
"0.7923732",
"0.76493365",
"0.73669577",
"0.6887651",
"0.67844635",
"0.66511464",
"0.6515246",
"0.65144646",
"0.6485229",
"0.6485229",
"0.6443081",
"0.6443081",
"0.63450503",
"0.6247095",
"0.624602",
"0.624602",
"0.62416893",
"0.6233994",
"0.6227862"... | 0.8344193 | 0 |
Read (Load) Animation Graphics | def load_animation_bitmap
animation1_name = @animation.animation1_name
animation1_hue = @animation.animation1_hue
animation2_name = @animation.animation2_name
animation2_hue = @animation.animation2_hue
@animation_bitmap1 = Cache.animation(animation1_name, animation1_hue)
@animation_bitmap2 = Cac... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_animation(flush_it = false)\n if flush_it\n dispose_bitmaps_from_cache_tab(@animation_cache)\n else\n @animation_cache = {}\n @animation_data = Yuki::VD.new(PSDK_PATH + '/master/animation', :read)\n end\n end",
"def animation(filename, _hue = 0)\n load_image(@... | [
"0.66629916",
"0.60954773",
"0.57991064",
"0.5774121",
"0.5754869",
"0.57485557",
"0.57428396",
"0.5635335",
"0.55369914",
"0.5517732",
"0.5498959",
"0.5478049",
"0.5418995",
"0.5418837",
"0.53678596",
"0.5324469",
"0.5298476",
"0.5295934",
"0.5281702",
"0.52450794",
"0.52219... | 0.6123854 | 1 |
Set Animation Sprite frame : Frame data (RPG::Animation::Frame) | def animation_set_sprites(frame)
cell_data = frame.cell_data
for i in 0..15
sprite = @animation_sprites[i]
next if sprite == nil
pattern = cell_data[i, 0]
if pattern == nil or pattern == -1
sprite.visible = false
next
end
if pattern < 100
sprite.bitmap... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_frame\n frames = @animations[@playing_animation]\n case frames\n when Range\n reset_clipping_rect\n @clip_x = @current_frame * @clip_width\n when Array\n f = frames[@current_frame]\n @clip_x = f[:x] || @defaults[:clip_x]\n @clip_y = f[:y... | [
"0.75357795",
"0.72166955",
"0.71255827",
"0.7054485",
"0.6979114",
"0.6964869",
"0.6946955",
"0.68419194",
"0.65900034",
"0.6515816",
"0.6423102",
"0.6357975",
"0.6253137",
"0.62466985",
"0.619183",
"0.6041588",
"0.59720016",
"0.5970278",
"0.59512204",
"0.5941021",
"0.590011... | 0.67068386 | 8 |
SE and Flash Timing Processing timing : timing data (RPG::Animation::Timing) | def animation_process_timing(timing)
timing.se.play
case timing.flash_scope
when 1
self.flash(timing.flash_color, timing.flash_duration * 4)
when 2
if viewport != nil
viewport.flash(timing.flash_color, timing.flash_duration * 4)
end
when 3
self.flash(nil, timing.flash... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def animation_process_timing(timing)\n timing.se.play unless @ani_duplicated\n case timing.flash_scope\n when 1\n @ref_sprite.flash(timing.flash_color, timing.flash_duration * @ani_rate)\n when 2\n if viewport && !@ani_duplicated\n viewport.flash(timing.flash_color, timing.flash_durati... | [
"0.6530593",
"0.65135",
"0.6383977",
"0.6367273",
"0.6202387",
"0.6196433",
"0.6074776",
"0.6020338",
"0.60030454",
"0.59730536",
"0.586579",
"0.5852179",
"0.5838256",
"0.57908034",
"0.577597",
"0.57480216",
"0.574205",
"0.5736096",
"0.57322353",
"0.57322353",
"0.57322353",
... | 0.6297893 | 4 |
We only can use the common object storage settings if: 1. The common settings are defined 2. The legacy settings are not defined | def use_consolidated_settings?
return false unless settings.dig('object_store', 'enabled')
return false unless settings.dig('object_store', 'connection').present?
WORKHORSE_ACCELERATED_TYPES.each do |store|
# to_h is needed because we define `default` as a Gitaly storage name
# in stub_storage_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_options; end",
"def storage_options=(_arg0); end",
"def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whiteli... | [
"0.6512562",
"0.6081715",
"0.6042482",
"0.596853",
"0.58894324",
"0.5812287",
"0.5789207",
"0.5767973",
"0.5696392",
"0.5694723",
"0.5691169",
"0.56761354",
"0.5669081",
"0.56557643",
"0.56457055",
"0.5635537",
"0.56260085",
"0.56140655",
"0.56140655",
"0.55786824",
"0.554349... | 0.68764466 | 0 |
The input string always has more than five digits. INPUT string of digits OUTPUT integer RULES input string will always have more than 5 digits ALGORITHM SET idx = index position 5 in `input_str` that consecutive digits will start from SET largest_product = 0 UNTIL `idx` == `input_str` length 5 take characters in `inpu... | def greatest_product(n)
idx = 0
largest_product = 0
loop do
sum = n[idx, 5].chars.map(&:to_i).inject { |mem, num| mem * num }
largest_product = sum if sum > largest_product
idx += 1
break if idx >= n.length - 4
end
largest_product
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_largest_5 string\n max, number_array = 0, string.split(\"\").map(&:to_i)\n (0...number_array.size-4). each do |i|\n product = number_array[i..i+4].inject(:*)\n max = product if(product>max)\n end\n max\nend",
"def greatest_product(n, start_index = 0, greatest_product = 0)\n while start_in... | [
"0.8068897",
"0.74378735",
"0.6992025",
"0.6982626",
"0.6973437",
"0.6952755",
"0.694486",
"0.6934638",
"0.69169533",
"0.6723459",
"0.6699266",
"0.66322803",
"0.6626414",
"0.6618014",
"0.65904427",
"0.64308953",
"0.6425281",
"0.64226294",
"0.6403427",
"0.6359243",
"0.635738",... | 0.7186216 | 2 |
sets +start_time+ to the current time. | def start_clock
@start_time = Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_start_time\n @start_time = Time.now.to_f\n end",
"def set_start_time\n @start_time = Time.now.to_f\n end",
"def start_time=(value)\n @start_time = value\n end",
"def setStart\n @start = Time.now\n end",
"def set_current_time\n current_time = Time.zon... | [
"0.8528394",
"0.8528394",
"0.82033193",
"0.8109008",
"0.8077342",
"0.7683086",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.7582351",
"0.75536114",
"0.7547409",
"0.7432547",
"0.7432547",
"0.7432547",
... | 0.7375781 | 21 |
sets +end_time+ to the current time | def stop_clock
@start_time ||= Time.now # if we failed so early we didn't get a start time
@end_time = Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end_time=(end_time)\n assert_unloaded\n raise ArgumentError, \"you have already set end_date\" if @end_date\n @end_time = end_time\n end",
"def end\n @end_time = Time.now.utc\n end",
"def gc_set_end_time\n if end_time.nil?\n self.end_time = start_time\n end\n end",... | [
"0.8149432",
"0.80995953",
"0.8078345",
"0.7822402",
"0.78122",
"0.78122",
"0.78122",
"0.78122",
"0.78122",
"0.78122",
"0.78109604",
"0.7592542",
"0.7467595",
"0.7360351",
"0.7167527",
"0.7162111",
"0.71397084",
"0.7121957",
"0.70857304",
"0.7061566",
"0.70545185",
"0.70234... | 0.66295975 | 44 |
The elapsed time between +start_time+ and +end_time+. Returns +nil+ if either value is not set. | def elapsed_time
if @start_time && @end_time
@end_time - @start_time
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def elapsed_time\n if end_time && start_time\n return ((end_time - start_time)/60).round\n else\n return 0\n end\n end",
"def duration\n if start_time && end_time\n end_time.to_i - start_time.to_i\n else\n 0.0\n end\n end",
"def time... | [
"0.7443149",
"0.70829695",
"0.69518244",
"0.6842988",
"0.6831014",
"0.68187517",
"0.6743509",
"0.6728741",
"0.6682313",
"0.6652872",
"0.6536681",
"0.6536505",
"0.6520913",
"0.65108216",
"0.65003955",
"0.6497797",
"0.6483068",
"0.6480277",
"0.64419866",
"0.64244",
"0.64236337"... | 0.8365217 | 0 |
The list of all resources in the current run context's +resource_collection+ | def all_resources
@run_context && @run_context.resource_collection.all_resources
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resource_collection\n client.run_status.run_context.resource_collection\n end",
"def resource_collection\n @resource_collection ||= @run_context.resource_collection\n end",
"def resource_list\n self.resources\n end",
"def collection\n resource_class.all\n end",
"def resource... | [
"0.81417835",
"0.812495",
"0.7941049",
"0.78656924",
"0.7769021",
"0.7647301",
"0.76172686",
"0.76172686",
"0.76172686",
"0.74533576",
"0.7331128",
"0.73216456",
"0.72623587",
"0.71930647",
"0.7191994",
"0.7120961",
"0.70347077",
"0.7027188",
"0.6994759",
"0.6965296",
"0.6904... | 0.80677617 | 2 |
The list of all resources in the current run context's +resource_collection+ that are marked as updated | def updated_resources
@run_context && @run_context.resource_collection.select(&:updated)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def updated_resources\n @updated_resources ||= action_collection&.filtered_collection(max_nesting: 0, up_to_date: false, skipped: false, unprocessed: false) || {}\n end",
"def update \n items = changed_since(last_run)\n resources = []\n items.each do |item|\n resource = constru... | [
"0.80957896",
"0.7254684",
"0.6926539",
"0.6720314",
"0.65934783",
"0.6565254",
"0.64407253",
"0.64216924",
"0.63472646",
"0.6155117",
"0.6074919",
"0.6046983",
"0.60199416",
"0.60100865",
"0.6009179",
"0.6009179",
"0.6009179",
"0.59467477",
"0.5890107",
"0.5890107",
"0.58890... | 0.84288853 | 0 |
The backtrace from +exception+, if any | def backtrace
@exception && @exception.backtrace
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backtrace(exception)\n return unless Gem.configuration.backtrace\n\n @errs.puts \"\\t#{exception.backtrace.join \"\\n\\t\"}\"\n end",
"def backtrace(exception)\n message = \"<br/>\" + sanitize(exception.message) + \"<br/>\"\n message += exception.backtrace.collect { |line|\n san... | [
"0.7993838",
"0.78496456",
"0.76935977",
"0.76148283",
"0.74864864",
"0.745167",
"0.745167",
"0.7412758",
"0.7391056",
"0.7378474",
"0.7243799",
"0.7227415",
"0.72027904",
"0.7157534",
"0.7145559",
"0.70882016",
"0.70622987",
"0.70261097",
"0.6979516",
"0.69767714",
"0.696966... | 0.86020243 | 0 |
Did the Chef run fail? | def failed?
!success?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_failed(exception)\n elapsed = (Time.now - @start_time).round(2)\n puts \"chef client failed. #{@updated_resources} resources updated, took #{elapsed} seconds\"\n end",
"def run_failed(exception)\n super\n Chef::Log.warn(\"<< END >>\")\n end",
"def failure?\n ... | [
"0.71328837",
"0.70993906",
"0.7033485",
"0.6906399",
"0.66473526",
"0.64477295",
"0.6363895",
"0.6337396",
"0.6328166",
"0.6322458",
"0.631714",
"0.62387735",
"0.62309146",
"0.62309146",
"0.62174976",
"0.6171468",
"0.61508983",
"0.6142458",
"0.6130417",
"0.61132205",
"0.6090... | 0.0 | -1 |
Did the chef run succeed? returns +true+ if no exception has been set. | def success?
@exception.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful?\n exit_code == 0\n end",
"def success?\n exit_status == 0\n end",
"def success?\n exit_code == 0\n end",
"def failure?\n exit_code != 0\n end",
"def run\n @ok = true\n if @run_list.empty?\n # Deliberately avoid auditing anything s... | [
"0.7103125",
"0.6999919",
"0.6927851",
"0.68755764",
"0.68072087",
"0.669829",
"0.669829",
"0.6687651",
"0.6660159",
"0.6660159",
"0.66416025",
"0.6593535",
"0.65849507",
"0.6578077",
"0.65655154",
"0.64737934",
"0.6458571",
"0.6454609",
"0.6430211",
"0.64270335",
"0.6415745"... | 0.6260947 | 26 |
A Hash representation of the RunStatus, with the following (Symbol) keys: :node :success :start_time :end_time :elapsed_time :all_resources :updated_resources :exception :backtrace | def to_h
# use a flat hash here so we can't errors from intermediate values being nil
{ node: node,
success: success?,
start_time: start_time,
end_time: end_time,
elapsed_time: elapsed_time,
all_resources: all_resources,
updated_resources: updated_resources,
exception: ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_status\n status = {}\n\n status[:noop] = @noop\n status[:tags] = @tags unless @tags.nil?\n status[:state] = @state\n status[:report_errors] = @report_errors\n status[:errors] = @errors\n status[:expired_executions] = @expired_executions\n status[:update_time] = Time.now.to_i\n st... | [
"0.7156632",
"0.69220746",
"0.6696777",
"0.6647466",
"0.6535748",
"0.64898074",
"0.64898074",
"0.64729536",
"0.646187",
"0.64543086",
"0.64228296",
"0.64194036",
"0.6378472",
"0.63524854",
"0.6346892",
"0.6207047",
"0.6167438",
"0.61460453",
"0.61195034",
"0.60752904",
"0.605... | 0.66261154 | 4 |
Returns a string of the format "ExceptionClass: message" or +nil+ if no +exception+ is set. | def formatted_exception
@exception && "#{@exception.class.name}: #{@exception.message}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exception_message\n @e_m ||= @exception.nil? ? '' : @exception.message\n end",
"def exception_message(e)\n <<-EXCEPTION\nException happend\nType: #{@type.inspect}\nData: #{@data.inspect}\nError occurs: #{e.class.inspect}(#{e.message})\nBacktrace: #{e.backtrace.join(\"\\n\") rescue ''}\n EXC... | [
"0.7428627",
"0.71867645",
"0.70854324",
"0.6793946",
"0.6714841",
"0.66709846",
"0.65567887",
"0.64464736",
"0.64238006",
"0.6320626",
"0.6224239",
"0.61642784",
"0.61541855",
"0.6126883",
"0.61097914",
"0.6073638",
"0.59934914",
"0.5968471",
"0.5827848",
"0.5771455",
"0.576... | 0.75787675 | 0 |
Bang method is available: .merge! | def custom_merge(hash1, hash2)
output = hash1.dup
hash2.each { |key, value| output[key] = value }
output
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge!; end",
"def merge!(with); end",
"def merge; end",
"def merge!(other); end",
"def merge(with); end",
"def merge(other); end",
"def merge(...)\n self.clone.merge!(...)\n end",
"def merge(source); end",
"def rh_merge!(data)\n _rh_merge(self, data)\n end",
"def merge(opts); end",
... | [
"0.85055923",
"0.8220413",
"0.79671836",
"0.78964317",
"0.7860447",
"0.77370346",
"0.77100486",
"0.7473442",
"0.73838913",
"0.73720664",
"0.73421854",
"0.72784215",
"0.7276856",
"0.7246863",
"0.719549",
"0.7160636",
"0.70971185",
"0.70770353",
"0.70650214",
"0.7046428",
"0.70... | 0.0 | -1 |
To display output immediately on windows using git bash | def convert_to_base_8(n)
n.to_s(8).to_i # replace these two method calls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prompt_git_branch\n if !is_git?\n return \"\"\n end\n stat = `git status`\n \"[#{stat.split(\"\\n\")[0].split(\" \")[-1]}]\".yellow\nend",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def stdout; end",
"def prep_screen\n system(\"clear\... | [
"0.6219506",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.61200327",
"0.6103044",
"0.60350794",
"0.59949106",
"0.5973232",
"0.59097284",
"0.58951396",
"0.5886012",
"0.586864",
"0.58550465",
"0.582788",
"0.5807792",
"0.5802978",
"0.5773198",
"0.5745... | 0.0 | -1 |
GET /book_users/1 GET /book_users/1.json | def show
@book_user = BookUser.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @book_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @usersbook = Usersbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usersbook }\n end\n end",
"def show\n @user = User.find(params[:id])\n @books = Book.all\n\n respond_to do |format|\n format.html # show.htm... | [
"0.7585405",
"0.75109196",
"0.7314822",
"0.7276067",
"0.72130764",
"0.71849525",
"0.7153228",
"0.71299446",
"0.7119387",
"0.7091158",
"0.7070302",
"0.7044817",
"0.6974236",
"0.6817584",
"0.6788134",
"0.6701204",
"0.66614544",
"0.6636347",
"0.6558996",
"0.6541958",
"0.6524061"... | 0.74959713 | 2 |
GET /book_users/new GET /book_users/new.json | def new
@book_user = BookUser.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @book_user }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @usersbook = Usersbook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usersbook }\n end\n end",
"def new\n @book = current_user.books.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @... | [
"0.8071927",
"0.79625005",
"0.76403517",
"0.75782895",
"0.75720733",
"0.7504708",
"0.74885434",
"0.738683",
"0.7370643",
"0.7345656",
"0.73137116",
"0.73137116",
"0.72987944",
"0.72987944",
"0.72797537",
"0.7278893",
"0.7263015",
"0.7262938",
"0.72505504",
"0.7249627",
"0.724... | 0.80707085 | 1 |
POST /book_users POST /book_users.json | def create
@book_user = BookUser.new(params[:book_user])
respond_to do |format|
if @book_user.save
format.html { redirect_to @book_user, notice: 'Book user was successfully created.' }
format.json { render json: @book_user, status: :created, location: @book_user }
else
forma... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @usersbook = Usersbook.new(params[:usersbook])\n\n respond_to do |format|\n if @usersbook.save\n format.html { redirect_to @usersbook, notice: 'Registro criado com sucesso!' }\n format.json { render json: @usersbook, status: :created, location: @usersbook }\n else\n ... | [
"0.69833004",
"0.6786281",
"0.6672082",
"0.6590975",
"0.65856487",
"0.65712875",
"0.6522486",
"0.65064645",
"0.647084",
"0.6426644",
"0.6409902",
"0.6406857",
"0.63970375",
"0.6392217",
"0.6387166",
"0.63814306",
"0.6362694",
"0.63508546",
"0.6309115",
"0.6300864",
"0.6287888... | 0.7008736 | 0 |
PUT /book_users/1 PUT /book_users/1.json | def update
@book_user = BookUser.find(params[:id])
respond_to do |format|
if @book_user.update_attributes(params[:book_user])
format.html { redirect_to @book_user, notice: 'Book user was successfully updated.' }
format.json { head :no_content }
else
format.html { render acti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user_book = UserBook.find(params[:id])\n\n respond_to do |format|\n if @user_book.update_attributes(params[:user_book])\n format.html { redirect_to new_user_book_path, notice: 'Your book was successfully updated. You can add more or go back to your shelf' }\n format.json { he... | [
"0.72962284",
"0.7039687",
"0.7037115",
"0.6800555",
"0.67491865",
"0.6736438",
"0.66303444",
"0.6573669",
"0.65031135",
"0.6497831",
"0.64947146",
"0.64816785",
"0.6478088",
"0.6473176",
"0.6464653",
"0.6452507",
"0.64282274",
"0.64161146",
"0.6365166",
"0.6362467",
"0.63067... | 0.7064999 | 1 |
DELETE /book_users/1 DELETE /book_users/1.json | def destroy
@book_user = BookUser.find(params[:id])
@book_user.destroy
respond_to do |format|
format.html { redirect_to book_users_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @usersbook = Usersbook.find(params[:id])\n @usersbook.destroy\n\n respond_to do |format|\n format.html { redirect_to usersbooks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render... | [
"0.76728994",
"0.7437501",
"0.7432272",
"0.7398993",
"0.7397263",
"0.73552847",
"0.729672",
"0.72063714",
"0.7202477",
"0.71831167",
"0.71329874",
"0.7125647",
"0.70792127",
"0.69512457",
"0.68902993",
"0.6879415",
"0.68630713",
"0.6859353",
"0.68586725",
"0.68540186",
"0.685... | 0.7696025 | 0 |
when a bug report is created Status/Resolution should be Open/Unresolved | def set_to_open_unresolved
status = Status.select("id").where("status like 'Open'").first
resolution = Resolution.select("id").where("resolution like 'Unresolved'").first
self.status_id = status.id
self.resolution_id = resolution.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bug?\n @issue_type.casecmp('bug') == 0\n end",
"def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to... | [
"0.6752197",
"0.6212297",
"0.60901487",
"0.6014972",
"0.6012173",
"0.59971464",
"0.5996917",
"0.59270906",
"0.59169084",
"0.5885866",
"0.5877508",
"0.58479667",
"0.5845361",
"0.58411354",
"0.5838083",
"0.5796956",
"0.57918733",
"0.5791828",
"0.5776771",
"0.5775557",
"0.577127... | 0.5913314 | 9 |
accepts a string given the format GAME and parses it | def get_game_id(str)
# parse str to get GAME
title = str.split("-")[0]
# find id of GAME
game = Game.select("id").where("key LIKE \'#{title.upcase}\'").to_a[0]
self.game_id = game.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_game(text)\n p = @current_match.player(text)\n if p.nil?\n parse_error \"Player not found (abbreviation: #{text.strip}).\"\n end\n @current_game = Game.new(p)\n @current_set.add_game @current_game\n end",
"def parse_game team\n parsed_team = team.rpartition(' ')\n\... | [
"0.67612576",
"0.63918144",
"0.6145322",
"0.58758146",
"0.5768387",
"0.5615456",
"0.55546266",
"0.5486099",
"0.54521453",
"0.53637356",
"0.5308647",
"0.53005767",
"0.5209449",
"0.5201699",
"0.5136854",
"0.51101434",
"0.5110013",
"0.5109482",
"0.5099249",
"0.5093222",
"0.50889... | 0.5208191 | 13 |
Provide a list of all report templates the user can access on the Security Console. | def list_report_templates
r = execute(make_xml('ReportTemplateListingRequest', {}))
templates = []
if r.success
r.res.elements.each('//ReportTemplateSummary') do |template|
templates << ReportTemplateSummary.parse(template)
end
end
templates
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_list(_)\n report_templates = ReportPrivate.all_report_templates(@path_to)\n report_templates = yield(report_templates) if block_given?\n @console.info self, ReportPrivate.table(report_templates)\n end",
"def templates\n @instruments_templates ||= lambda do\n args = ['xctrace', 'l... | [
"0.7298729",
"0.65703726",
"0.64280355",
"0.64017814",
"0.63125193",
"0.6234369",
"0.61627537",
"0.6056741",
"0.5994975",
"0.5968573",
"0.5919986",
"0.5912014",
"0.59058136",
"0.5904071",
"0.5892927",
"0.5884231",
"0.58820593",
"0.5857762",
"0.584616",
"0.5842035",
"0.5828212... | 0.69135004 | 1 |
Deletes an existing, custom report template. Cannot delete builtin templates. | def delete_report_template(template_id)
AJAX.delete(self, "/data/report/templates/#{URI.escape(template_id)}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end",
"def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end",
"def destroy\n @custom_template.destroy\n redirect_to custom_templates_url\n end",
"def delete_content_temp... | [
"0.7299848",
"0.724631",
"0.7192689",
"0.7037026",
"0.69479215",
"0.68884826",
"0.68080086",
"0.6792223",
"0.6784502",
"0.6775926",
"0.6700095",
"0.6687832",
"0.6677322",
"0.667149",
"0.65628815",
"0.6531524",
"0.6506867",
"0.64919436",
"0.647862",
"0.6468533",
"0.6437223",
... | 0.7725468 | 0 |
Save the configuration for a report template. | def save(connection)
xml = %(<ReportTemplateSaveRequest session-id='#{connection.session_id}' scope='#{@scope}'>)
xml << to_xml
xml << '</ReportTemplateSaveRequest>'
response = connection.execute(xml)
if response.success
@id = response.attributes['template-id']
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save_preferences\n template = Template.find(params[:id])\n authorize Template\n\n args = preference_params\n args[:customize_output_types] = params[:customize_output_types_sel] != '0'\n args[:customize_licenses] = params[:customize_licenses_sel] != '0'\n\n # Template.t... | [
"0.63017935",
"0.6282475",
"0.6213845",
"0.6156278",
"0.6112532",
"0.60579884",
"0.6003983",
"0.6000628",
"0.5948389",
"0.5934067",
"0.580606",
"0.57856864",
"0.57606316",
"0.56705153",
"0.56527346",
"0.55248636",
"0.55078095",
"0.5500432",
"0.5500432",
"0.54586315",
"0.54259... | 0.64712787 | 0 |
request password reset. you get here when the user entered his email in the reset password form and submitted it. | def create
@momentum_cms_user = MomentumCms::User.where(email: params[:momentum_cms_user][:email]).first
# This line sends an email to the user with instructions on how to reset their password (a url with a random token)
@momentum_cms_user.deliver_reset_password_instructions! if @momentum_cms_user
# T... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset\r\n if request.post? && params[:email_address]\r\n flash[:success] = \"Your password has been reset, and emailed to #{params[:email_address]}\"\r\n user = User.find_by_email_address(params[:email_address])\r\n if user\r\n new_password = user.reset_password\r\n ema... | [
"0.816121",
"0.8149312",
"0.81395227",
"0.806907",
"0.80036306",
"0.7891332",
"0.7880797",
"0.784498",
"0.7823461",
"0.77868193",
"0.7722252",
"0.7719336",
"0.7685115",
"0.7654748",
"0.7650074",
"0.76322323",
"0.7614022",
"0.7607777",
"0.7605992",
"0.7599825",
"0.75875527",
... | 0.0 | -1 |
This is the reset password form. | def edit
@momentum_cms_user = MomentumCms::User.load_from_reset_password_token(params[:id])
@token = params[:id]
if @momentum_cms_user.blank?
not_authenticated
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_reset_password\n @reset_form = ResetPasswordForm.new\n end",
"def new\n # User clicked on the \"Forgot Password\" link, it will show the form\n # to insert the email\n end",
"def send_reset_password_instructions\n end",
"def edit\n @form = PasswordResetForm.new(@user)\n end",
... | [
"0.759276",
"0.7298222",
"0.7217498",
"0.72069013",
"0.7112586",
"0.7099354",
"0.7066904",
"0.7053088",
"0.7041708",
"0.7028648",
"0.6994608",
"0.6993332",
"0.6984747",
"0.6983239",
"0.69822496",
"0.6969219",
"0.69606555",
"0.6943962",
"0.6922096",
"0.68911463",
"0.68908554",... | 0.0 | -1 |
This action fires when the user has sent the reset password form. | def update
@token = params.fetch(:momentum_cms_user, {}).fetch(:token, nil)
@momentum_cms_user = MomentumCms::User.load_from_reset_password_token(@token)
if @momentum_cms_user.blank?
not_authenticated
return
end
# the next line makes the password confirmation validation work
@mome... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def password_reset\r\n if request.post? && params[:email_address]\r\n flash[:success] = \"Your password has been reset, and emailed to #{params[:email_address]}\"\r\n user = User.find_by_email_address(params[:email_address])\r\n if user\r\n new_password = user.reset_password\r\n ema... | [
"0.79599804",
"0.7770268",
"0.7770268",
"0.7770268",
"0.7751513",
"0.7746778",
"0.7694556",
"0.76711667",
"0.76384425",
"0.76255834",
"0.7609316",
"0.7609104",
"0.759965",
"0.75829947",
"0.7577955",
"0.75630623",
"0.75484824",
"0.75406635",
"0.75406635",
"0.75406635",
"0.7540... | 0.0 | -1 |
GET /favorites GET /favorites.json | def index
@favorites = Favorite.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize! :index, Spree::Favorite\n @favorites = spree_current_user.favorites\n respond_to do |format|\n format.html\n format.json { render json: @favorites }\n end\n end",
"def index\n if !current_user.favorites.blank?\n return current_user.favorites\n ... | [
"0.81650114",
"0.81003666",
"0.79314446",
"0.7929879",
"0.7912019",
"0.78082174",
"0.78043085",
"0.7799029",
"0.7765045",
"0.7753265",
"0.7720995",
"0.77197057",
"0.7687166",
"0.7681991",
"0.7615702",
"0.76151246",
"0.759655",
"0.75615096",
"0.7552729",
"0.7544309",
"0.752756... | 0.7511769 | 23 |
GET /favorites/1 GET /favorites/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if !current_user.favorites.blank?\n return current_user.favorites\n else\n render json: { errors: \"No favorites for current user\" }, status: :not_found\n end\n end",
"def index\n authorize! :index, Spree::Favorite\n @favorites = spree_current_user.favorites\n resp... | [
"0.79223645",
"0.7893582",
"0.7756544",
"0.7743529",
"0.77210355",
"0.7703281",
"0.76994765",
"0.76640284",
"0.7651623",
"0.7625183",
"0.7609338",
"0.75987",
"0.75879455",
"0.75832003",
"0.7561347",
"0.75560683",
"0.7552997",
"0.7552997",
"0.7552997",
"0.7547547",
"0.74818647... | 0.0 | -1 |
POST /favorites POST /favorites.json | def create
current_datetime = DateTime.now.strftime("%Y-%m-%d %H:%M:%S")
favorites = Favorite.where("user_id = ? and entry_id = ?", params[:favorite][:user_id], params[:favorite][:entry_id])
logger.debug "[]-------------------------------------------------"
logger.debug favorites.inspect
logger... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def favorite(id)\n post(\"/favorites/create/#{id}.json\")\n end",
"def create_favorite(id)\n post \"favorites/create/#{id}\", {}\n end",
"def create\n @favorite = user.favorites.new(favorite_params)\n\n if @favorite.save\n render :show, status: :ok\n else\n re... | [
"0.8293012",
"0.8235616",
"0.77958995",
"0.7580792",
"0.7557451",
"0.75311977",
"0.7345681",
"0.73061526",
"0.72919786",
"0.7285139",
"0.7285139",
"0.7244945",
"0.7188994",
"0.7138383",
"0.71382046",
"0.7130169",
"0.71262723",
"0.71253884",
"0.709074",
"0.7087937",
"0.7039208... | 0.0 | -1 |
PATCH/PUT /favorites/1 PATCH/PUT /favorites/1.json | def update
respond_to do |format|
if @favorite.update(favorite_params)
format.html { redirect_to @favorite, notice: 'Favorite was successfully updated.' }
format.json { render :show, status: :ok, location: @favorite }
else
format.html { render :edit }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_with Favor.update(params[:id], params[:favor])\n end",
"def update\n @favorite = Favorite.find(params[:id])\n\n respond_to do |format|\n if @favorite.update_attributes(params[:favorite])\n format.html { redirect_to @favorite, notice: 'Favorite was successfully u... | [
"0.73830366",
"0.73317206",
"0.73317206",
"0.71716",
"0.7121535",
"0.70801955",
"0.7072636",
"0.7063862",
"0.70363545",
"0.70285803",
"0.7019287",
"0.7008076",
"0.6937376",
"0.6875921",
"0.68242073",
"0.6809988",
"0.6802969",
"0.67564166",
"0.67508346",
"0.67088145",
"0.66895... | 0.72696793 | 5 |
DELETE /favorites/1 DELETE /favorites/1.json | def destroy
@favorite.destroy
respond_to do |format|
format.html { redirect_to favorites_url, notice: 'Favorite was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy_favorite(id)\n delete \"favorites/destroy/#{id}\"\n end",
"def destroy\n @favorite = Favorite.find(params[:id])\n @favorite.destroy\n\n respond_to do |format|\n format.html { redirect_to favorites_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n re... | [
"0.8092512",
"0.803734",
"0.79889226",
"0.78097653",
"0.77844375",
"0.7717905",
"0.7674185",
"0.7660106",
"0.7650664",
"0.760913",
"0.75911283",
"0.7588881",
"0.7565385",
"0.7565218",
"0.7523727",
"0.7496201",
"0.7458546",
"0.74419236",
"0.740083",
"0.7370661",
"0.73702216",
... | 0.77384853 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_favorite
@favorite = Favorite.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.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def create_favorite_params
current_datetime = DateTime.now.strftime("%Y-%m-%d %H:%M:%S")
params[:favorite][:created_at] = current_datetime
params[:favorite][:updated_at] = current_datetime
params.require(:favorite).permit(:user_id, :game_id, :entry_id, :delete_flag, :created_at, :updated_at)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
simple_calender requires a field called "start_time" but it's called "start" in my database this function will map "start_time" to the real "start" field | def start_time
start
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_time\n by_date\n end",
"def start_formatted\n display_time read_attribute(:start)\n end",
"def event_start_for_solr\n # return event_start.iso8601[0,19]+'Z'\n start_date = event_start\n\t \n start_date = entry_deadline if is_opportunity?\n \n\t return FinderHelper.date_for_sol... | [
"0.7020922",
"0.6918137",
"0.68986356",
"0.6876713",
"0.680808",
"0.67617697",
"0.6754902",
"0.6753334",
"0.6540028",
"0.64942884",
"0.64928824",
"0.64877886",
"0.64435196",
"0.6441441",
"0.63883036",
"0.63788444",
"0.6371003",
"0.6353277",
"0.6339719",
"0.6335304",
"0.633318... | 0.61279756 | 38 |
Override the method inherited from `YAML::Store`. All `PStore` instances expect `load` to strictly return a `Hash`. This override allows us to perform onthefly upgrading of data loaded from old pool files and ensure the right structure is returned. | def load(content)
data = super(content)
if data.is_a? AutoNetwork::Pool
upgrade_from_version_1! data
else
data
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n ne... | [
"0.64809936",
"0.60573596",
"0.5991353",
"0.59885037",
"0.58780193",
"0.58780193",
"0.581928",
"0.5794358",
"0.57425296",
"0.56837755",
"0.56837755",
"0.56837755",
"0.5655688",
"0.56382924",
"0.56301415",
"0.56180745",
"0.55558026",
"0.55502224",
"0.55478865",
"0.5538856",
"0... | 0.54822487 | 27 |
Given a hash with numeric values, return the key for the smallest value | def key_for_min_value(name_hash)
return nil if name_hash.empty?
name_hash.max_by {|k, v| 0-v}[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend",
"def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n... | [
"0.88224113",
"0.877901",
"0.8777944",
"0.874689",
"0.869049",
"0.86566633",
"0.86537737",
"0.8617569",
"0.858881",
"0.8573083",
"0.85681975",
"0.85526323",
"0.8531178",
"0.8531178",
"0.85195357",
"0.8494278",
"0.847643",
"0.847643",
"0.8466703",
"0.8450763",
"0.8449879",
"... | 0.0 | -1 |
obj should have x and y | def closest(obj)
human = @humans.first
min_dist = MAX_DIST
@humans.each do |h|
dist = h.distance(obj)
if dist < min_dist
human = h
min_dist = dist
end
end
human
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obstructed?(new_x, new_y); end",
"def object_collided(x, y, object); end",
"def coords; {:x => @x, :y => @y} end",
"def initialize x, y\n\t\t@x = x\n\t\t@y = y\n\tend",
"def initialize\n self.x, self.y = 0, 0\n end",
"def initialize(x,y)\r\n @x = x\r\n @y = y \r\n end",
"def initialize(x... | [
"0.69990224",
"0.6816122",
"0.6573538",
"0.643299",
"0.62730163",
"0.6263366",
"0.62600136",
"0.62321424",
"0.62138504",
"0.62138504",
"0.6211585",
"0.6197764",
"0.61578596",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.... | 0.0 | -1 |
obj should have x and y | def closest(obj)
zombie = @zombies.first
min_dist = MAX_DIST
@zombies.each do |z|
dist = z.distance(obj)
if dist < min_dist
zombie = z
min_dist = dist
end
end
zombie
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def obstructed?(new_x, new_y); end",
"def object_collided(x, y, object); end",
"def coords; {:x => @x, :y => @y} end",
"def initialize x, y\n\t\t@x = x\n\t\t@y = y\n\tend",
"def initialize\n self.x, self.y = 0, 0\n end",
"def initialize(x,y)\r\n @x = x\r\n @y = y \r\n end",
"def initialize(x... | [
"0.69990224",
"0.6816122",
"0.6573538",
"0.643299",
"0.62730163",
"0.6263366",
"0.62600136",
"0.62321424",
"0.62138504",
"0.62138504",
"0.6211585",
"0.6197764",
"0.61578596",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.61447126",
"0.... | 0.0 | -1 |
def scope_ids self.class.lolita_nested_tree.scope_keys.map do |key| self.send(key) end end def scope_records self.class.lolita_nested_tree.scope_keys.map do |scope| scope.constantize.exists?(self.send(scope.foreign_key.to_sym)) end end | def put_in_place
if place==:append
item = self
self.class.with_tree_scope(self) do
root.append(item)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scope\n if tree.columns.scope?\n tree.base_class.where Hash[tree.columns.scope.map { |column| [column, record[column]] }]\n else\n tree.base_class.where(nil)\n end\n end",
"def query_scope\n record_class.public_send(include_strategy, included_associations)\n end",
"d... | [
"0.7148998",
"0.64643216",
"0.64568007",
"0.63471353",
"0.6326492",
"0.6310715",
"0.63084096",
"0.6305644",
"0.6302728",
"0.62597144",
"0.6249588",
"0.62337464",
"0.6162296",
"0.6146726",
"0.61345094",
"0.60563767",
"0.60531634",
"0.60355836",
"0.6028249",
"0.60250396",
"0.59... | 0.0 | -1 |
in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`. | def two_sum(nums)
contents = {}
nums.each_with_index do |num, i|
if !contents[-num].nil?
return [contents[-num], i]
elsif contents[num].nil?
contents[num] = i
end
end
return nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pairs_to_zero(nums)\n\n count = 0\n newArr = []\n\n for i in 0..nums.length do\n for j in 1..nums.length do\n if nums[i].to_i + nums[j].to_i == 0\n count = count + 1\n end\n end\n end\n return count-2\nend",
"def pair_zeros(arr)\n arr.select.eac... | [
"0.76356614",
"0.7354314",
"0.7276524",
"0.7163968",
"0.7158269",
"0.7103566",
"0.7062792",
"0.6971821",
"0.69599843",
"0.6949721",
"0.6942954",
"0.6920379",
"0.6908723",
"0.6874946",
"0.6856418",
"0.6856418",
"0.6856418",
"0.6845301",
"0.68448603",
"0.6819518",
"0.68162817",... | 0.0 | -1 |
Confirm a user by setting it's sms_confirmed_at to actual time. If the user is already confirmed, add en error to email field | def confirm_sms!
unless_sms_confirmed do
self.sms_confirmation_token = nil
self.sms_confirmed_at = Time.now
save(:validate => false)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_email\n\t user = User.find_by(confirm_token: user_params[:confirm_token])\n\t if user\n\t \t# Reset all the actions\n\t\t\tuser.email_confirmed = true\n\t\t\tuser.confirm_token = \"\"\n\t\t\tuser.save\t\n\t\t\trender json: {\n\t\t\t\tstatus: 'success',\n\t\t\t\tmessage: 'Account successfully c... | [
"0.73929834",
"0.70135266",
"0.69875526",
"0.69561535",
"0.693804",
"0.6829038",
"0.68280697",
"0.67298347",
"0.6720173",
"0.6709073",
"0.6601092",
"0.6596236",
"0.6554736",
"0.6544877",
"0.6539704",
"0.6528349",
"0.64995676",
"0.64774305",
"0.642226",
"0.6418411",
"0.6399658... | 0.7357662 | 1 |
Verifies whether a user is smsconfirmed or not | def confirmed_sms?
!!sms_confirmed_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_confirmation_required?\n !confirmed_sms?\n end",
"def sms_confirmed?\n return false if txter_sms_confirmed_phone_number.blank?\n txter_sms_confirmed_phone_number == txter_sms_phone_number\n end",
"def confirm_sms!\n unless_sms_confirmed do\n self.sms_confirm... | [
"0.8194521",
"0.798719",
"0.753842",
"0.7483587",
"0.6852698",
"0.66935676",
"0.6680342",
"0.66783",
"0.66328216",
"0.66129464",
"0.660056",
"0.65482026",
"0.6539077",
"0.65302217",
"0.6508624",
"0.6489647",
"0.64650846",
"0.6453565",
"0.64282864",
"0.6420304",
"0.6377447",
... | 0.79176056 | 2 |
Send confirmation token by sms | def send_sms_token
if(self.phone?)
generate_sms_token! if self.sms_confirmation_token.nil?
::Devise.sms_sender.send_sms(self.phone, I18n.t(:"devise.sms_activations.sms_body", :sms_confirmation_token => self.sms_confirmation_token, :default => self.sms_confirmation_token))
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sms_confirmation_token\n generate_small_token(:sms_confirmation_token)\n end",
"def send_confirmation_sms\n SmsApi.send_sms \"+1#{self.phone}\", \"Your confirmation code for StreetEats is #{self.phone_confirmation_code}\"\n end",
"def confirm_by_sms_token(sms_confirmation_token)\n ... | [
"0.79774237",
"0.7557814",
"0.7422649",
"0.7283138",
"0.726094",
"0.72505796",
"0.72212607",
"0.7136478",
"0.7116454",
"0.7066649",
"0.6749417",
"0.6720345",
"0.6693139",
"0.667039",
"0.6562636",
"0.653737",
"0.65227336",
"0.64926696",
"0.6424587",
"0.64181185",
"0.6413461",
... | 0.75833714 | 1 |
Resend sms confirmation token. This method does not need to generate a new token. | def resend_sms_token
unless_sms_confirmed { send_sms_token }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resend_token\n @user = TempUser.find_by(username: params[:username])\n if @user.present?\n @user.generate_confirmation_instructions\n @user.save\n send_confirmation_email\n render json: { status: 'Confirmation token was resent to your email' }, status: :ok\n else\n render json... | [
"0.7202349",
"0.696414",
"0.6741771",
"0.67333597",
"0.6709146",
"0.6630527",
"0.6502466",
"0.65021145",
"0.6482225",
"0.64399",
"0.6395651",
"0.6350542",
"0.6333263",
"0.63179654",
"0.62685406",
"0.62612593",
"0.6253426",
"0.6236403",
"0.6197283",
"0.6115901",
"0.6114039",
... | 0.8796082 | 0 |
Overwrites active_for_authentication? from Devise::Models::Activatable for sms confirmation by verifying whether a user is active to sign in or not. If the user is already confirmed, it should never be blocked. Otherwise we need to calculate if the confirm time has not expired for this user. | def active_for_authentication?
super && (!sms_confirmation_required? || confirmed_sms? || confirmation_sms_period_valid?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_for_authentication?\n confirmed? || confirmation_period_valid?\n end",
"def active_for_authentication?\n super && (!confirmation_required? || confirmed? || confirmation_period_valid?)\n end",
"def active?\n super && (!confirmation_required? || confirmed? || confirmation_period_val... | [
"0.7446536",
"0.7091453",
"0.691004",
"0.6822692",
"0.6757271",
"0.66851526",
"0.66851526",
"0.66851526",
"0.66845536",
"0.6675066",
"0.6619048",
"0.6586687",
"0.6578634",
"0.65756375",
"0.6571342",
"0.65553534",
"0.6553925",
"0.64821124",
"0.64471877",
"0.63816893",
"0.63816... | 0.7455347 | 0 |
The message to be shown if the account is inactive. | def inactive_message
sms_confirmation_required? && !confirmed_sms? ? :unconfirmed_sms : super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inactive_message\n \"This account has been deactivated or doesn't have account.\"\n end",
"def inactive_message\n 'Sorry, this account has been deactivated.'\n end",
"def inactive_message\n\t\t\"Sorry, this account not active by admin. Will Contact you soon.\"\n\tend",
"def inactive_message\n ... | [
"0.90128165",
"0.86811996",
"0.86287445",
"0.8550559",
"0.8544819",
"0.8518236",
"0.8407183",
"0.83947265",
"0.83758",
"0.81164193",
"0.8071383",
"0.8041388",
"0.80346483",
"0.80346483",
"0.79294086",
"0.77010936",
"0.76889545",
"0.76551366",
"0.76446146",
"0.76169956",
"0.76... | 0.74454343 | 40 |
If you don't want confirmation to be sent on create, neither a code to be generated, call skip_sms_confirmation! | def skip_sms_confirmation!
self.sms_confirmed_at = Time.now
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_sms!\n unless_sms_confirmed do\n self.sms_confirmation_token = nil\n self.sms_confirmed_at = Time.now\n save(:validate => false)\n end\n end",
"def send_code_again\n current_user.send_confirmation_sms\n end",
"def send_confirmation_sms\n SmsApi.s... | [
"0.772542",
"0.766492",
"0.75416154",
"0.73610926",
"0.73610926",
"0.7352023",
"0.7352023",
"0.72915465",
"0.72816086",
"0.7124795",
"0.71121216",
"0.7111457",
"0.7075751",
"0.7048831",
"0.7034135",
"0.6988069",
"0.69523054",
"0.6922343",
"0.6910593",
"0.68800986",
"0.6869843... | 0.74297494 | 3 |
Callback to overwrite if an sms confirmation is required or not. | def sms_confirmation_required?
!confirmed_sms?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_sms!\n unless_sms_confirmed do\n self.sms_confirmation_token = nil\n self.sms_confirmed_at = Time.now\n save(:validate => false)\n end\n end",
"def unless_sms_confirmed\n unless confirmed_sms?\n yield\n else\n self.... | [
"0.7502146",
"0.7354509",
"0.7070123",
"0.69568104",
"0.6861887",
"0.6646021",
"0.6615891",
"0.6583039",
"0.65484273",
"0.65029186",
"0.6478385",
"0.6475276",
"0.64681756",
"0.6444048",
"0.6444048",
"0.64268774",
"0.64264596",
"0.6422292",
"0.63841903",
"0.6381838",
"0.633476... | 0.80441093 | 0 |
Checks if the confirmation for the user is within the limit time. We do this by calculating if the difference between today and the confirmation sent date does not exceed the confirm in time configured. Confirm_in is a model configuration, must always be an integer value. Example: sms_confirm_within = 1.day and sms_con... | def confirmation_sms_period_valid?
confirmation_sms_sent_at && confirmation_sms_sent_at.utc >= self.class.sms_confirm_within.ago
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirmation_period_valid?\n self.class.allow_inactivated_access_for.nil? || (confirmation_sent_at && confirmation_sent_at.utc >= self.class.allow_inactivated_access_for.ago)\n end",
"def confirmation_period_expired?\n self.class.activate_within && self.confirmation_sent_at && (Time.now > ... | [
"0.62687993",
"0.61293185",
"0.5679362",
"0.56628007",
"0.55132246",
"0.55132246",
"0.5476812",
"0.5469343",
"0.5418844",
"0.54000217",
"0.5364096",
"0.52665347",
"0.5205422",
"0.5164456",
"0.51383626",
"0.5087624",
"0.50659555",
"0.5047203",
"0.50096476",
"0.50084096",
"0.50... | 0.67658603 | 0 |
Checks whether the record is confirmed or not, yielding to the block if it's already confirmed, otherwise adds an error to email. | def unless_sms_confirmed
unless confirmed_sms?
yield
else
self.class.sms_confirmation_keys.each do |key|
self.errors.add(key, :sms_already_confirmed)
end
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_any_confirmation\n if (!confirmed? || pending_reactivation?)\n yield\n else\n self.errors.add(:phone, :already_confirmed)\n false\n end\n end",
"def only_if_unconfirmed\n\t pending_any_confirmation {yield}\n end",
"def only_if_unconfirmed\n p... | [
"0.7151384",
"0.6559146",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.6496296",
"0.64962184",
"0.6417907",
... | 0.64071435 | 25 |
Generates a new random token for confirmation, and stores the time this token is being generated | def generate_sms_token
self.sms_confirmed_at = nil
self.sms_confirmation_token = self.class.sms_confirmation_token
self.confirmation_sms_sent_at = Time.now.utc
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token\n self.perishable_token = Digest::MD5.hexdigest(\"#{Time.now}\")\n end",
"def regenerate\n self.token = UUIDTools::UUID.random_create.to_s\n reset_timer\n self.token\n end",
"def generate_token\n self.update({:token => SecureRandom.hex})\n end",
"def generate_toke... | [
"0.81946266",
"0.7830005",
"0.7694117",
"0.7685337",
"0.76725733",
"0.76137495",
"0.76079607",
"0.76079607",
"0.76079607",
"0.75796753",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.7578016",
"0.757801... | 0.69447845 | 92 |
Find a user by it's sms confirmation token and try to confirm it. If no user is found, returns a new user with an error. If the user is already confirmed, create an error for the user Options must have the sms_confirmation_token | def confirm_by_sms_token(sms_confirmation_token)
sms_confirmable = find_or_initialize_with_error_by(:sms_confirmation_token, sms_confirmation_token)
sms_confirmable.confirm_sms! if sms_confirmable.persisted?
sms_confirmable
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def confirm_user\n @user = User.find_by_confirmation_token(params[:user][:confirmation_token])\n if @user.blank?\n render :confirm_user_failed\n return\n end \n # Slim down the hash I send to Devise to avoid Mass-Update-problems:\n params_user = {'name' => params[:user][:name], \n ... | [
"0.6744905",
"0.67171764",
"0.66993296",
"0.6684382",
"0.66342616",
"0.6446842",
"0.63343436",
"0.63079524",
"0.62522453",
"0.61788726",
"0.6112171",
"0.6095454",
"0.6024125",
"0.6005296",
"0.59683853",
"0.59627223",
"0.59551734",
"0.59156644",
"0.5867612",
"0.58616495",
"0.5... | 0.71232724 | 0 |
Generates a small token that can be used conveniently on SMS's. The token is 5 chars long and uppercased. | def generate_small_token(column)
loop do
token = Devise.friendly_token[0,5].upcase
break token unless to_adapter.find_first({ column => token })
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n token = (0...50).map { o[rand(o.length)] }.join\n return token\n end",
"def generate_token(size)\n validity = Proc.new {|token| Token.where(:token => token).first.nil?}\n\n begin\n token = SecureRando... | [
"0.77761596",
"0.7532319",
"0.74762464",
"0.7310565",
"0.73085713",
"0.7245307",
"0.7229834",
"0.71144515",
"0.71057445",
"0.7092709",
"0.7088139",
"0.70791274",
"0.69880646",
"0.6982723",
"0.69670916",
"0.6959357",
"0.6903077",
"0.6817395",
"0.68109196",
"0.6785372",
"0.6775... | 0.6756585 | 21 |
Generate an sms token checking if one does not already exist in the database. | def sms_confirmation_token
generate_small_token(:sms_confirmation_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_token\n if self.token.nil?\n self.token = loop do\n random_token = \"BON-#{SecureRandom.uuid.split('-').first}\"\n break random_token unless self.class.exists?(token: random_token)\n end\n end\n end",
"def generate_token\n unless self.token\n self.token = loop do... | [
"0.7641251",
"0.74920964",
"0.74503803",
"0.73455256",
"0.7166834",
"0.7078746",
"0.7043866",
"0.70281863",
"0.69975233",
"0.69937474",
"0.69725996",
"0.6942322",
"0.6939649",
"0.6935321",
"0.6927357",
"0.68913686",
"0.68868256",
"0.687521",
"0.6844621",
"0.6841995",
"0.68309... | 0.70207363 | 8 |
This is true if this shift is dropped. This is false if it's been picked up or never was dropped. | def pending_pickup?
@is_pending_pickup
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dropped?\n status == :dropped\n end",
"def dropped?\n return (@terminate_count != nil)\n end",
"def shift?\n @shift\n end",
"def _drop\n true\n end",
"def being_removed?(item)\n state_group(item) == :remove\n end",
"def recording?\n @decision != Decision::DROP\n... | [
"0.695173",
"0.6778005",
"0.6697234",
"0.64717025",
"0.62403494",
"0.62249005",
"0.6019245",
"0.60191333",
"0.5971137",
"0.58964604",
"0.58727306",
"0.5856535",
"0.58540285",
"0.57801765",
"0.57490575",
"0.57023305",
"0.569671",
"0.5692732",
"0.5679245",
"0.567535",
"0.567182... | 0.0 | -1 |
If the shift is waiting for the manager to approve it. | def pending_manager_approval?
@is_pending_manager_approval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pending_swap_manager_approval?\n @is_pending_swap_manager_approval\n end",
"def approval_requested?\n !([STATE_UNKNOWN, STATE_BLOCK_REQUESTED, STATE_BLOCKED, STATE_UNAVAILABLE, STATE_CANCELLED, STATE_EXPIRED, STATE_AVAILABLE_EXPIRED].include?(self.state))\n end",
"def escalate_approval\n if !sel... | [
"0.7161018",
"0.70375085",
"0.6878566",
"0.6805906",
"0.6632763",
"0.6598768",
"0.6463834",
"0.6398126",
"0.6308715",
"0.62840056",
"0.6282799",
"0.6273088",
"0.6266849",
"0.625389",
"0.62504333",
"0.619469",
"0.61946684",
"0.6183255",
"0.61723655",
"0.6161639",
"0.61388075",... | 0.70023274 | 2 |
When a shift is swapped with someone, it waits for them to accept or deny. Until that happens, this is true. | def pending_swap?
@is_pending_swap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cpu_prevent\n current_turn = @state[:turn]\n @state[:turn] = current_turn == PLAYER_1_TURN ? PLAYER_2_TURN : PLAYER_1_TURN # pretend to be other player\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET\n board_remove_token(c) # remove the win... | [
"0.57382095",
"0.5541252",
"0.547043",
"0.54513067",
"0.5441394",
"0.541389",
"0.5381175",
"0.53799915",
"0.53087795",
"0.52993417",
"0.5288528",
"0.5284385",
"0.5271424",
"0.5260292",
"0.5257396",
"0.5251245",
"0.5240268",
"0.52189946",
"0.52029896",
"0.5195967",
"0.5190715"... | 0.0 | -1 |
When the shift swap is approved, the manager needs to approve it. Until this happens, this is true. | def pending_swap_manager_approval?
@is_pending_swap_manager_approval
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_approval\n self.sanctuary? ? self.approved = false : self.approved = true\n end",
"def on_pending_entry(prev_state, event)\n if self.cart.all_approvals_received?\n self.approve!\n end\n end",
"def pending_swap?\n @is_pending_swap\n end",
"def approve\n @reservation.update_attri... | [
"0.6277261",
"0.62231857",
"0.62124395",
"0.6161472",
"0.6142068",
"0.6082562",
"0.6046861",
"0.6029519",
"0.59951866",
"0.5928967",
"0.5893438",
"0.58875495",
"0.58807397",
"0.587666",
"0.58245337",
"0.5815975",
"0.5772877",
"0.5748913",
"0.57376283",
"0.57282233",
"0.570957... | 0.6910896 | 0 |
I wonder what happens when this is true. Hopefully it doesn't break. | def hide_end_times?
@hide_end_times
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def semact?; false; end",
"def borked?; @borked; end",
"def check ; true ; end",
"def missed?; end",
"def broken?\n @broken == :broken \n\tend",
"def delicious?\n\t\treturn true\n\tend",
"def dumb?\n false\n end",
"def broken?\n ! not_broken?\n end",
"def check_for_bug!(tracepoint)\n... | [
"0.6722202",
"0.64427286",
"0.63193333",
"0.6310451",
"0.61808485",
"0.61678165",
"0.6145069",
"0.610551",
"0.6082368",
"0.60688925",
"0.60656875",
"0.6056433",
"0.60561186",
"0.6031863",
"0.60255533",
"0.60204613",
"0.59871584",
"0.5974053",
"0.5959485",
"0.5948177",
"0.5939... | 0.0 | -1 |
Overriding this, because we only need titles and ids. | def add_solr_fields_to_query(solr_params)
solr_params['qf'] = 'title_tesim'
solr_params['fl'] = 'id, title_tesim'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_all_titles\n # Interface method\n end",
"def titles\n @title\n end",
"def title\n end",
"def title\n values = super\n values = MetadataHelper.ordered( ordered_values: self.title_ordered, values: values )\n return values\n end",
"def title\n values = super\n ... | [
"0.64931965",
"0.64216924",
"0.63921684",
"0.6376393",
"0.6376393",
"0.63118035",
"0.63118035",
"0.6301741",
"0.6301741",
"0.6301741",
"0.62888765",
"0.6210078",
"0.61934054",
"0.6161733",
"0.6140716",
"0.6101809",
"0.60391325",
"0.60308534",
"0.60308534",
"0.60308534",
"0.60... | 0.0 | -1 |
Removes highlighting and faceting from query. | def no_facets_or_highlight(solr_params)
solr_params['facet'] = false
solr_params.delete('facet.fields')
solr_params.delete('facet.query')
solr_params.delete('facet.pivot')
solr_params.delete('hl.fl')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unhighlight\n perform_action(:delete, 'highlight')\n end",
"def format_query\n output = query.q.dup\n words_to_remove = %w(international airport municipal)\n words_to_remove.each do |word|\n output.gsub!(/#{word}/i, \"\")\n end\n ... | [
"0.679975",
"0.5752689",
"0.57497567",
"0.5733676",
"0.57276005",
"0.5670439",
"0.55783725",
"0.5564592",
"0.5493585",
"0.5475013",
"0.5414191",
"0.53898954",
"0.5313295",
"0.5298013",
"0.52574635",
"0.52384114",
"0.52139187",
"0.51446223",
"0.51329875",
"0.51103896",
"0.5106... | 0.65053236 | 1 |
Returns only a single collection type, defined in initialize. | def limit_by_collection_type(solr_params)
collection_type_gid = @type == "personal" ? personal_gid : course_gid
solr_params[:fq] ||= []
solr_params[:fq] << "collection_type_gid_ssim:\"#{collection_type_gid}\""
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def type\n @type ||= @collection.nil? ? nil : @collection.label.to_sym\n end",
"def collection_type\n Deprecation.warn(\"'##{__method__}' will be removed in Hyrax 4.0. \" \\\n \"Instead, use Hyrax::CollectionType.for(collection: collection).\")\n @collection_type ||= Hy... | [
"0.7983388",
"0.79251814",
"0.7910877",
"0.7414519",
"0.6915601",
"0.6915601",
"0.6779207",
"0.67589",
"0.67073745",
"0.67034984",
"0.669811",
"0.6696833",
"0.66643125",
"0.66643125",
"0.6626024",
"0.66208816",
"0.6619205",
"0.6532164",
"0.6500348",
"0.6485529",
"0.6464216",
... | 0.0 | -1 |
Returns only top level collections (no parents) | def limit_by_parent(solr_params)
solr_params[:fq] ||= []
if(@parent_id.nil?)
solr_params[:fq] << "!(member_of_collection_ids_ssim:*)"
else
solr_params[:fq] << "member_of_collection_ids_ssim:#{@parent_id}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collections\n return self.root_collection.subcollections\n end",
"def subcollections\n respond_to?(:collectionHasSubcollection) ? collectionHasSubcollection : []\n end",
"def self_or_parent_collections\n if try(:parent).present?\n Wayfinder.for(parent).try(:collectio... | [
"0.77201664",
"0.72058636",
"0.7123248",
"0.68900996",
"0.6878745",
"0.66594833",
"0.65621567",
"0.65584207",
"0.6531466",
"0.6484908",
"0.6456363",
"0.63964856",
"0.6371426",
"0.63370115",
"0.6316835",
"0.629273",
"0.6253582",
"0.6251252",
"0.624998",
"0.62302417",
"0.622113... | 0.0 | -1 |
Returns only collections owned by the current user. | def limit_by_user_if_personal(solr_params)
if(@type == 'personal')
solr_params[:fq] ||= []
solr_params[:fq] << "depositor_tesim:\"#{current_user.username}\""
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_users_collections\n if current_user.respond_to?(:collections)\n current_user.collections.to_a\n else\n Collection.all\n end\n end",
"def index\n @all_collections = Collection.all\n @current_user = User.find_by username: session[:user]\n @collections = []\n @all_collect... | [
"0.7831179",
"0.75828093",
"0.7069939",
"0.692879",
"0.68661594",
"0.6599086",
"0.6585772",
"0.6582697",
"0.65426207",
"0.63716674",
"0.63376623",
"0.6322657",
"0.6286198",
"0.6280226",
"0.61970913",
"0.61740226",
"0.6160789",
"0.6157932",
"0.6154229",
"0.6151305",
"0.6144061... | 0.0 | -1 |
Overrides the default per page, to retrieve everything. | def get_all_items(solr_params)
solr_params['rows'] = 1000000
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def per_page\n nil\n end",
"def index\n respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5))\n end",
"def per_page\n DEFAULT_PAGE_SIZE\n end",
"def all(per_page = 100)\n @search.per_page(per_page).fetch\n end",
"def per_page\... | [
"0.70026064",
"0.6941058",
"0.6857296",
"0.68477863",
"0.68077713",
"0.67792994",
"0.6725748",
"0.6663406",
"0.6588243",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6583814",
"0.6563221",
"0.65490353"... | 0.0 | -1 |
Routines for Google Drive | def get_google_drive_app_name()
app_name = "Google Drive"
return app_name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ruby_gdrive\n def authorize\n FileUtils.mkdir_p(File.dirname(CREDENTIALS_PATH))\n\n file_store = Google::APIClient::FileStore.new(CREDENTIALS_PATH)\n storage = Google::APIClient::Storage.new(file_store)\n auth = storage.authorize\n\n if auth.nil? || (auth.expired? && auth.refresh_token.nil?)\n ... | [
"0.7830131",
"0.67101896",
"0.6596648",
"0.6495064",
"0.623913",
"0.6105636",
"0.6022003",
"0.6009375",
"0.59771097",
"0.59694284",
"0.5963113",
"0.59562236",
"0.5951664",
"0.5905017",
"0.5844953",
"0.584405",
"0.5822939",
"0.5812169",
"0.5807923",
"0.5790236",
"0.5787637",
... | 0.58309007 | 16 |
Process text input It takes a string input, then returns the result as a string | def process(long_text)
result = ""
symbol_array = long_text.split
symbol_array.each do |text|
# see if it is one of our commands
if RpnCalculator::VALID_OPS.include?(text)
# catch in case there are not enough arguments on stack
begin
result = @calc.public_send(text)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text(string); end",
"def text(string); end",
"def text(str); end",
"def input_string; end",
"def process\n @string\n end",
"def text_input; end",
"def process_string(str)\r\n process(StringSource.new(str))\r\n end",
"def input_text\n with_input_io{|io| io.readlines.join... | [
"0.7435779",
"0.7435779",
"0.74077666",
"0.731223",
"0.71813",
"0.7154613",
"0.6872412",
"0.6769733",
"0.6714013",
"0.6693579",
"0.6648071",
"0.6630196",
"0.6593588",
"0.64717096",
"0.6317697",
"0.6163904",
"0.6163904",
"0.61336577",
"0.6107352",
"0.60916895",
"0.606869",
"... | 0.0 | -1 |
FIXME: This is a temporary fix as the RHEL7 AMI should have this registry here already. | def fix_insecure_registry_cmd(registry_url)
%{
cat <<EOF > /etc/sysconfig/docker
OPTIONS='--insecure-registry #{registry_url} --selinux-enabled'
EOF
systemctl restart docker
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def registry\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Sys::Registry)\n\tend",
"def registry\n @registry ||= {}\n end",
"def registry; end",
"def registry; end",
"def registry\n @registry\n end",
"def registry\n @registry ||= client.registry\n end",
"def class\n ... | [
"0.7002574",
"0.6899902",
"0.679417",
"0.679417",
"0.67243093",
"0.66400236",
"0.65258855",
"0.63708764",
"0.6324239",
"0.6295471",
"0.62525785",
"0.6241116",
"0.6239846",
"0.6172195",
"0.61403155",
"0.61326",
"0.61270285",
"0.60345167",
"0.5959409",
"0.59235907",
"0.5920995"... | 0.5040315 | 88 |
GET /venues/1 GET /venues/1.json def detailed_info | def show
# respond_to do |format|
# format.html # show.html.erb
# format.json { render json: @venue }
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def venue(id)\n options = { :venue_id => id }\n get('/venue_info', options)\n end",
"def show\n @venue = Venue.find(params[:id])\n\n render json: @venue\n end",
"def show\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n form... | [
"0.72102684",
"0.7036989",
"0.7035927",
"0.70081955",
"0.6947151",
"0.68918097",
"0.67328954",
"0.6703107",
"0.6693227",
"0.6678941",
"0.6620355",
"0.65657884",
"0.65657884",
"0.65497607",
"0.6545855",
"0.6545855",
"0.6545855",
"0.6523604",
"0.65068626",
"0.64840585",
"0.6473... | 0.67212594 | 7 |
GET /venues/new GET /venues/new.json | def new
@venue = Venue.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @venue }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @venue = Venue.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @venue }\n end\n end",
"def new\n @manage_venue = Venue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manage_ven... | [
"0.7627383",
"0.73514384",
"0.72909975",
"0.7246993",
"0.721756",
"0.721756",
"0.721215",
"0.71834177",
"0.71834177",
"0.71834177",
"0.7122522",
"0.71196777",
"0.71196777",
"0.7083836",
"0.7080381",
"0.7051934",
"0.703015",
"0.7003108",
"0.69957185",
"0.6988361",
"0.6982259",... | 0.7625751 | 4 |
POST /venues POST /venues.json | def create
@venue = Venue.create_with(params[:venue].permit(:lat,:lng)).find_or_create_by(params[:venue].permit(:place_id))
respond_to do |format|
if @venue.save
format.html { redirect_to venues_path}
format.json { render json: @venue, status: :created }
end
end
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n #create venues trought users controller\n end",
"def create\n @venue = Venue.new(venue_params)\n\n if @venue.save\n render json: @venue, status: :created, location: @venue\n else\n render json: {errors: @venue.errors}, status: :unprocessable_entity\n end\n end",
"def my_... | [
"0.6653711",
"0.6587449",
"0.6581765",
"0.6262751",
"0.6237925",
"0.62362003",
"0.62362003",
"0.62359476",
"0.6219155",
"0.62095016",
"0.61525834",
"0.6103657",
"0.60696125",
"0.60696125",
"0.60626173",
"0.602209",
"0.60196996",
"0.6015609",
"0.60067767",
"0.59807426",
"0.597... | 0.55572563 | 67 |
PUT /venues/1 PUT /venues/1.json | def update
@venue = Venue.find(params[:id])
respond_to do |format|
if @venue.update_attributes(params[:venue])
format.html { redirect_to @venue, notice: 'Venue was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
fo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @venue = Venue.find(params[:id])\n\n respond_to do |format|\n if @venue.update_attributes(params[:venue])\n format.html { redirect_to @venue, :notice => 'Venue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => ... | [
"0.6818521",
"0.6792671",
"0.6781689",
"0.65337276",
"0.65337276",
"0.65337276",
"0.6532322",
"0.6526919",
"0.65070313",
"0.65063053",
"0.65002483",
"0.6486718",
"0.6486718",
"0.6451402",
"0.638308",
"0.6351504",
"0.63456404",
"0.6331346",
"0.6304584",
"0.62704766",
"0.623352... | 0.6794064 | 2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.