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 |
|---|---|---|---|---|---|---|
Apply default options to given +add_table+ block statement. See +set_defaults+ for detailed explanation. | def apply_defaults( table_name, name, *args )
opts = {}
opts.merge!( get_defaults( :global ) )
if name[ -1 ] == '?'
opts[ :null ] = true
original_name = name
name = name[ 0..-2 ].to_sym
end
opts.merge!( get_defaults( name ) )
opts.merge!( get_defaults( origi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_table(hash, options={})\n @main_doc.add_table(create_table_fragment(hash, options))\n end",
"def method_missing(table, *columns)\n table_settings[table] = columns\n end",
"def create_table(*args, &block)\n apply_translatable_option!(:create_table, block, *args) do |de... | [
"0.59226614",
"0.5863273",
"0.58255184",
"0.58101577",
"0.57860607",
"0.57701254",
"0.5728642",
"0.5717143",
"0.5713542",
"0.56777865",
"0.5604476",
"0.5601917",
"0.55893874",
"0.5562901",
"0.5500903",
"0.5489017",
"0.5484983",
"0.54670054",
"0.5455746",
"0.5426925",
"0.54072... | 0.6354081 | 0 |
Dump table definition to given output. | def dump( out = Dumper.new )
for table in tables
table.dump( out )
end
out
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dump( out = Dumper.new )\n out.dump \"table #{out_name}\" do\n for column in columns\n column.dump( out )\n end\n for index in indexes\n index.dump( out )\n end\n for foreign_key in foreign_keys\n foreign_key.dump( out )\n ... | [
"0.7657854",
"0.7149362",
"0.6905634",
"0.6772581",
"0.6589981",
"0.6437448",
"0.6419542",
"0.63311404",
"0.6303169",
"0.6197529",
"0.6195435",
"0.61665475",
"0.6119507",
"0.6075815",
"0.60756487",
"0.60481167",
"0.6046823",
"0.60223466",
"0.6020591",
"0.59550065",
"0.5934567... | 0.7372447 | 1 |
Define schema with the provided block. | def define( &block )
fail( ArgumentError, "missing schema block" ) unless block
set_standard_defaults unless opts[ :use_defaults ] == false
instance_eval &block
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_schema\n yield schema if block_given?\n end",
"def define_json_schema(&block)\n mapping = Mapping.new\n\n mapping.instance_eval(&block)\n\n @index_schema = create_schema(mapping.mapping)\n end",
"def define( opts = {}, &block )\n sync do\n set_schema... | [
"0.7929",
"0.7410716",
"0.7340941",
"0.703995",
"0.66569257",
"0.6626277",
"0.65525097",
"0.6508372",
"0.6314608",
"0.62188065",
"0.61957186",
"0.615551",
"0.61160135",
"0.61013514",
"0.6008229",
"0.5813297",
"0.5803827",
"0.5793452",
"0.5785685",
"0.57818216",
"0.5777537",
... | 0.77113456 | 1 |
Get default schema options. | def default_options
sync{ @opts || {} }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default_options\n option_type_config_for :default\n end",
"def default_options\n DEFAULT_OPTIONS\n end",
"def default_schema\n nil\n end",
"def default_schema\n # TODO: add parsing of available tags and measurements to put together\n # a default schema\n nil\n en... | [
"0.74739003",
"0.7452784",
"0.74052954",
"0.7250202",
"0.7040496",
"0.7027419",
"0.70170724",
"0.68858784",
"0.68814456",
"0.68812054",
"0.68812054",
"0.6835457",
"0.6835457",
"0.6835457",
"0.67588437",
"0.6702541",
"0.6702541",
"0.6702541",
"0.6674945",
"0.66601753",
"0.6560... | 0.6292354 | 30 |
Set default schema options. | def default_options=( opts )
sync{ @opts = opts.nil? ? nil : opts.dup }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_options\n end",
"def default_schema\n nil\n end",
"def set_schema(schema)\n define_class_method(:schema) {schema.to_s.to_sym}\n end",
"def set_default_values\n h = {}\n if @db_schema\n @db_schema.each do |k, v|\n if v[:callable_... | [
"0.72123337",
"0.6883939",
"0.6692348",
"0.66259027",
"0.6580946",
"0.65661937",
"0.6539646",
"0.64953744",
"0.64352113",
"0.64013726",
"0.6355481",
"0.63547534",
"0.63305503",
"0.628991",
"0.62657565",
"0.62657565",
"0.62657565",
"0.62352616",
"0.6232925",
"0.61655957",
"0.6... | 0.57098836 | 74 |
Define schema with provided block. | def define( opts = {}, &block )
sync do
set_schema( new( opts ).define( &block ) )
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_schema\n yield schema if block_given?\n end",
"def define( &block )\n fail( ArgumentError, \"missing schema block\" ) unless block\n set_standard_defaults unless opts[ :use_defaults ] == false\n instance_eval &block\n self\n end",
"def define_json_schema(&block)\n ... | [
"0.8011023",
"0.7754125",
"0.7414366",
"0.71309423",
"0.6772828",
"0.6724922",
"0.6613905",
"0.6574636",
"0.63989186",
"0.6326707",
"0.6290051",
"0.6174515",
"0.61331105",
"0.6127504",
"0.603",
"0.5937549",
"0.59089553",
"0.5892386",
"0.5875619",
"0.5875282",
"0.58229935",
... | 0.73914635 | 3 |
Load schema from given file. | def load( name, opts = {} )
name = File.expand_path( name )
sync do
get_schema do
with_options( opts ) do
Kernel.load( name )
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_schema(file)\n end",
"def schema(name_or_file)\n DbAgile::Core::Schema::yaml_file_load(schema_file(name_or_file))\n end",
"def load(schema)\n require schema\n end",
"def schema_contents\n File.read(schema_path)\n end",
"def initialize(filename=nil)\n self.load... | [
"0.8931736",
"0.7793272",
"0.7350421",
"0.69245625",
"0.68360543",
"0.6822027",
"0.66689986",
"0.65529156",
"0.6386335",
"0.6354093",
"0.62857807",
"0.6279261",
"0.6228028",
"0.620048",
"0.6169714",
"0.615077",
"0.610648",
"0.610648",
"0.60861385",
"0.6079053",
"0.6078088",
... | 0.60498625 | 21 |
Serialize access to thread sensitive variables. | def sync( &block )
LOCK.synchronize &block
rescue ThreadError
yield
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_data\n Thread.current[THREAD_LOCAL_NAME] ||= {}\n end",
"def serialiaze\n Logger.d(\"Serializing the User object\")\n save_to_shared_prefs(@context, self.class, self)\n end",
"def serialize_for_session\n @serialized_data ||= serialize_object_for_session\n end",
"def mar... | [
"0.5994346",
"0.59704006",
"0.5934439",
"0.5875284",
"0.5721684",
"0.5399572",
"0.5359042",
"0.5338786",
"0.5332871",
"0.53318876",
"0.53211653",
"0.5239466",
"0.5225242",
"0.52221566",
"0.5198387",
"0.51928985",
"0.5157129",
"0.51511055",
"0.51486987",
"0.5147108",
"0.513768... | 0.0 | -1 |
Store given schema for later if requested. | def set_schema( schema )
@schema = schema if @schema == self
schema
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_schema(schema)\n @current_schema = nil\n execute \"SET SCHEMA #{schema}\", 'SCHEMA'\n end",
"def schema= new_schema\n frozen_check!\n @schema = new_schema\n end",
"def schema= new_schema\n frozen_check!\n @schema = new_schema\n ... | [
"0.6730089",
"0.66723657",
"0.66723657",
"0.66723657",
"0.6632858",
"0.6556989",
"0.6545676",
"0.64499843",
"0.6402984",
"0.6402984",
"0.6401591",
"0.6353814",
"0.6285704",
"0.61596996",
"0.6047161",
"0.6023761",
"0.5889748",
"0.58109736",
"0.57798547",
"0.5779108",
"0.571313... | 0.717849 | 0 |
Execute given block and return stored schema. | def get_schema
@schema = self
yield
@schema unless @schema == self
ensure
@schema = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(&block)\n original_path = @connection.schema_search_path\n set_path_if_required(@schema)\n yield\n ensure\n set_path_if_required(original_path)\n end",
"def define_schema\n yield schema if block_given?\n end",
"def execute(&block)\n TempTableContext.with_context(d... | [
"0.6300235",
"0.6250565",
"0.6024849",
"0.6002712",
"0.5867261",
"0.583959",
"0.5732258",
"0.5699662",
"0.5699662",
"0.565487",
"0.5653986",
"0.5653986",
"0.56116176",
"0.5546764",
"0.55317026",
"0.5527411",
"0.55179024",
"0.5504203",
"0.5503378",
"0.5503378",
"0.5503378",
... | 0.5572324 | 13 |
Execute block with given options. | def with_options( opts )
saved, @opts = @opts, default_options.merge(opts)
yield
ensure
@opts = saved
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run(context, options = {})\n #@block.call(options)\n\n if @options[:defaults]\n options = @options[:defaults].merge(options)\n end\n\n context.instance_exec(options, &@block)\n end",
"def block\n options.fetch(:block)\n end",
... | [
"0.72137445",
"0.7209027",
"0.6993103",
"0.6912243",
"0.6838919",
"0.6767368",
"0.67424834",
"0.6725768",
"0.67050314",
"0.6628528",
"0.6623775",
"0.6623541",
"0.6623541",
"0.65847325",
"0.65847325",
"0.6568304",
"0.6559574",
"0.6502155",
"0.65017456",
"0.65016484",
"0.650164... | 0.0 | -1 |
HOST PROBES system_host: monitor "static" vCenter cluster information monitor_host: monitor dynamic vCenter cluster information | def system_host
monitor_str = cluster_info
monitor_str += hosts_info
monitor_str += customizations_info
monitor_str += datastore_info
monitor_str += vms_info('wild')
monitor_str += nsx_info_vcenter
monitor_str += nsx_info
monitor_str
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\... | [
"0.7427361",
"0.68844205",
"0.6545374",
"0.63753957",
"0.63614655",
"0.62247705",
"0.6160977",
"0.60960585",
"0.59563863",
"0.594524",
"0.5896867",
"0.5851704",
"0.5841646",
"0.5832881",
"0.5827357",
"0.579003",
"0.57545865",
"0.5752916",
"0.57184625",
"0.57176936",
"0.569545... | 0.67823243 | 2 |
Try connectivity to a vCenter instance and close the connection | def beacon_host
@vic.vim.serviceContent.about.instanceUuid
Time.now.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def with_vsphere_connection(&block)\n vim = nil\n dc = nil\n\n tries = 0\n begin\n timeout(vmconf[:connect_timeout]) do\n vim = RbVmomi::VIM.connect(\n :host => vmconf[:host],\n :user => vmconf[:user],\n :password => vmconf[:pass],\n :... | [
"0.705931",
"0.67085695",
"0.6234885",
"0.60791564",
"0.5851705",
"0.5806412",
"0.5781692",
"0.5723104",
"0.56981844",
"0.569376",
"0.56851834",
"0.56789017",
"0.5678774",
"0.5663308",
"0.5603523",
"0.5580883",
"0.55236715",
"0.5514989",
"0.5452838",
"0.53942674",
"0.53804636... | 0.0 | -1 |
VM PROBES state_vm: monitor vm state changes monitor_vm: monitor dynamic VM information vcenter_vms_state: retrieves state hash consulting vCenter | def monitor_vm
vms_info('one')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vcenter_vms_state\n vc_uuid = @vic.vim.serviceContent.about.instanceUuid\n\n view = @vic.vim\n .serviceContent\n .viewManager\n .CreateContainerView(\n {\n :container => @cluster.item,\n ... | [
"0.80027455",
"0.7555783",
"0.7035811",
"0.6993082",
"0.6941334",
"0.6712825",
"0.67098165",
"0.66984713",
"0.65743434",
"0.6550677",
"0.65468943",
"0.65213555",
"0.64188427",
"0.63688624",
"0.6365992",
"0.63070047",
"0.6301273",
"0.62269574",
"0.6211152",
"0.61514384",
"0.60... | 0.6884221 | 5 |
Given a deploy_id (vm_ref in vCenter) and a state, check if a VM has changed state compared with the latest known state | def need_state_sync?(vm_ref, state)
!@previous_vm_states[vm_ref] or !@previous_vm_states[vm_ref][:state].eql? state
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_state(state, deploy_id)\n ready = (state == 'stopped') || (state == 'pending') || (state == 'running') || (state == 'terminated')\n raise \"Waiting for an invalid state\" if !ready\n t_init = Time.now\n begin\n wstate = get_instance(deploy_id).state.name rescue nil\n... | [
"0.6314104",
"0.6033517",
"0.59436494",
"0.5941676",
"0.5736977",
"0.5729927",
"0.56594324",
"0.55513924",
"0.54516923",
"0.542225",
"0.54114634",
"0.540816",
"0.5407725",
"0.5407725",
"0.5372412",
"0.5369714",
"0.5290347",
"0.5239016",
"0.52266604",
"0.52239764",
"0.5223295"... | 0.6223453 | 1 |
Return monitoring string containig the state of VMs | def state_vm
current_vm_states = vcenter_vms_state
# Check if we need a full sync
full_sync = false
now = Time.now.to_i
if @last_sync.nil? || ((now - @last_sync) > VM_SYNC_TIME)
full_sync = true
@last_sync = now
end
str_info = ''
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_str\n VM_STATE[state]\n end",
"def state_str\n VM_STATE[state]\n end",
"def state(vm_name)\n `VBoxManage showvminfo #{vm_name}` =~ /^State:\\s+(.*)$/ ? $1 : 'unknown'\n end",
"def info\n return 'STATE=d' if @state == 'd'\n\n if @vm.vm_in... | [
"0.75816286",
"0.75816286",
"0.74922216",
"0.72462857",
"0.72087145",
"0.6957025",
"0.6945733",
"0.6929984",
"0.69293314",
"0.688411",
"0.6856437",
"0.68487835",
"0.68054533",
"0.6725567",
"0.6716288",
"0.6667279",
"0.66354406",
"0.66208065",
"0.6609627",
"0.6559861",
"0.6545... | 0.70629174 | 5 |
Retrieve all known VM states from vCenter | def vcenter_vms_state
vc_uuid = @vic.vim.serviceContent.about.instanceUuid
view = @vic.vim
.serviceContent
.viewManager
.CreateContainerView(
{
:container => @cluster.item,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def state_vm\n current_vm_states = vcenter_vms_state\n\n # Check if we need a full sync\n full_sync = false\n now = Time.now.to_i\n if @last_sync.nil? || ((now - @last_sync) > VM_SYNC_TIME)\n full_sync = true\n @last_sync = now\n end\n\n str_in... | [
"0.6715074",
"0.6678164",
"0.666488",
"0.6553683",
"0.6531659",
"0.6503574",
"0.6447283",
"0.6412211",
"0.6261237",
"0.62272525",
"0.6193261",
"0.61854357",
"0.61522204",
"0.6135802",
"0.6127082",
"0.6093545",
"0.60898536",
"0.6082492",
"0.60799235",
"0.60796",
"0.5979482",
... | 0.8219695 | 0 |
TODO: Add more than one nsx managers | def nsx_info_vcenter
@nsx_obj = {}
elist = @vic.vim.serviceContent.extensionManager.extensionList
elist.each do |ext_list|
case ext_list.key
when NSXDriver::NSXConstants::NSXV_EXTENSION_LIST
parts = ext_list.client[0].url.split('/')
prot... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsx_info\n nsx_info = ''\n nsx_obj = {}\n # In the future add more than one nsx manager\n extension_list = @vi_client.vim.serviceContent.extensionManager\n .extensionList\n extension_list.each do |ext_list|\n if ext_list.key == NSX... | [
"0.62036157",
"0.62036157",
"0.5930179",
"0.5930179",
"0.5930179",
"0.5930179",
"0.570997",
"0.5498251",
"0.5498251",
"0.54785156",
"0.5360193",
"0.5360193",
"0.5346048",
"0.53459287",
"0.5281947",
"0.5276222",
"0.5227286",
"0.52266866",
"0.5205486",
"0.5197685",
"0.5197685",... | 0.5457511 | 10 |
Get a list vCenter datastores morefs | def datastore_info
dc = @cluster.datacenter
ds = dc.datastore_folder
ds_info = ''
ds.fetch!.each do |ref, _ds|
ds_info << "VCENTER_DS_REF=\"#{ref}\"\n"
end
ds_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_data_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\n ds = []\n ws.each{ |w| ds += w.data_stores if w.data_stores }\n ds\n end",
"def get_wms_stores workspace = nil\n ws = workspace.nil?? get_workspaces : [get_workspace(workspace)]\... | [
"0.67359835",
"0.6472238",
"0.6079075",
"0.60695094",
"0.5895089",
"0.5856196",
"0.5784304",
"0.5736993",
"0.57085925",
"0.5680182",
"0.5650458",
"0.56379044",
"0.5614291",
"0.5605331",
"0.5558869",
"0.5553624",
"0.5549881",
"0.5527799",
"0.55271465",
"0.5507087",
"0.54804325... | 0.5915176 | 4 |
Return monitor string 'wilds': VMs in vCenter but not in OpenNebula 'ones' : VMs in OpenNebula | def vms_info(vm_type)
cmd = "#{File.dirname(__FILE__)}/vcenter_monitor_vms.rb #{@host.id} #{vm_type} \"#{connection[:ccr]}\""
str_info, _stderr, _status = Open3.capture3(cmd)
str_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wilds_to_monitor\n mon_s = ''\n\n @vms.each do |_uuid, vm|\n next if vm[:id] != -1 || vm[:template].empty?\n\n mon_s << \"VM = [ID=\\\"#{vm[:id]}\\\", DEPLOY_ID=\\\"#{vm[:deploy_id]}\\\",\"\n mon_s << \" VM_NAME=\\\"#{vm.name}\\\",\"\n ... | [
"0.6993343",
"0.58487344",
"0.56367844",
"0.5611771",
"0.55992055",
"0.559562",
"0.55654734",
"0.5464486",
"0.5415716",
"0.5318327",
"0.53112864",
"0.5298293",
"0.52473813",
"0.52269137",
"0.51802325",
"0.5178939",
"0.5137716",
"0.50931513",
"0.5081148",
"0.50586283",
"0.5047... | 0.4742997 | 29 |
Return NSX info monitoring | def nsx_info
create_nsx_client = true
nsx_manager = @host['TEMPLATE/NSX_MANAGER'] || @nsx_obj['url']
nsx_user = @host['TEMPLATE/NSX_USER']
nsx_password = @host['TEMPLATE/NSX_PASSWORD']
nsx_type = @host['TEMPLATE/NSX_TYPE'] || @nsx_obj['type']
[nsx_manager, nsx_user, nsx_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nsx_info\n nsx_info = ''\n nsx_obj = {}\n # In the future add more than one nsx manager\n extension_list = @vi_client.vim.serviceContent.extensionManager\n .extensionList\n extension_list.each do |ext_list|\n if ext_list.key == NSX... | [
"0.7536023",
"0.7536023",
"0.6716494",
"0.65376306",
"0.6500978",
"0.6448209",
"0.6280788",
"0.61913216",
"0.6061261",
"0.5994195",
"0.59680897",
"0.59675896",
"0.59556824",
"0.59553003",
"0.58803505",
"0.58800226",
"0.5830231",
"0.58186835",
"0.5816623",
"0.57967746",
"0.577... | 0.7090214 | 2 |
Add a host by id, it access OpenNebula to get connection parameters | def add(hid, conf)
return if @mutex.synchronize { @clusters.key?(hid) }
begin
cluster = Cluster.new(hid, @client)
error = ''
rescue StandardError => e
cluster = nil
error = e.message
if !conf.nil?
mdc = MonitorClie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end",
"def set_host\n @host = Host.find(params[:id])\n end... | [
"0.69315994",
"0.69315994",
"0.69315994",
"0.69315994",
"0.6918628",
"0.67710245",
"0.6734558",
"0.6644076",
"0.6642357",
"0.66239303",
"0.66174793",
"0.65594256",
"0.6496733",
"0.6355745",
"0.63158447",
"0.62693554",
"0.62353057",
"0.61216986",
"0.6118912",
"0.6108922",
"0.6... | 0.61982405 | 17 |
This function should be called within a synchronized block | def on_cluster(hid, &block)
return unless @clusters[hid] && @clusters[hid][:cluster]
block.call(@clusters[hid][:cluster])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock; end",
"def lock; end",
"def lock; end",
"def synchronized?; end",
"def sync() end",
"def sync() end",
"def sync() end",
"def sync; end",
"def finish_synchronize; end",
"def lock!; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def mutex; end",
"def io_lock; end",... | [
"0.77091503",
"0.77091503",
"0.77091503",
"0.7332421",
"0.7282854",
"0.7282854",
"0.7282854",
"0.722451",
"0.7043465",
"0.70313",
"0.69777983",
"0.69777983",
"0.69777983",
"0.69777983",
"0.6957825",
"0.68391883",
"0.67819214",
"0.67500395",
"0.66957515",
"0.6685887",
"0.66858... | 0.0 | -1 |
Onetime initialization of host pool | def bootstrap
hpool = OpenNebula::HostPool.new(@client)
rc = hpool.info
if OpenNebula.is_error?(rc)
# Wait 5 seconds and retry
sleep 5
rc = hpool.info
if OpenNebula.is_error?(rc)
raise "Could not get hosts information - #{rc.mes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_threadpool\n EM.threadpool_size = @poolsize\n end",
"def initialize(host, options = T.unsafe(nil)); end",
"def initialize_pools(secret, opts = {}, options = {})\n client = OpenNebula::Client.new(secret, opts[:endpoint], options)\n\n @vm_pool = OpenNebula::VirtualMachinePool.new(cli... | [
"0.65790164",
"0.65443575",
"0.6503023",
"0.6481862",
"0.64671695",
"0.63479114",
"0.63479114",
"0.6346564",
"0.62748027",
"0.6261974",
"0.6222547",
"0.62187064",
"0.62001395",
"0.62001395",
"0.6174087",
"0.6169051",
"0.61674875",
"0.61374027",
"0.6129179",
"0.60985506",
"0.6... | 0.5991001 | 26 |
g a^n (mod m) | def modpow(a, n, m)
r = 1
while true
r = r * a % m if n[0] == 1
n >>= 1
return r if n == 0
a = a * a % m
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calc_A(a, n, g)\n modpow(g, a, n)\n end",
"def modpow(a, b, n, m)\n if n == 0\n [1, 0]\n elsif n % 2 == 0\n modpow((a * a) % m, (a * b + b) % m, n / 2, m)\n else\n c, d = modpow(a, b, n - 1, m)\n [(a * c) % m, (a * d + b) % m]\n end\nend",
"def strait_math_of_b_to_the_nth_power_mod_... | [
"0.78810984",
"0.7256131",
"0.7175222",
"0.7156786",
"0.7102454",
"0.65987414",
"0.6550937",
"0.6532655",
"0.6513202",
"0.64137506",
"0.6340965",
"0.6292106",
"0.6285081",
"0.6285081",
"0.62831414",
"0.6270389",
"0.6260251",
"0.62412286",
"0.6234208",
"0.62245214",
"0.6218618... | 0.7548177 | 1 |
Create and memoize an SSH connection. | def ssh_connection
@ssh_connection ||= Net::SSH.start(@host, config[:user], config[:ssh_options] || {})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_new_connection(options, &block)\n cleanup!\n @connection_options = options\n @connection = Kitchen::Transport::Ssh::Connection.new(options, &block)\n end",
"def getSSHConnectionHelper()\n return SSHConnection.new\n end",
"def connect\n if @connection && !@c... | [
"0.71741664",
"0.71220505",
"0.6998052",
"0.6930056",
"0.6922003",
"0.6837309",
"0.6785392",
"0.67749256",
"0.6731143",
"0.6692278",
"0.66875696",
"0.6678338",
"0.6551212",
"0.65156186",
"0.64878577",
"0.64794266",
"0.64564055",
"0.641089",
"0.6381825",
"0.63766056",
"0.63630... | 0.7424476 | 0 |
Filter out messages that we cannot respond to, while passing through messages that we can respond to or that are destined for other services. | def process(message)
return message unless message[:service] == :groupme
gid = message[:group].split('/').last
map = Util.bot_map_for(bot)
message if map.key? gid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def members_not_responding\n memb = sent_messages.map { |sm| (sm.msg_status || -1) < MessagesHelper::MsgDelivered ? sm.member : nil }.compact\n end",
"def message_meant_for_us?(message)\n filter.matches?(message.to)\n end",
"def not_having\r\n HigherOrderMessage.new do |id, *args|\r\n Highe... | [
"0.6091114",
"0.58161235",
"0.57993835",
"0.57514054",
"0.57124865",
"0.5633017",
"0.5570337",
"0.5526322",
"0.55259883",
"0.54970145",
"0.54785115",
"0.5471576",
"0.54631144",
"0.54550123",
"0.5447731",
"0.5401867",
"0.53987",
"0.53942525",
"0.537911",
"0.5377081",
"0.537379... | 0.0 | -1 |
GET /roles GET /roles.json | def index
@roles = Role.page params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def roles\n response[\"roles\"]\n end",
"def get_roles_list()\n\n query_param... | [
"0.82988805",
"0.8055747",
"0.78643805",
"0.77114236",
"0.76325893",
"0.7594744",
"0.75451803",
"0.75449693",
"0.7514484",
"0.74549735",
"0.74549735",
"0.7385503",
"0.735237",
"0.73468083",
"0.73412657",
"0.7334904",
"0.7316817",
"0.73108196",
"0.7283141",
"0.7277944",
"0.724... | 0.6693325 | 73 |
GET /roles/1 GET /roles/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n authorize Role\n\n respond_to do |format|\n format.json { render json: @roles }\n end\n end",
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def GetRole id\n\n APICall(path: \"custom_roles/#{id}.json\")\n\n end",
"def index... | [
"0.78213215",
"0.758502",
"0.7496266",
"0.7405081",
"0.71934754",
"0.7189593",
"0.71655685",
"0.71655685",
"0.71655685",
"0.71500736",
"0.7138432",
"0.71365404",
"0.7123315",
"0.71224034",
"0.71155775",
"0.7091493",
"0.7074178",
"0.70495325",
"0.7039511",
"0.7039511",
"0.7039... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_role
@role = Role.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 |
Restarts this timer, first waiting up to `timeout` then killing the thread and spawning a new one. | def restart(timeout=nil)
stop(timeout)
start!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restart( timeout = 5 )\n stop( timeout )\n start\n end",
"def schedule_timer(timeout)\n @scheduler.schedule_timer(timeout)\n end",
"def timer_thread\n @timer_thread = Thread.new do\n $stdout.sync = true\n @timer_start = Time.now.to_i\n sl... | [
"0.7140074",
"0.6328016",
"0.62750155",
"0.60460985",
"0.58809775",
"0.58503866",
"0.58497936",
"0.58089465",
"0.5727186",
"0.5706199",
"0.5691234",
"0.56200665",
"0.56031847",
"0.5590001",
"0.5534889",
"0.55207515",
"0.5498149",
"0.5498149",
"0.5492499",
"0.5487918",
"0.5485... | 0.721147 | 0 |
Restarts this timer in a very violent fashion (basically calling stop! and start!) | def restart!
stop!
start!
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restart\n stop; start\n end",
"def restart\n stop\n sleep(1)\n start\n end",
"def restart\n stop\n sleep(1)\n start\n end",
"def restart\n stop\n sleep 2\n start\n end",
"def restart; stop; start; end",
"def restart\n stop\n start\n end",
... | [
"0.778167",
"0.7745995",
"0.7745995",
"0.77381355",
"0.77298915",
"0.77235234",
"0.77064353",
"0.77029544",
"0.77029544",
"0.77029544",
"0.76864886",
"0.76208645",
"0.76208645",
"0.7591051",
"0.7590066",
"0.75778735",
"0.7524416",
"0.7505306",
"0.7495667",
"0.74624825",
"0.72... | 0.77482563 | 1 |
Waits for the worker thread to join before stopping the timer, giving the worker thread timeout seconds to get its business in order. By default timeout is the thread's timeout plus one second. | def stop(timeout=nil)
timeout ||= @timeout +1
@shutting_down = true
@thread.join timeout
@running = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait\n @timer_thread.join\n end",
"def join(timeout)\n @thread.join timeout\n end",
"def wait(timeout = nil)\n @threads.wait_for_termination(timeout)\n Disquo.logger.info \"Worker shutdown complete\"\n end",
"def join\n @worker.join(SHUTDOWN_TIMEOUT)\n end",
"def join... | [
"0.736295",
"0.7236643",
"0.69218934",
"0.6854575",
"0.6557998",
"0.65152574",
"0.6472942",
"0.6472942",
"0.64521945",
"0.6364817",
"0.6334402",
"0.63074654",
"0.62878674",
"0.6099318",
"0.60809803",
"0.60436",
"0.601713",
"0.59758055",
"0.59711885",
"0.5939752",
"0.5938775",... | 0.62487346 | 13 |
Stops this timer right away, killing the worker thread. | def stop!
@thread.kill if @running
@running = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_timer\n if @timer\n @timer.stop\n @timer = nil\n end\n end",
"def stop\n @timer.cancel\n end",
"def stop\n @timer.cancel\n end",
"def stop!\n @thread.kill && @thread.stop?\n end",
"def stop\n if @thread\n @thread.kill\n ... | [
"0.7683494",
"0.7585903",
"0.7585903",
"0.72099394",
"0.71454495",
"0.7140942",
"0.71041256",
"0.71036136",
"0.7069062",
"0.70393187",
"0.7018726",
"0.6958624",
"0.69304186",
"0.6866885",
"0.682885",
"0.6827651",
"0.67926043",
"0.6748017",
"0.6703803",
"0.66993296",
"0.665306... | 0.7279124 | 3 |
Spawns a new worker thread | def start!
raise "This timer cannot be started as it is already running!" if @running
@running = true
@shutting_down = false
@thread = Thread.new do
begin
if @one_shot
sleep @timeout
@blo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _start_new_worker(worker)\n Thread.new do\n worker.work\n end\n end",
"def start_worker_thread\n @worker_threads << ControllableThread.new(@name + \"-worker\") {yield}\n end",
"def spawn_thread\n Thread.new do\n while true\n x = @queue.shift\n if x == Directive... | [
"0.8125943",
"0.7918299",
"0.70318645",
"0.68218064",
"0.67754155",
"0.6647403",
"0.6636539",
"0.6617619",
"0.66026676",
"0.66003275",
"0.65942776",
"0.65914744",
"0.65697753",
"0.64960855",
"0.6477625",
"0.6444302",
"0.64396495",
"0.64365315",
"0.63885146",
"0.6313663",
"0.6... | 0.0 | -1 |
relationships with class Artist Songs belong to an artist and an artist has many songs. Adding a song to an artist by called add_song on Artist class Songs initialized with optional artist argument (artist=nil) | def artist=(artist) #assigns an artist to the song (song belongs to artist)
@artist = artist #artist is reading from Song class artist method(reader)
artist.add_song(self) #invokes Artist#add_song to add itself to the artist's collection of songs (artist has many songs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end",
"def add_song(song)\n @songs << song\n song.artist = self\n\n end",
"def add_song(song)\n song.artist = self #associate the song with this artist\n end",
"def add_song... | [
"0.8383572",
"0.8172095",
"0.81707335",
"0.816405",
"0.816405",
"0.816405",
"0.816405",
"0.816405",
"0.816405",
"0.81598294",
"0.81427294",
"0.8141101",
"0.813963",
"0.81322706",
"0.81322706",
"0.81322706",
"0.81322706",
"0.81322706",
"0.81322706",
"0.81322706",
"0.81322706",... | 0.80410165 | 35 |
relationship with class Genres Genres have many songs and are initialized with an empty list of songs. Songs have one genre. Songs can be initialized with an optional genre argument (genre=nil) | def genre=(genre)
@genre = genre #assigns a genre to the song (song belongs to genre)
genre.songs << self unless genre.songs.include?(self) #adds the song to the genre's collection of songs (genre has many songs); does not add the song to the genre's collection of songs if it already exists therein
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def genre=(genre)\n @genre = genre\n \n # adds the song to the genre's collection of songs \n # (genre has many songs).\n # Doesn't add the song to the genre's collection of\n # songs if it already exists therein\n if !(genre.songs.include?(self))\n genre.songs << self\n end\n end",
... | [
"0.7701118",
"0.7499897",
"0.74706334",
"0.7467282",
"0.7454087",
"0.74235153",
"0.7379782",
"0.7266984",
"0.72055465",
"0.71746004",
"0.71439844",
"0.7058746",
"0.70354015",
"0.6997813",
"0.69271004",
"0.6916639",
"0.6889856",
"0.68668276",
"0.67599744",
"0.6756006",
"0.6697... | 0.7779385 | 0 |
Customer has bought tickets for which films? | def films()
sql = "SELECT films.* FROM films INNER JOIN tickets ON
films.id = tickets.film_id WHERE tickets.customer_id = $1;"
values = [@id]
films = SqlRunner.run(sql, values)
result = Film.map_films(films)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tickets_purchased\n return film().count\n end",
"def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end",
"def buy_ticket\n customer = find_customer_by_id()\n film = find_film_by_id()\... | [
"0.7046905",
"0.7039327",
"0.69481283",
"0.67439514",
"0.67376745",
"0.66754794",
"0.66422033",
"0.65128493",
"0.64476186",
"0.64377934",
"0.63897854",
"0.6363348",
"0.6342897",
"0.6331001",
"0.6239357",
"0.61799973",
"0.6155796",
"0.6136601",
"0.61214894",
"0.6023789",
"0.60... | 0.0 | -1 |
Customer has tickets for how many films? | def how_many_films()
sql = "SELECT films.* FROM films INNER JOIN tickets ON
films.id = tickets.film_id WHERE tickets.customer_id = $1;"
values = [@id]
films = SqlRunner.run(sql, values)
result = Film.map_films(films).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tickets()\n return films().count()\n end",
"def tickets_purchased\n return film().count\n end",
"def count_tickets()\n sql = \"SELECT films.* FROM films\n INNER JOIN tickets ON\n tickets.film_id = films.id\n WHERE customer_id = $1\"\n values = [@id]\n films = SqlRunner.run(sql, va... | [
"0.8012461",
"0.7730168",
"0.76422143",
"0.7606827",
"0.75989246",
"0.75381523",
"0.7304868",
"0.72789216",
"0.7149518",
"0.7107885",
"0.70538527",
"0.704313",
"0.693309",
"0.67804384",
"0.671173",
"0.66256857",
"0.6621054",
"0.6563656",
"0.65392876",
"0.6533566",
"0.6497793"... | 0.6901178 | 13 |
Customer has bought tickets for which films? | def tickets_bought()
sql = "SELECT * FROM tickets WHERE customer_id = $1;"
values = [@id]
ticket_hash = SqlRunner.run(sql, values)
result = Ticket.map_tickets(ticket_hash)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tickets_purchased\n return film().count\n end",
"def tickets_bought()\n tickets_array = films()\n number_of_tickets = tickets_array.count\n return \"#{@name} has bought #{number_of_tickets} tickets.\"\n end",
"def buy_ticket\n customer = find_customer_by_id()\n film = find_film_by_id()\... | [
"0.7046905",
"0.7039327",
"0.69481283",
"0.67439514",
"0.67376745",
"0.66754794",
"0.66422033",
"0.65128493",
"0.64476186",
"0.64377934",
"0.63897854",
"0.6363348",
"0.6342897",
"0.6331001",
"0.6239357",
"0.61799973",
"0.6155796",
"0.6136601",
"0.61214894",
"0.6023789",
"0.60... | 0.5954094 | 23 |
POST /resource/sign_in def create super end DELETE /resource/sign_out def destroy super end | def create
respond_to do |format|
format.json {
user_email=params[:email]
password=params[:password]
firebase_token = params[:firebase_token]
user=User.find_by_email(user_email)
if(!user)
render :json => {status:401, message:"credenciales inválidas"}, status: :ok
elsif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_up(resource_name, resource)\n # sign_in(resource_name, resource)\n end",
"def sign_up(resource_name, resource)\n sign_in(resource_name, resource)\n end",
"def create\n \n resource = warden.authenticate!(auth_options)\n \n \n set_flash_message(:notice, :signed_in) if is_navigatio... | [
"0.7406782",
"0.72153497",
"0.71926516",
"0.7179744",
"0.7159837",
"0.7075258",
"0.70645964",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
"0.7049692",
... | 0.0 | -1 |
Say hi to everybody | def say_hi
if @names.nil?
puts "..."
elsif @names.respond_to?("each")
# @names is a list of some kind, iterate!
@names.each do |name|
puts "Hello #{name}!"
end
else
puts "Hello #{@names}!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sayHi\n\t\tputs(greet)\n\tend",
"def say_hi\n\t\tputs 'saying hi'\n\tend",
"def say_hi\n\t\tputs \"Hello!\"\n\tend",
"def greet\n self.say \"Hello, I am #{@config[:nick]}. I am the resident uber-bot. To learn more, type '.about'.\"\n end",
"def say_hi\n \tputs \"hello user\" #you must ca... | [
"0.79006225",
"0.7774688",
"0.7542135",
"0.75231713",
"0.748248",
"0.7468877",
"0.7465552",
"0.7261262",
"0.7231959",
"0.7197657",
"0.7163477",
"0.71475774",
"0.71447915",
"0.7140804",
"0.7111786",
"0.7107247",
"0.70781755",
"0.70705646",
"0.7037797",
"0.70323473",
"0.6983622... | 0.0 | -1 |
Say bye to everybody | def say_bye
if @names.nil?
puts "..."
elsif @names.respond_to?("join")
p "Goodbye #{@names.join(", ")}. Come back soon!"
else
p "Goodbye #{@names}. Come back soon!"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bye_message\n message = \"Panacea's work is done, enjoy!\"\n say \"\\n\\n\\e[34m#{message}\\e[0m\"\n end",
"def bye; end",
"def say_goodbye\n\t\tgoodbye = \"Thanks for playing the Virtual Crazy\" +\n\t\t\t\t\"8-Ball game!\\n\\n\"\n\tend",
"def goodbye\n puts Rainbow(\"Thanks for... | [
"0.7686349",
"0.7163387",
"0.7044624",
"0.70263904",
"0.68565613",
"0.6789585",
"0.677641",
"0.6759936",
"0.6681969",
"0.66106707",
"0.6601584",
"0.65618604",
"0.6556364",
"0.65459394",
"0.65330076",
"0.6512109",
"0.6508284",
"0.6468874",
"0.6460497",
"0.6459438",
"0.6443436"... | 0.6267667 | 40 |
GET /accesots GET /accesots.json | def index
@accesots = Accesot.all.last(50) # Muestra los ultimmos 50 accesos recientes del sistema. ok.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @accesses = Access.all\n respond_with(@accesses)\n end",
"def index\n @representante_athletes = current_user.organization.athletes\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @representante_athletes }\n end\n end",
"def index\n ... | [
"0.6395371",
"0.63548",
"0.6293742",
"0.6292295",
"0.6270224",
"0.62447673",
"0.62007254",
"0.61911166",
"0.61887634",
"0.6185438",
"0.60891694",
"0.60460484",
"0.6031476",
"0.6026345",
"0.6021292",
"0.6021092",
"0.6007914",
"0.6007914",
"0.6007914",
"0.6007914",
"0.6003775",... | 0.6249946 | 5 |
GET /accesots/1 GET /accesots/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @accesses = Access.all\n respond_with(@accesses)\n end",
"def show\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @accesorio }\n end\n end",
"def get_acc_info\n JSON.parse(curl_get(\"/... | [
"0.6314497",
"0.62914723",
"0.62470967",
"0.62257427",
"0.61320317",
"0.6038133",
"0.6038133",
"0.6038133",
"0.6038133",
"0.60316026",
"0.6029414",
"0.60288393",
"0.60215586",
"0.6020961",
"0.60039186",
"0.60016704",
"0.59931886",
"0.5960282",
"0.59390396",
"0.5825469",
"0.58... | 0.0 | -1 |
POST /accesots POST /accesots.json | def create
redirect_to accesots_url and return# arbitratio, ted no permitir crear desde la web panel ok. ok.
# @accesot = Accesot.new(accesot_params)
# respond_to do |format|
# if @accesot.save
# format.html { redirect_to @accesot, notice: 'Accesot was successfully created.' }
# format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @accesorio = Accesorio.new(params[:accesorio])\n\n respond_to do |format|\n if @accesorio.save\n format.html { redirect_to @accesorio, notice: 'Accesorio was successfully created.' }\n format.json { render json: @accesorio, status: :created, location: @accesorio }\n else\... | [
"0.5855899",
"0.5847698",
"0.58343405",
"0.5755701",
"0.5747609",
"0.5737482",
"0.5733532",
"0.5633684",
"0.5620667",
"0.5617488",
"0.55436295",
"0.5532738",
"0.54679185",
"0.5466166",
"0.54483736",
"0.5405187",
"0.5400161",
"0.5396466",
"0.5369034",
"0.53628415",
"0.5360024"... | 0.6538671 | 0 |
PATCH/PUT /accesots/1 PATCH/PUT /accesots/1.json | def update
respond_to do |format|
if @accesot.update(accesot_params)
format.html { redirect_to @accesot, notice: 'Accesot was successfully updated.' }
format.json { render :show, status: :ok, location: @accesot }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @accesorio = Accesorio.find(params[:id])\n\n respond_to do |format|\n if @accesorio.update_attributes(params[:accesorio])\n format.html { redirect_to @accesorio, notice: 'Accesorio ... | [
"0.6277308",
"0.6264905",
"0.61569804",
"0.61546594",
"0.60726357",
"0.6062707",
"0.6041612",
"0.60187185",
"0.60088426",
"0.6006545",
"0.5967996",
"0.5946529",
"0.5941044",
"0.5905032",
"0.58998686",
"0.5884936",
"0.5868076",
"0.58659214",
"0.5864381",
"0.58571345",
"0.58527... | 0.676821 | 0 |
DELETE /accesots/1 DELETE /accesots/1.json | def destroy
# @accesot.destroy
# respond_to do |format|
# format.html { redirect_to accesots_url, notice: 'Accesot was successfully destroyed.' }
# format.json { head :no_content }
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @access.destroy\n respond_to do |format|\n format.html { redirect_to accesses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @accion.destroy\n respond_to do |format|\n format.html { redirect_to accions_url }\n format.json { head :no_content... | [
"0.7012114",
"0.69403654",
"0.68995637",
"0.6760587",
"0.6756837",
"0.6712728",
"0.6667612",
"0.66516227",
"0.66397053",
"0.66293466",
"0.6627262",
"0.66158354",
"0.66032344",
"0.6598072",
"0.6582893",
"0.6580709",
"0.65569806",
"0.65300226",
"0.65215933",
"0.65206903",
"0.65... | 0.71313155 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_accesot
@accesot = Accesot.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def accesot_params
params.require(:accesot).permit(:usuario, :tipoacceso, :fechayhora, :ip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Helper method to abstract Nokogiri/HTTParty method calls | def do_request url
Nokogiri::HTML(HTTParty.get(url))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url_obj (url)\n url_1 = HTTParty.get(url)\n return Nokogiri::HTML(url_1)\nend",
"def xml_http_request?; end",
"def nokogiri!\n @@parser = USE_NOKOGIRI\n end",
"def parse_get(href)\n text = HTTParty.get(href)\n Nokogiri::HTML(text)\nend",
"def fetch\n\t\tbegin\n\t\t\tresponse = RestC... | [
"0.6628395",
"0.6422345",
"0.6376983",
"0.637105",
"0.61836326",
"0.61669785",
"0.6150244",
"0.6150244",
"0.61406535",
"0.6134333",
"0.6134333",
"0.6127624",
"0.604281",
"0.6033088",
"0.6033088",
"0.5998864",
"0.59821194",
"0.59777945",
"0.59656024",
"0.59390277",
"0.59390277... | 0.72749805 | 0 |
Helper for filtering the table row by the provider string passed to the method | def filter_by_provider row, provider
row.css("td > a > img").attr("title").text == provider.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value(table, field_val, field_ftr, filter_val)\n #print filter_val\n sql_statement = \"SELECT \" + field_val + \" FROM \" + table + \" WHERE \" + \\\n field_ftr + \" = '\" + filter_val + \"';\"\n db = get_db()\n stm = db.prepare sql_statement\n rs = stm.execute\n retun_val = nil\n rs.each do |row|... | [
"0.5789934",
"0.57803994",
"0.57803994",
"0.55956054",
"0.5593",
"0.53995085",
"0.537682",
"0.53303355",
"0.5308011",
"0.5300068",
"0.52884156",
"0.5276105",
"0.5257209",
"0.5255495",
"0.5220645",
"0.52162665",
"0.52051985",
"0.5202881",
"0.51975626",
"0.5173875",
"0.51709014... | 0.6598836 | 0 |
Helper for removing undesired characters in the .txt input | def clear_lines lines
lines = lines.map do |line|
line = line.gsub(/(\n)$/, "")
line = line.gsub(/(\t)/,"")
next if line == "\n"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean_input(text)\n text.gsub(/\\r/, '') rescue text\n end",
"def remove_unwanted_chars(data)\n\n data = data.gsub(\"\\r\\n\", ' ')\n data = data.gsub(\"\\t\", ' ')\n data = data.gsub(\"\\n\", ' ')\n\n data.strip\n end",
"def cleaned(txt)\n\t\ttxt.gsub(/[(,\\'.#)]/, '')\n\tend",
"def cle... | [
"0.7558366",
"0.73266757",
"0.72351754",
"0.72351754",
"0.7154395",
"0.71446484",
"0.71195316",
"0.71185774",
"0.6913971",
"0.68729216",
"0.68565214",
"0.6768086",
"0.67668515",
"0.67367685",
"0.6728403",
"0.6712136",
"0.67111295",
"0.6582735",
"0.65767574",
"0.65424466",
"0.... | 0.0 | -1 |
Get the data from the input line and return a hash for structured access to "pure" card information | def extract_data line
card_num = line.match(/^\d+/).to_s
card_name = line.gsub(/^\d+/,"").strip
require 'pry'; binding.pry;
if card_has = line.match(/\[(\d+)\]/)
card_has = card_has.captures.first
card_name = card_name.gsub(/\[\d+\]/,"").strip
else
card_has = 0
end
card = {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode(input)\r\n input.lines.select { |c| @decode_regexp.match(c) }.map do |card| \r\n card_fields = card.split (\"|\")\r\n hash = {}\r\n @encoded_fields.each_with_index do |f, i|\r\n hash[f] = card_fields[i] unless !card_fields[i]\r\n end\r\n hash\r\n end\r... | [
"0.65477",
"0.61603284",
"0.6144651",
"0.61219424",
"0.6113409",
"0.6064601",
"0.6005082",
"0.5969474",
"0.5940244",
"0.5911718",
"0.58572125",
"0.58409137",
"0.5834025",
"0.58150315",
"0.5795275",
"0.5774738",
"0.57633305",
"0.57461876",
"0.57122725",
"0.571202",
"0.57015526... | 0.7199276 | 0 |
Based on a clear input from clear_lines, we now instantiate our cards objects using extract_data as a helper for this task | def instantiate_cards clean_lines
clean_lines.map do |line|
already_there = false
require 'pry'; binding.pry;
tmp_card = extract_data(line)
name = tmp_card[:card_name]
num = tmp_card[:card_num]
has = tmp_card[:card_has]
Card.new(name, num, has)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_card(card_lines)\n index = card_lines.shift.split(': ').last.to_i\n name = card_lines.shift.split(': ').last.remove_gt_lt\n\n profiles = []\n reading_profiles = false\n active_profile = nil\n card_lines.each do |line|\n if line =~ /^\\s+active profile: /\n active_profile = line.split(': ').la... | [
"0.6694729",
"0.6654104",
"0.6598179",
"0.6588077",
"0.6584814",
"0.6349336",
"0.63405746",
"0.63405156",
"0.6337661",
"0.6319877",
"0.63190484",
"0.6286396",
"0.61377317",
"0.61107785",
"0.61107785",
"0.6097858",
"0.60814106",
"0.60814106",
"0.60814106",
"0.6037595",
"0.6024... | 0.78511405 | 0 |
Determine whether the input is a palindrome | def isPalindrome?(input)
first = 0
last = input.length - 1
while first < last
if input[first] != input[last]
return false
end
first += 1
last -= 1
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def palindrome_no_reverse?(input)\n\tinput_s = input.to_s\n\t(1...(input_s.length/2+1)).each do |i|\n\t\treturn false if input_s[i-1] != input_s[-i]\n\tend\n\treturn true\nend",
"def palindrome?(input)\n input.to_s == input.to_s.reverse\nend",
"def palindrome?\n str = self.to_s\n len = str.size\n\n i... | [
"0.8725409",
"0.858012",
"0.8516902",
"0.8499478",
"0.8499478",
"0.8499478",
"0.8499478",
"0.8454589",
"0.8418866",
"0.841331",
"0.83955806",
"0.83488333",
"0.8312291",
"0.8301737",
"0.8253659",
"0.8240262",
"0.8236896",
"0.8236896",
"0.8236896",
"0.82332754",
"0.82273656",
... | 0.0 | -1 |
Any methods in Smart will superseed those in the class | def act_smart
'class Scientist instance method act_smart ' + Smart.quant.to_s + ' E = mc²'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def setup!\n setup_instance_methods!\n self\n end",
"def instance_methods(include_super=true) end",
"def super_method; end",
"def protected_instance_methods(include_super=tr... | [
"0.645017",
"0.6245603",
"0.6245603",
"0.6245603",
"0.6245603",
"0.614958",
"0.613858",
"0.60503095",
"0.60428435",
"0.6008418",
"0.59692144",
"0.5967426",
"0.59123737",
"0.5903728",
"0.5903193",
"0.58539224",
"0.58539224",
"0.5843035",
"0.58390397",
"0.5823664",
"0.5823664",... | 0.0 | -1 |
play video from path | def play(path)
@command = ['screen', '-S', 'cast_session', '-X', 'quit']
pid = run(@command)
Process.waitpid(pid)
@command = ['screen', '-d', '-m', '-S', 'cast_session', 'castnow']
@command.push(path)
@playing = true
run(@command)
Rails.logger.debug(Rainbow("Playing the video...").ora... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def playvideo\n if(params.has_key?(:id))\n id = params[:id]\n end\n Pusher['photo-call'].trigger('play-video' , {\n control: \"1\", video_id: id\n })\n render text: \"ok\"\n end",
"def play_file(file)\n system(\"afplay #{file}\")\n end",
"def play_file(file)\n system(\"afplay #... | [
"0.6642481",
"0.654257",
"0.654257",
"0.6509545",
"0.6396689",
"0.6335815",
"0.6322056",
"0.6303695",
"0.628851",
"0.62777776",
"0.62758034",
"0.6237046",
"0.6205428",
"0.61115134",
"0.5975502",
"0.5948719",
"0.59320164",
"0.5931763",
"0.592801",
"0.59189194",
"0.5882691",
... | 0.7434352 | 0 |
stop playing the current video | def stop
@command = ['screen', '-S', 'cast_session', '-X', 'stuff', 's']
pid = run(@command)
# set playing state to false
@playing = false
Rails.logger.debug(Rainbow("Attempting to stop video...").orange)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stop\n @av_player.stop unless @av_player.nil?\n end",
"def stop\n if @media_player.is_a? MPMoviePlayerViewController\n @presenting_controller.dismissMoviePlayerViewControllerAnimated\n @presenting_controller = nil\n else\n @media_player.stop\n end\n ... | [
"0.8078988",
"0.78305095",
"0.75167185",
"0.71624404",
"0.6683693",
"0.6529763",
"0.650409",
"0.6340237",
"0.6231253",
"0.6182531",
"0.6182531",
"0.6149324",
"0.6149324",
"0.6149324",
"0.61197394",
"0.6092116",
"0.6074899",
"0.606644",
"0.6009568",
"0.6000217",
"0.5997067",
... | 0.7461453 | 3 |
Initializes a new client instance | def initialize(options = {})
Artsy::Client::Configurable.keys.each do |key|
instance_variable_set(:"@#{key}", options[key] || Artsy::Client.instance_variable_get(:"@#{key}"))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_client; end",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t\tself.client = client\n\tend",
"def initialize(client)\n\t self.client=client\n end",
"def initialize(client)\n self.client=client\n\n\tend",
"def initialize(**options)\n @config = Conf... | [
"0.8238965",
"0.81036556",
"0.81036556",
"0.80211204",
"0.7922729",
"0.78885615",
"0.7850089",
"0.78076476",
"0.78076476",
"0.78076476",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.7790259",
"0.779025... | 0.0 | -1 |
Perform an HTTP DELETE request | def delete(path, params = {})
request(:delete, path, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def delete\n url = prefix + \"delete\"\n return response(url)\n end",
"def d... | [
"0.8438185",
"0.83934355",
"0.83934355",
"0.8290819",
"0.8263215",
"0.8263215",
"0.81609714",
"0.81589085",
"0.81571144",
"0.8077739",
"0.80723196",
"0.8043918",
"0.8042518",
"0.80136585",
"0.79634786",
"0.7963314",
"0.7927026",
"0.7908301",
"0.7908301",
"0.7908301",
"0.79083... | 0.75737417 | 53 |
Perform an HTTP GET request | def get(path, params = {})
request(:get, path, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end",
"def do_get\n Net::HTTP.get(URI.parse(api_url))\n end",
"def http( *args )\n p http... | [
"0.82494193",
"0.8192065",
"0.81917036",
"0.8165549",
"0.8159032",
"0.802167",
"0.79651356",
"0.79651356",
"0.79434437",
"0.78049177",
"0.78049177",
"0.77834314",
"0.7782801",
"0.7741939",
"0.77094096",
"0.7678789",
"0.7663416",
"0.7663416",
"0.76462",
"0.76280385",
"0.761140... | 0.7215611 | 92 |
Perform an HTTP POST request | def post(path, params = {})
signature_params = params.values.any? { |value| value.respond_to?(:to_io) } ? {} : params
request(:post, path, params, signature_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_post_request url, body, headers = []\n make_request url, method: ::Rack::POST, body: body, headers: headers\n end",
"def post url, body, headers = {}\n http_request(url, Net::HTTP::Post, body, headers)\n end",
"def post(url, body, headers = {})\n do_request Net::HTTP::Post, url, hea... | [
"0.8219336",
"0.8101932",
"0.78963655",
"0.7830325",
"0.7689463",
"0.76873493",
"0.7641582",
"0.75474995",
"0.75034285",
"0.74829894",
"0.7459943",
"0.74446553",
"0.74328977",
"0.74057776",
"0.738012",
"0.7367464",
"0.73457575",
"0.7309113",
"0.7301297",
"0.72935265",
"0.7278... | 0.0 | -1 |
Perform an HTTP PUT request | def put(path, params = {})
request(:put, path, params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put url, body, headers = {}\n http_request(url, Net::HTTP::Put, body, headers)\n end",
"def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend",
"def _http_put resource, path\n ur... | [
"0.81480706",
"0.8013114",
"0.80127275",
"0.7999517",
"0.7996671",
"0.7920489",
"0.78857344",
"0.78750366",
"0.7863467",
"0.7851399",
"0.78416914",
"0.78161806",
"0.78014696",
"0.78014696",
"0.7764575",
"0.76753426",
"0.76704144",
"0.766458",
"0.766358",
"0.7643184",
"0.76334... | 0.7438445 | 60 |
Returns a proc that can be used to setup the Faraday::Request headers | def request_setup(method, path, params)
proc do |request|
if @access_token
request.headers["X-ACCESS-TOKEN"] = @access_token
elsif @xapp_token
request.headers["X-XAPP-TOKEN"] = @xapp_token
end
if @logger
params_s = ("?" + params.select ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_headers=(_arg0); end",
"def request_setup()\n Proc.new do |request|\n request.headers[:authorization] = basic_auth_header\n request.headers[:content_type] = 'application/json; charset=UTF-8'\n request.headers[:accept] = 'application/json; charset=UTF-8'\n end\n end",... | [
"0.7022868",
"0.68928987",
"0.68909746",
"0.68126243",
"0.66729754",
"0.66729754",
"0.66580725",
"0.66580725",
"0.66580725",
"0.66580725",
"0.6467644",
"0.64480704",
"0.64358604",
"0.6390221",
"0.6354679",
"0.634545",
"0.6338564",
"0.62365603",
"0.6214866",
"0.6199107",
"0.61... | 0.6235879 | 18 |
Returns a Faraday::Connection object | def connection
@connection ||= begin
connection_options = { builder: @middleware }
connection_options[:ssl] = { verify: true } if @endpoint[0..4] == 'https'
Faraday.new(@endpoint, @connection_options.merge(connection_options))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connection\n @connection ||= Faraday.new(endpoint, connection_options)\n end",
"def connection\n @connection ||= Faraday.new(@endpoint, @connection_options, &@middleware)\n end",
"def connection\n @connection ||= Faraday.new(self.api_url, { ssl: { verify: false } })\n end",
"def c... | [
"0.84802544",
"0.846889",
"0.84117967",
"0.83867854",
"0.83833057",
"0.83740443",
"0.8361525",
"0.8343596",
"0.8337509",
"0.8327479",
"0.8327479",
"0.8327479",
"0.8327479",
"0.8324534",
"0.8285875",
"0.8262463",
"0.8241199",
"0.81898654",
"0.8177524",
"0.81586313",
"0.8154565... | 0.8159812 | 19 |
Returns array of category attributes available in the response | def categories
parsed_json['data']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def categories\n raw_categories.to_hashugar\n end",
"def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end",
"def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]... | [
"0.69904953",
"0.6963249",
"0.69204414",
"0.68996245",
"0.6874245",
"0.68417555",
"0.6768791",
"0.67686",
"0.6714916",
"0.66997766",
"0.6653218",
"0.6617594",
"0.66041005",
"0.6583342",
"0.6574312",
"0.65666",
"0.65666",
"0.65666",
"0.6565676",
"0.6531414",
"0.6494844",
"0.... | 0.72635686 | 0 |
Method to compare self against other_time, returning true if self is equal to or earlier/before other_time This comparison is made with some leeway, so that if self is actually after other_time, but by less than the leeway amount (in seconds), the method will return true | def is_before?(other_time, leeway = 5)
other_time += leeway
self <= other_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_after?(other_time, leeway = 5)\n other_time -= leeway\n self >= other_time\n end",
"def is_within?(other_time, leeway = 5)\n is_before?(other_time, leeway) && is_after?(other_time, leeway)\n end",
"def ==(other)\n self.same_time?(other)\n end",
"def after?(other)... | [
"0.8639147",
"0.8025868",
"0.7232088",
"0.717428",
"0.7135737",
"0.7036684",
"0.6970199",
"0.68751884",
"0.6857959",
"0.67708975",
"0.6758181",
"0.6739775",
"0.6739775",
"0.67007387",
"0.66436434",
"0.66351485",
"0.65945995",
"0.6594341",
"0.6584207",
"0.6554491",
"0.6536344"... | 0.8910245 | 0 |
Method to compare self against other_time, returning true if self is equal to or later/after other_time This comparison is made with some leeway, so that if self is actually before other_time, but by less than the leeway amount (in seconds), the method will return true | def is_after?(other_time, leeway = 5)
other_time -= leeway
self >= other_time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_before?(other_time, leeway = 5)\n other_time += leeway\n self <= other_time\n end",
"def is_within?(other_time, leeway = 5)\n is_before?(other_time, leeway) && is_after?(other_time, leeway)\n end",
"def after?(other)\n if other.hour < @hour\n return true\n els... | [
"0.88882816",
"0.80816513",
"0.72241586",
"0.71929395",
"0.71618533",
"0.70420045",
"0.6984644",
"0.6949237",
"0.68040234",
"0.68040234",
"0.6785679",
"0.67477",
"0.6716783",
"0.66953945",
"0.66911596",
"0.664341",
"0.6609671",
"0.65900433",
"0.65530854",
"0.6552261",
"0.6499... | 0.87467813 | 1 |
Method to compare self against other_time, returning true if it is close enough to self in either direction Leeway is in seconds | def is_within?(other_time, leeway = 5)
is_before?(other_time, leeway) && is_after?(other_time, leeway)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_before?(other_time, leeway = 5)\n other_time += leeway\n self <= other_time\n end",
"def is_after?(other_time, leeway = 5)\n other_time -= leeway\n self >= other_time\n end",
"def later?(target_time, ref_time)\n target_time.to_f - ref_time.to_f > 0.01\n end",
"def... | [
"0.7931138",
"0.78338176",
"0.68573284",
"0.6778002",
"0.6682348",
"0.66583735",
"0.6583114",
"0.6566498",
"0.65371644",
"0.653066",
"0.65188146",
"0.6469014",
"0.6445209",
"0.63902074",
"0.6347029",
"0.6336012",
"0.6258044",
"0.6213491",
"0.6213491",
"0.61638075",
"0.6152450... | 0.7489008 | 2 |
Creates permalink based on Stringex's .to_url method | def set_permalink
if parent_id.nil?
self.permalink = name.to_url if permalink.blank?
else
parent_taxon = Taxon.find(parent_id)
self.permalink = [parent_taxon.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_permalink\n self.permalink = self.name.gsub(/\\s/, \"-\").gsub(/_/, '-').gsub(/[^\\w-]/, '').downcase\n end",
"def permalink_for_url\n if permalink =~ /^https?:\\/\\//\n permalink\n else\n permalink.sub /^([^\\/]?)/, '/\\1'\n end\n end",
"def make_slug\n self.permalink = (... | [
"0.75820446",
"0.7581435",
"0.73976725",
"0.72277844",
"0.7172043",
"0.7111225",
"0.7106738",
"0.7063191",
"0.70051706",
"0.69703496",
"0.67866886",
"0.67543703",
"0.67471766",
"0.6743562",
"0.6743562",
"0.6724708",
"0.67112523",
"0.6625258",
"0.6625258",
"0.66239184",
"0.662... | 0.0 | -1 |
POST /rolls POST /rolls.json | def create
roll = Roll.new(play: current_play)
@roll = RollDice.new(play: current_play, roll: roll).call
respond_to do |format|
if @roll
format.html { redirect_to play_path, notice: 'Roll was successfully created.' }
format.json { render :show, status: :created, location: @roll }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def roll_params\n params.require(:roll).permit(:roll_number, :pins_fallen, :frame_id)\n end",
"def create\n @roll = Roll.new\n @roll.total = params['value']\n @roll.game_id = params[:game_id]\n @roll.save\n \n # respond_to do |format|\n # if @roll.save\n # format.html { redi... | [
"0.65723854",
"0.64915395",
"0.6481257",
"0.6397394",
"0.6380938",
"0.63506514",
"0.6281496",
"0.6279715",
"0.62399876",
"0.6164476",
"0.6161366",
"0.5980196",
"0.5980196",
"0.5980196",
"0.5980196",
"0.5980196",
"0.5917698",
"0.59016263",
"0.58687454",
"0.5863012",
"0.5832935... | 0.6508616 | 1 |
DELETE /rolls/1 DELETE /rolls/1.json | def destroy
@roll.destroy
respond_to do |format|
format.html { redirect_to rolls_url, notice: 'Roll was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @roll.destroy\n respond_to do |format|\n format.html { redirect_to game_path(@game), notice: 'Roll was deleted.' }\n format.json { render json: game_path(@game), status: :created, location: @roll }\n end\n end",
"def destroy\n @roll.destroy\n respond_to do |format|\n ... | [
"0.7522216",
"0.74890065",
"0.7133889",
"0.7042931",
"0.7042903",
"0.6962965",
"0.69044936",
"0.6877001",
"0.68644476",
"0.67926145",
"0.674846",
"0.670379",
"0.6699675",
"0.6699675",
"0.6649057",
"0.6649026",
"0.66141206",
"0.66053593",
"0.66049033",
"0.6564936",
"0.6540574"... | 0.77027714 | 0 |
Retrieve the highest lesson, and highest lesson part that student has achieved. Limit to one, as we are only interested in the highest one. If none exist, return empty hash, so `.to_json` can still be called on the result of this method | def highest_lesson_progress
self.student_lesson_progresses.select(:lesson_id, :lesson_part_id).limit(1).order(lesson_id: :desc, lesson_part_id: :desc).try(:first).try(:as_hash) ||
{ lesson_number: 0, lesson_part_number: 0 }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highest_grade_other\n student = Student.order(grade: :desc).first\n render json: student\n end",
"def students_with_low_grades_json(time_now, time_threshold, grade_threshold)\n all_assignments = assignments(time_now, time_threshold, grade_threshold)\n by_student = all_assignments.group_by(&:stud... | [
"0.6859252",
"0.5847957",
"0.5632796",
"0.56317896",
"0.5616696",
"0.55360395",
"0.54645926",
"0.5450969",
"0.54140073",
"0.53746855",
"0.5372383",
"0.533951",
"0.53034633",
"0.529192",
"0.52847093",
"0.528141",
"0.52813333",
"0.5274316",
"0.52733666",
"0.52688533",
"0.523472... | 0.754213 | 0 |
Create new student_lesson_progresses record for given lesson and lesson_part Only allow progress to the next lesson_part, or next lesson if current lesson_part == 3 ie. do not allow student to skip a lesson or lesson part Return a struct with a lovely error message in the case of lesson skipping, or the result Allow a ... | def progress_to_lesson(lesson:, lesson_part:)
current_lesson_number = highest_lesson_progress.fetch(:lesson_number, 0)
current_lesson_part_number = highest_lesson_progress.fetch(:lesson_part_number, 0)
success = false
error = ''
if (current_lesson_nu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def highest_lesson_progress\n self.student_lesson_progresses.select(:lesson_id, :lesson_part_id).limit(1).order(lesson_id: :desc, lesson_part_id: :desc).try(:first).try(:as_hash) ||\n { lesson_number: 0, lesson_part_number: 0 }\n end",
"def lesson_params\n params.require(:lesson).permit(:student_id, ... | [
"0.59804076",
"0.58620244",
"0.5823319",
"0.57557017",
"0.5707382",
"0.56811875",
"0.56293786",
"0.5610775",
"0.55601794",
"0.5554236",
"0.5501579",
"0.55004597",
"0.543464",
"0.5434406",
"0.5432274",
"0.54178995",
"0.5381225",
"0.53773767",
"0.53429246",
"0.53400326",
"0.533... | 0.8365361 | 0 |
We give the possibility to ensure the termination of the process because wkhtmltopdf 0.10 RC2 never terminates. To do so we need to launch a subprocess, and kill it after a given time (30 by default). Otherwise ( for wkhtmltopdf <= 0.9 ) we can simply go through stdin and invoke the command as it will not hand indefine... | def process_pdf(path, invoke, tmp, opts)
if opts[:ensure_termination]
@process = IO.popen(invoke)
watcher = PDFKit::Watcher.new(path, with_delay: 10, timeout: opts[:timeout])
watcher.watch_for_end_of_file do
Process.kill :SIGINT, @process.pid
tmp.close if tmp
end
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pdf_from_string(string, output_file = '-')\n puts Process.pid\n path = self.exe_path()\n # Don't spew errors to the standard out...and set up to take IO\n # as input and output\n path << ' --silent - -o -'\n\n # Show the command used...\n logger.info \"\\n\\nPRINCE XML PDF COMMAND\"\n l... | [
"0.6241992",
"0.5995697",
"0.5812576",
"0.57880825",
"0.57260936",
"0.56584215",
"0.56172806",
"0.56162745",
"0.5612224",
"0.5601237",
"0.55991346",
"0.55587107",
"0.55097526",
"0.5448689",
"0.5428252",
"0.53779876",
"0.53717935",
"0.5343454",
"0.5320687",
"0.52623355",
"0.52... | 0.74233055 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_tint
@tint = Tint.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 tint_params
params.fetch(:tint, {}).permit(:name)
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.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
a method used to specify which keys are allowed through params into the controller we use this method to create a list of what's permitted to be passed to .create or .update within controller actions. | def dog_params
allowed_params = %w(name birthdate breed image_url)
params.select {|param,value| allowed_params.include?(param)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end",
"def permitted_keys\n @permitted_keys ||= properties.map(&:to_sym)\n end",
"def keylist_params\n params.require(:keylist).permit(:keywords, :active, resources: [:id, :name] )\n end"... | [
"0.7146462",
"0.69548476",
"0.69402665",
"0.6838222",
"0.6821596",
"0.67549956",
"0.6648979",
"0.6591733",
"0.6579997",
"0.6559735",
"0.6529477",
"0.65087056",
"0.6508667",
"0.64871293",
"0.64599615",
"0.6416557",
"0.63735425",
"0.63237756",
"0.6321728",
"0.6312636",
"0.63116... | 0.0 | -1 |
Encrypts message Returns the base64 encoded ciphertext plus IV. In addtion, the message is prepended with a MAC code to prevent chosen ciphertext attacks. | def encrypt(message)
# encrypt the message
encrypted = encrypt_message(message)
[authenticate_message(encrypted) + encrypted].pack('m0')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt_message(message)\n aes = OpenSSL::Cipher.new(@cipher).encrypt\n aes.key = @encryption_key\n iv = aes.random_iv\n aes.iv = iv\n iv + (aes.update(message) << aes.final)\n end",
"def encrypt(msg, key)\n Rails.logger.debug \"AesEncryptDecrypt::encrypt::BEGIN\"\n begin\n ... | [
"0.7603261",
"0.7422204",
"0.72127545",
"0.70712095",
"0.7041814",
"0.69486827",
"0.690345",
"0.68635976",
"0.6844252",
"0.6840219",
"0.6822505",
"0.68008137",
"0.6749164",
"0.6715351",
"0.67122966",
"0.67085296",
"0.66957134",
"0.6692231",
"0.66839844",
"0.6657651",
"0.66200... | 0.73440117 | 2 |
decrypts base64 encoded ciphertext First, it checks the message tag and returns nil if that fails to verify. Otherwise, the data is passed on to the AES function for decryption. | def decrypt(ciphertext)
ciphertext = ciphertext.unpack('m').first
tag = ciphertext[0, hmac_length]
ciphertext = ciphertext[hmac_length..-1]
# make sure we actually had enough data for the tag too.
if tag && ciphertext && verify_message(tag, ciphertext)
decrypt_ciphertext(ci... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(encrypted)\n return nil unless encrypted =~ /Validation: (.*?)\\n(.*)\\n\\*\\*\\*/m\n begin\n decipher = OpenSSL::Cipher.new(\"AES-128-CBC\")\n decipher.decrypt\n # puts \"**** $1=#{$1}, $2=#{$2}\"\n decipher.key = EMAIL_KEY\n decipher.iv = Base64.decode64($1)\n encry... | [
"0.73273313",
"0.7276345",
"0.7268724",
"0.70837474",
"0.7082919",
"0.7042677",
"0.7018997",
"0.7018551",
"0.69879705",
"0.69822705",
"0.69626665",
"0.69248116",
"0.69099593",
"0.68165076",
"0.68053705",
"0.68031913",
"0.6789992",
"0.6768694",
"0.6742283",
"0.673976",
"0.6738... | 0.7815133 | 0 |
HMAC digest of the message using the given secret | def hmac(secret, message)
OpenSSL::HMAC.digest(@hmac, secret, message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def digest(message)\n OpenSSL::HMAC.digest SHA256, @secret, message\n end",
"def get_hmac_hash(secret, data)\n algo = 'SHA1'\n _digest = OpenSSL::Digest.new(algo)\n OpenSSL::HMAC.hexdigest(_digest, secret, data)\n end",
"def hash(message)\n OpenSSL::HMAC.hexdigest(\n @hmac,\n ... | [
"0.78452456",
"0.7483105",
"0.74293244",
"0.73352784",
"0.723363",
"0.70709956",
"0.68988",
"0.68962747",
"0.681999",
"0.67963487",
"0.6792221",
"0.6792221",
"0.6741822",
"0.6726985",
"0.67094934",
"0.666602",
"0.6626586",
"0.66227156",
"0.652055",
"0.64034367",
"0.63998044",... | 0.8551566 | 0 |
returns the message authentication tag This is computed as HMAC(authentication_key, message) | def authenticate_message(message)
hmac(@authentication_key, message)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign(message)\n OpenSSL::HMAC.digest('SHA256', @key, message)\n end",
"def authenticate_hmac\n key = Rails.application.credentials[Rails.env.to_sym][:clicksign][:webhook_hmac_key]\n puts\n data = request.body.read\n puts \"------ Our Hmac ------\"\n puts mac = OpenSSL::HMAC.hexdigest(\"SHA... | [
"0.6446183",
"0.64198315",
"0.62839866",
"0.62478256",
"0.6230681",
"0.6221209",
"0.61251605",
"0.60958767",
"0.6074475",
"0.6061196",
"0.6048863",
"0.60326844",
"0.5982503",
"0.59524494",
"0.5902754",
"0.587585",
"0.58489853",
"0.5800853",
"0.57931805",
"0.5787615",
"0.57840... | 0.7685715 | 0 |
verifies the message This does its best to be constant time, by use of the rack secure compare function. | def verify_message(tag, message)
own_tag = authenticate_message(message)
Rack::Utils.secure_compare(tag, own_tag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify(msg)\n \t\t\t\tbegin\n \t\t\t\t\tx,y,z,cmd,sig,iv = msg.split(/\\|/)\n \t\t\t\t\treturn nil unless iv\n \t\t\t\t\tdigest = Digest::MD5.hexdigest(cmd+iv).upcase\n \t\t\t\t\tsb1 = [@signature_block + digest].pack(\"h*\")\n \t\t\t\t\tsb2 = @signingkey_pub.public_decrypt([sig].pack(\"h*\"))\n \t\t\t\... | [
"0.63574827",
"0.61422086",
"0.60918546",
"0.60597736",
"0.60597736",
"0.60257363",
"0.5987778",
"0.592249",
"0.59141976",
"0.5892478",
"0.58918697",
"0.58614945",
"0.5759414",
"0.57036555",
"0.5675873",
"0.5669366",
"0.56344646",
"0.5634008",
"0.56257313",
"0.562365",
"0.556... | 0.6437366 | 0 |
Encrypt Encrypts the given message with a random IV, then returns the ciphertext with the IV prepended. | def encrypt_message(message)
aes = OpenSSL::Cipher.new(@cipher).encrypt
aes.key = @encryption_key
iv = aes.random_iv
aes.iv = iv
iv + (aes.update(message) << aes.final)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(iv, message)\n Util.validate_bytestring(\"IV\", iv, length: Block::SIZE)\n return \"\".b if message.empty?\n\n @cipher.iv = iv\n @cipher.update(message) + @cipher.final\n end",
"def random_iv\n _setup(:encrypt)\n @cipher.random_iv\n end",
"def... | [
"0.7406386",
"0.68528396",
"0.6724044",
"0.6716781",
"0.6537176",
"0.65099406",
"0.6485357",
"0.6461591",
"0.6428543",
"0.6423038",
"0.64119434",
"0.6403558",
"0.63264287",
"0.6253284",
"0.62370527",
"0.6235847",
"0.6215036",
"0.61967975",
"0.6036629",
"0.60111654",
"0.597881... | 0.7904224 | 0 |
Decrypt Pulls the IV off the front of the message and decrypts. Catches OpenSSL errors and returns nil. But this should never happen, as the verify method should catch all corrupted ciphertexts. | def decrypt_ciphertext(ciphertext)
aes = OpenSSL::Cipher.new(@cipher).decrypt
aes.key = @encryption_key
iv = ciphertext[0, aes.iv_len]
aes.iv = iv
crypted_text = ciphertext[aes.iv_len..-1]
return nil if crypted_text.nil? || iv.nil?
aes.update(crypted_text) << aes.final
resc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(ciphertext)\n ciphertext = ciphertext.unpack('m').first\n tag = ciphertext[0, hmac_length]\n ciphertext = ciphertext[hmac_length..-1]\n\n # make sure we actually had enough data for the tag too.\n if tag && ciphertext && verify_message(tag, ciphertext)\n decrypt_c... | [
"0.70281386",
"0.6928264",
"0.677101",
"0.65928125",
"0.659143",
"0.6547164",
"0.65394807",
"0.6507051",
"0.64646065",
"0.6427448",
"0.641321",
"0.64091235",
"0.6408316",
"0.6404109",
"0.63925105",
"0.63651955",
"0.63630545",
"0.63525057",
"0.6344106",
"0.63032997",
"0.626689... | 0.7153285 | 0 |
TODOv2: possibly do a 'who answers first who gets the win' TODOv1: gradually harder questions TODOv1: prevent doing the same question TODOv1: add more questions in the future. POST /sms/register | def reply
body_arr = params[:Body].split(' ')
method = body_arr[0]
if method.upcase == 'REGISTER'
p "Registering User #{body_arr[1]} from #{params[:From]}"
User.register(params[:From], body_arr[1])
send_sms(params[:From], "User registered. Hello #{body_arr[1]}!")
Thread.new(params[:F... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def field_register_pharmacy(pharm_number,pharm_contact_name,staff_phone_number)\n pharm_number = standardize_number(pharm_number[0])\n\n #check to make sure this number is not already registered\n phone_number_in_db = Number.where(:id => pharm_number)\n if phone_number_in_db.count > 0\n send_try_again_sms(s... | [
"0.70561343",
"0.69524443",
"0.64752525",
"0.64624494",
"0.63759",
"0.63216615",
"0.6237691",
"0.62297535",
"0.61683244",
"0.61499864",
"0.6122006",
"0.610877",
"0.60919094",
"0.6048804",
"0.60440403",
"0.5974292",
"0.59671485",
"0.59263533",
"0.5921206",
"0.59183484",
"0.591... | 0.6513543 | 2 |
attributes are decoded into UTF8, elements in extract_indexsee are still in entities | def extract_indexterms(terms)
terms.each_with_object({}) do |t, v|
term = t&.at(ns("./primary"))&.children&.to_xml
term2 = t&.at(ns("./secondary"))&.children&.to_xml
term3 = t&.at(ns("./tertiary"))&.children&.to_xml
index2bookmark(t)
v[term] ||= {}
v[t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_html_entity; end",
"def test_in_different_access\n doc = Document.new <<-EOL\n <?xml version='1.0' encoding='ISO-8859-1'?>\n <a a=\"\\xFF\">\\xFF</a>\n EOL\n expect = \"\\303\\277\"\n expect.force_encoding(::Encoding::UTF_8)\n assert_equal( expect, doc.elements['a'].a... | [
"0.59163165",
"0.58042717",
"0.57060444",
"0.5697382",
"0.5621544",
"0.55791485",
"0.53842133",
"0.537349",
"0.5339549",
"0.53115803",
"0.5264969",
"0.5258851",
"0.52573",
"0.52383506",
"0.5237643",
"0.5191076",
"0.5178422",
"0.5164639",
"0.5164103",
"0.5136231",
"0.51139516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def rsvp_params
params.require(:rsvp).permit(:guest_email, :guest_name, :menu_option, :guest_attending, :guest_note, guests_attributes: [:id, :guest_name, :menu_option])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
this could be a little faster if it simply modifies the state of the initial board | def play_some_moves(game)
first_player = game.active_player
second_player = game.inactive_player
size = game.board_size
moves = [size + 1, 2*size - 2, 3*size + 1, 4*size - 2]
i = 0
2.times do
[first_player, second_player].each do |player|
game.new_move(moves[i], player)
i += 1
end
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_board\n #clear previous move_list from all pieces\n @board.each do |row|\n row.each do |col|\n col.move_list = [] if !col.nil?\n end\n end\n #clear previous state of @all_pieces\n @all_pieces = []\n #adds every piece obj to all_pieces instance variable\n @board.each... | [
"0.7439787",
"0.73368883",
"0.72088593",
"0.7175957",
"0.7086274",
"0.7035302",
"0.6991589",
"0.68844324",
"0.68512434",
"0.68308514",
"0.67942345",
"0.67916775",
"0.6760446",
"0.67366374",
"0.6713965",
"0.6702584",
"0.66877204",
"0.6667002",
"0.66659135",
"0.66437256",
"0.66... | 0.0 | -1 |
Counts the statistics shown in the statistics page | def count_stuff
@members.each do |member|
if member.active
@active += 1
if member.paymentstatus && member.membershipyear.to_i == Time.now.year.to_i
@paidthisyear += 1
end
if !member.membergroup.onetimefee || member.membershipyear.to_i == Time.now.year.to_i
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats\n\t\t@counts\n\tend",
"def statistics; end",
"def counts\r\n @counts\r\n end",
"def stats\n ## TODO:\n end",
"def stats\n end",
"def stats\n end",
"def stats\n \n end",
"def stats; end",
"def stats; end",
"def resource_count_stats\n klass = klass_from_controller(contro... | [
"0.7878029",
"0.74778706",
"0.74774194",
"0.7419211",
"0.7279741",
"0.7279741",
"0.72453296",
"0.72393703",
"0.72393703",
"0.70575315",
"0.70319307",
"0.7022116",
"0.7010446",
"0.6964484",
"0.6964484",
"0.6945122",
"0.69425946",
"0.6929394",
"0.69222516",
"0.68009657",
"0.679... | 0.0 | -1 |
Shutdown nonessential services on all nodes. | def services
begin
# prepare the scripts for various actions necessary for the upgrade
service_object = CrowbarService.new(Rails.logger)
service_object.prepare_nodes_for_os_upgrade
rescue => e
msg = e.message
Rails.logger.error msg
return {
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def shutdown_all\n # TODO: implement\n shutdown\n end",
"def stop_all\n @servers.each do |s|\n terminate_server(s) if s.state == 'operational' || s.state == 'stranded'\n end\n @servers.each { |s| s.wait_for_state(\"stopped\") }\n # unset dns in our local cached copy.... | [
"0.70479417",
"0.70337504",
"0.6909582",
"0.6693615",
"0.6663803",
"0.6609096",
"0.6586359",
"0.6545981",
"0.65163594",
"0.64899683",
"0.6453855",
"0.6339498",
"0.61504203",
"0.6143099",
"0.6098878",
"0.60910577",
"0.60661995",
"0.6008423",
"0.60038894",
"0.59855556",
"0.5955... | 0.0 | -1 |
Orchestrate the upgrade of the nodes | def nodes
# check for current global status
# 1. TODO: return if upgrade has finished
# 2. TODO: find the next big step
next_step = "controllers"
if next_step == "controllers"
# TODO: Save the "current_step" to global status
if upgrade_controller_nodes
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initiate_nodes_upgrade\n upgrade_nodes = Node.all.reject do |node|\n node.admin? || node[:platform] == \"windows\" || node.state != \"crowbar_upgrade\"\n end\n check_if_nodes_are_available upgrade_nodes\n admin_node = Node.admin_node\n upgrade_nodes_failed = []\n\n upgrade_nodes.each do ... | [
"0.7554532",
"0.7462849",
"0.6850003",
"0.6735649",
"0.65542847",
"0.6491733",
"0.62312084",
"0.6207003",
"0.6185211",
"0.6140981",
"0.6138088",
"0.60332733",
"0.6010352",
"0.59993535",
"0.59479713",
"0.59143764",
"0.5891707",
"0.5874153",
"0.58546835",
"0.58489525",
"0.57860... | 0.5886114 | 17 |
GET /cms/home_banners GET /cms/home_banners.json | def index
@cms_home_banners = Cms::HomeBanner.all.order(visible_finish_at: :asc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def index\n @banners = Banner.all\n end",
"def index \n @banners = Banner.for_admin\n end",
"def show\n render json: @banner\n end... | [
"0.7617332",
"0.7427251",
"0.71667653",
"0.71614194",
"0.69896835",
"0.690018",
"0.6762686",
"0.67458415",
"0.67284644",
"0.6625782",
"0.66039985",
"0.6552299",
"0.6530506",
"0.65030384",
"0.6491294",
"0.63860303",
"0.6370789",
"0.63450485",
"0.6273226",
"0.6269563",
"0.62695... | 0.72992086 | 2 |
GET /cms/home_banners/1 GET /cms/home_banners/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end",
"def show\n render json: @banner\n end",
"def index\n @banners = Banner.all\n end",
"def index \n @banners = Banner.for_admin\n end... | [
"0.76404876",
"0.73160994",
"0.73149335",
"0.7059275",
"0.6957446",
"0.6937437",
"0.68985164",
"0.68970716",
"0.68741167",
"0.6748549",
"0.66805696",
"0.66592497",
"0.66401756",
"0.6638987",
"0.6638987",
"0.65875536",
"0.6564328",
"0.6536983",
"0.6468776",
"0.6461794",
"0.643... | 0.0 | -1 |
POST /cms/home_banners POST /cms/home_banners.json | def create
@cms_home_banner = Cms::HomeBanner.new(cms_home_banner_params)
respond_to do |format|
if @cms_home_banner.save
format.html { redirect_to @cms_home_banner, notice: 'Home banner was successfully created.' }
format.json { render action: 'show', status: :created, location: @cms_hom... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @banner = Banner.new(admin_banner_params)\n @banner.bannerable_type = \"Article\"\n @banner.bannerable_id = Article.last.id\n @banner.banner_category_id = BannerCategory.last.id\n respond_to do |format|\n if @banner.save\n format.html { redirect_to admin_banners_url, notice:... | [
"0.70602566",
"0.6943547",
"0.69143593",
"0.66991866",
"0.6666573",
"0.6653173",
"0.6607653",
"0.6564946",
"0.65568805",
"0.654697",
"0.6476625",
"0.64328253",
"0.6397929",
"0.63350433",
"0.63350433",
"0.6320486",
"0.62517637",
"0.6193437",
"0.6190761",
"0.61652154",
"0.60874... | 0.71026444 | 0 |
PATCH/PUT /cms/home_banners/1 PATCH/PUT /cms/home_banners/1.json | def update
respond_to do |format|
if @cms_home_banner.update(cms_home_banner_params)
puts "################## visible_start_at: #{@cms_home_banner.visible_start_at}"
puts "################## visible_start_at utc: #{@cms_home_banner.visible_start_at.utc}"
puts "################## visibl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @banner = Banner.find(params[:id])\n\n respond_to do |format|\n if @banner.update_attributes(params[:banner])\n format.html { redirect_to admin_banner_path(@banner), notice: 'Banner was successfully updated.' }\n format.json { head :no_content }\n else\n format.htm... | [
"0.7078168",
"0.6990218",
"0.69440377",
"0.6896474",
"0.6767258",
"0.6746078",
"0.67422396",
"0.6586845",
"0.65046465",
"0.6501439",
"0.6385567",
"0.63853216",
"0.6303311",
"0.6238747",
"0.61898726",
"0.61673975",
"0.6155975",
"0.61473364",
"0.61188734",
"0.6115122",
"0.60834... | 0.6185984 | 15 |
DELETE /cms/home_banners/1 DELETE /cms/home_banners/1.json | def destroy
@cms_home_banner.destroy
respond_to do |format|
format.html { redirect_to cms_home_banners_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |for... | [
"0.7754969",
"0.76620996",
"0.7363143",
"0.7262334",
"0.72584516",
"0.7229907",
"0.7181691",
"0.7133149",
"0.7129677",
"0.7121993",
"0.7120946",
"0.71065134",
"0.705448",
"0.7042957",
"0.6974244",
"0.6919486",
"0.68573177",
"0.68310374",
"0.6718516",
"0.670423",
"0.66904676",... | 0.7813287 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_cms_home_banner
@cms_home_banner = Cms::HomeBanner.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def cms_home_banner_params
params.require(:cms_home_banner).permit(:name, :redirect_url, :visible_start_at, :visible_finish_at, :is_visible, :image, :image_remote_url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.