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 |
|---|---|---|---|---|---|---|
initialize a DCE/RPC Function Call | def initialize(handle, socket, useroptions = Hash.new)
self.handle = handle
self.socket = socket
self.options = {
'smb_user' => '',
'smb_pass' => '',
'smb_pipeio' => 'rw',
'smb_name' => nil,
'read_timeout' => 10,
'connect_timeout' => 5
}
self.options.mer... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*)\n super\n @json_rpc_call_id = 0\n @json_rpc_endpoint = URI.parse(currency.rpc)\n end",
"def initialize\n @xmlrpc = ::XMLRPC::Marshal.new\n end",
"def new_function_call\n\t\t\t return create_function_call(SAPNW::RFC::FunctionCall)\n\t\t\tend",
"def initial... | [
"0.6539662",
"0.6278152",
"0.6147834",
"0.59695613",
"0.5963122",
"0.58888793",
"0.5850186",
"0.58359414",
"0.580984",
"0.57844204",
"0.56751996",
"0.5642232",
"0.5597408",
"0.5590486",
"0.5589582",
"0.5583824",
"0.55624396",
"0.5559607",
"0.555768",
"0.55562997",
"0.554995",... | 0.0 | -1 |
Create the appropriate socket based on protocol | def socket_setup()
ctx = { 'Msf' => self.options['Msf'], 'MsfExploit' => self.options['MsfExploit'] }
self.socket = case self.handle.protocol
when 'ncacn_ip_tcp'
Rex::Socket.create_tcp(
'PeerHost' => self.handle.address,
'PeerPort' => self.handle.options[0],
'Context... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(param)\n\t\tsock = nil\n\n\t\t# Notify handlers before we create the socket\n\t\tnotify_before_socket_create(self, param)\n\n\t\tcase param.proto\n\t\t\twhen 'tcp'\n\t\t\t\tsock = net.socket.create(param)\n\t\t\telse\n\t\t\t\traise Rex::UnsupportedProtocol.new(param.proto), caller\n\t\tend\n\n\t\t# Noti... | [
"0.7638809",
"0.76018035",
"0.7379566",
"0.6930905",
"0.6860626",
"0.6855656",
"0.6850141",
"0.67452824",
"0.6710426",
"0.6586399",
"0.6557928",
"0.65422267",
"0.648376",
"0.6447988",
"0.64448607",
"0.64063406",
"0.6371792",
"0.6362339",
"0.6320656",
"0.62736696",
"0.62477463... | 0.7315933 | 3 |
Write data to the underlying socket, limiting the sizes of the writes based on the pipe_write_min / pipe_write_max options. | def write(data)
max_write = self.options['pipe_write_max_size'] || data.length
min_write = self.options['pipe_write_min_size'] || max_write
if(min_write > max_write)
max_write = min_write
end
idx = 0
if (self.socket.class == Rex::Proto::SMB::SimpleClient::OpenPipe)
while(idx < da... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write(data)\n begin\n @socket.sync = false\n if data.nil?\n write_timeout([0, 0, @seq].pack(\"CvC\"), @opts[:write_timeout])\n @seq = (@seq + 1) % 256\n else\n data = StringIO.new data if data.is_a? String\n while d = data.read(MAX_PACKET_LENGTH)\n ... | [
"0.68764776",
"0.6636989",
"0.64705545",
"0.63882065",
"0.6383592",
"0.6345951",
"0.6224299",
"0.6193604",
"0.61663383",
"0.6109137",
"0.6066788",
"0.6012521",
"0.59364337",
"0.5906322",
"0.5827277",
"0.5808665",
"0.5795621",
"0.5746195",
"0.57272476",
"0.56772965",
"0.566935... | 0.76911926 | 0 |
Perform a DCE/RPC Function Call | def call(function, data, do_recv = true)
frag_size = data.length
if options['frag_size']
frag_size = options['frag_size']
end
object_id = ''
if options['object_call']
object_id = self.handle.uuid[0]
end
if options['random_object_id']
object_id = Rex::Proto::DCERPC::UUID.uu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(method, *args) rpc_execute(method, *args) end",
"def remote_call(rpc_method, request_args)\n rpc.execute(rpc_method, request_args)\n end",
"def execute_rpc_call(content)\n connection = RPCClient.new(@configuration.server_queue_name,@configuration.server_addr,@configuration.server_port)\... | [
"0.7162019",
"0.66460866",
"0.6613735",
"0.6495458",
"0.64529985",
"0.6408588",
"0.63854015",
"0.63259727",
"0.6289725",
"0.6281325",
"0.6270509",
"0.6190723",
"0.60320437",
"0.5987179",
"0.5978392",
"0.59756184",
"0.59663826",
"0.59549564",
"0.59387946",
"0.5916815",
"0.5907... | 0.646311 | 4 |
Whether this encrypter should perform encryption (returns false if the :bypass_auto_encryption option is set to true). | def encrypt?
!@options[:bypass_auto_encryption]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def should_crypt?\n @should_crypt ||= __should_crypt?\n end",
"def should_encrypt_password... | [
"0.72618496",
"0.7055772",
"0.7055772",
"0.69722813",
"0.6908347",
"0.67644066",
"0.6712017",
"0.6535698",
"0.6529186",
"0.6245663",
"0.6157023",
"0.61286736",
"0.61054534",
"0.6103612",
"0.6102979",
"0.60862094",
"0.6039057",
"0.6039057",
"0.60233426",
"0.6019946",
"0.601853... | 0.88391924 | 0 |
Encrypt a database command. | def encrypt(database_name, command)
AutoEncryptionContext.new(
@crypt_handle,
@encryption_io,
database_name,
command
).run_state_machine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encrypt(*args, &block)\n ::ActiveRecord::Base.connection.unescape_bytea(escape_and_execute_sql([\"SELECT encode(pgp_sym_encrypt(?::text, ?::text), 'escape') pgp_sym_encrypt\", value(args), key(args)])['pgp_sym_encrypt'])\n end",
"def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end",
... | [
"0.6934351",
"0.6687",
"0.6662177",
"0.6609992",
"0.6479633",
"0.6407013",
"0.6381297",
"0.6350759",
"0.6233794",
"0.61624044",
"0.60910034",
"0.60910034",
"0.60910034",
"0.60910034",
"0.60910034",
"0.6052419",
"0.6037509",
"0.6008888",
"0.5992438",
"0.59373957",
"0.590188",
... | 0.8190734 | 1 |
Decrypt a database command. | def decrypt(command)
AutoDecryptionContext.new(
@crypt_handle,
@encryption_io,
command
).run_state_machine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decrypt(*args, &block)\n escape_and_execute_sql([\"SELECT pgp_sym_decrypt(?::bytea, ?::text)\", ::ActiveRecord::Base.connection.escape_bytea(value(args)), key(args)])['pgp_sym_decrypt']\n end",
"def decrypt(*args, &block)\n crypt :decrypt, *args, &block\n end",
"def decrypt(data)\n pipe_t... | [
"0.70671755",
"0.7050485",
"0.70232534",
"0.67031235",
"0.6650498",
"0.6612653",
"0.65028214",
"0.64477664",
"0.6366756",
"0.6272213",
"0.6272213",
"0.62553835",
"0.6249811",
"0.6211801",
"0.6195287",
"0.61527413",
"0.61485916",
"0.6138624",
"0.6138233",
"0.6115414",
"0.60490... | 0.7510134 | 1 |
Close the resources created by the AutoEncrypter. | def close
@mongocryptd_client.close if @mongocryptd_client
if @key_vault_client && @key_vault_client != options[:client] &&
@key_vault_client.cluster != options[:client].cluster
then
@key_vault_client.close
end
if @metadata_client && @metadata_client != opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_encrypter\n @encrypter.close if @encrypter\n\n true\n end",
"def do_close\n @cluster.close\n close_encrypter\n end",
"def teardown_encrypter\n @mongocryptd_client.close if @mongocryptd_client\n\n @mongocryptd_client = nil\n @key_vault_client = nil\n ... | [
"0.72839427",
"0.68573195",
"0.6475421",
"0.646025",
"0.6417164",
"0.63786757",
"0.6285984",
"0.6269304",
"0.62656224",
"0.62334967",
"0.62309414",
"0.620402",
"0.617031",
"0.617031",
"0.617031",
"0.617031",
"0.6168976",
"0.6155234",
"0.61266077",
"0.6089896",
"0.6089896",
... | 0.0 | -1 |
Returns a new set of options with the following changes: sets default values for all extra_options adds idleShtudownTimeoutSecs=60 to extra_options[:mongocryptd_spawn_args] if not already present sets bypass_auto_encryption to false sets default key vault client | def set_default_options(options)
opts = options.dup
extra_options = opts.delete(:extra_options) || Options::Redacted.new
extra_options = DEFAULT_EXTRA_OPTIONS.merge(extra_options)
has_timeout_string_arg = extra_options[:mongocryptd_spawn_args].any? do |elem|
elem.is_a?(String... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_default_options(options)\n opts = options.dup\n\n extra_options = opts.delete(:extra_options)\n extra_options = DEFAULT_EXTRA_OPTIONS.merge(extra_options)\n\n has_timeout_string_arg = extra_options[:mongocryptd_spawn_args].any? do |elem|\n elem.is_a?(String) && elem.mat... | [
"0.7592366",
"0.6068077",
"0.5856887",
"0.5851017",
"0.57280946",
"0.5706331",
"0.5705585",
"0.5691094",
"0.5690777",
"0.5662071",
"0.5613209",
"0.558693",
"0.5567611",
"0.5565204",
"0.5558541",
"0.5558541",
"0.5556546",
"0.5538299",
"0.5518577",
"0.5518447",
"0.5500289",
"... | 0.7255083 | 1 |
Create additional clients for auto encryption, if necessary | def set_or_create_clients(options)
client = options[:client]
@key_vault_client = if options[:key_vault_client]
options[:key_vault_client]
elsif client.options[:max_pool_size] == 0
client
else
internal_client(client)
end
@metadata_client = if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encryption_client; end",
"def build_encrypter\n @encrypter = Crypt::AutoEncrypter.new(\n @options[:auto_encryption_options].merge(client: self)\n )\n end",
"def create_clients\n @haproxy = rpcclient('haproxy')\n @site = rpcclient('site')\n @service = rpcclient('service')\n @rpcutil ... | [
"0.7128047",
"0.6637864",
"0.63983595",
"0.636326",
"0.6261905",
"0.62061864",
"0.6150277",
"0.6130536",
"0.6110783",
"0.60882235",
"0.6028533",
"0.6023956",
"0.60042936",
"0.60005385",
"0.60002774",
"0.5981409",
"0.5757968",
"0.5757846",
"0.5757846",
"0.5726197",
"0.5720022"... | 0.6696535 | 1 |
Creates or return already created internal client to be used for auto encryption. | def internal_client(client)
@internal_client ||= client.with(
auto_encryption_options: nil,
min_pool_size: 0,
monitoring: client.send(:monitoring),
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_client\n client_public, client_private = ZMQ::Util.curve_keypair\n store_known_client(client_public)\n\n {\n server_public_key: @public_key,\n public_key: client_public,\n private_key: client_private\n }\n end",
"def create_cl... | [
"0.7131661",
"0.6964142",
"0.6602839",
"0.659781",
"0.65675753",
"0.6536657",
"0.6506389",
"0.6477032",
"0.64711404",
"0.6457924",
"0.64498234",
"0.64091545",
"0.6383069",
"0.638055",
"0.6366709",
"0.6336154",
"0.63336056",
"0.63320833",
"0.63243055",
"0.63243055",
"0.6288094... | 0.6895538 | 2 |
running $ rake db:rollback will remove the table | def down
drop_table :politicians
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rollback\n @db.rollback\n end",
"def truncate_db\n drop_table\n create_table\n end",
"def drop_table\n db.drop_table(table_name)\n end",
"def drop_tables!\n migrate(:down)\n end",
"def drop_table\n self.connection.drop_table table_name\n ... | [
"0.78407913",
"0.76578134",
"0.7580251",
"0.7539211",
"0.7524286",
"0.747389",
"0.7349866",
"0.7339923",
"0.7302541",
"0.7302541",
"0.7290539",
"0.72417355",
"0.72143525",
"0.71844363",
"0.7155083",
"0.7153269",
"0.7153269",
"0.70842266",
"0.7051016",
"0.70423716",
"0.6919467... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_gestor_area
@gestor_area = GestorArea.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 gestor_area_params
params.require(:gestor_area).permit(:area_id, :pessoa_id, :data_inicio, :data_termino, :ativo)
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.71230334",
"0.70530915",
"0.69479465",
"0.6902122",
"0.67367256",
"0.67172784",
"0.6689043",
"0.66784793",
"0.6660117",
"0.6555213",
"0.6528485",
"0.6458438",
"0.6452378",
"0.6451654",
"0.64478326",
"0.6433326",
"0.6413599",
"0.6413599",
"0.63907677",
"0.63787645",
"0.6378... | 0.0 | -1 |
human readable description of modeling approach | def modeler_description
return "Example use case is adding special loads like an elevator to a model as part of an analysis workflow"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modeler_description\n return 'Gather orientation and story specific construction, fenestration (including overhang) specific information'\n end",
"def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end",
"def m... | [
"0.7710149",
"0.75934714",
"0.74018747",
"0.7299891",
"0.7296635",
"0.727943",
"0.71912926",
"0.71912926",
"0.7191264",
"0.7100944",
"0.70977926",
"0.70629936",
"0.7045383",
"0.7044268",
"0.70413125",
"0.7040473",
"0.7032938",
"0.70267737",
"0.70182866",
"0.69875926",
"0.6980... | 0.76145315 | 1 |
define the arguments that the user will input | def arguments(model)
args = OpenStudio::Ruleset::OSArgumentVector.new
# make argument for space
space = OpenStudio::Ruleset::makeChoiceArgumentOfWorkspaceObjects("space","OS_Space".to_IddObjectType,model,true)
space.setDisplayName("Select Space for Load Instance")
args << space
# make argument... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def arguments; end",
"def arguments; end",
"def arguments; end",
"def arguments\n \"\"\n end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end",
"def args; end... | [
"0.73753476",
"0.73753476",
"0.73753476",
"0.70890766",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",
"0.7008301",... | 0.0 | -1 |
define what happens when the measure is run | def run(model, runner, user_arguments)
super(model, runner, user_arguments)
# use the built-in error checking
if !runner.validateUserArguments(arguments(model), user_arguments)
return false
end
# assign the user inputs to variables
space = runner.getOptionalWorkspaceObjectChoiceValue('sp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def measure; end",
"def measure=(_arg0); end",
"def measure\n\t\t1\n\tend",
"def measure(*args, &b)\n end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def communicate_measure_result(_ = nil, _ = nil); end",
"def called\n self.measurement.called\n end",
"def measure\n ... | [
"0.79848564",
"0.7639647",
"0.76355976",
"0.7170129",
"0.66926914",
"0.66926914",
"0.66718984",
"0.66311747",
"0.6599127",
"0.65870225",
"0.65324444",
"0.6481582",
"0.6405596",
"0.64028287",
"0.6333309",
"0.6283632",
"0.6283632",
"0.6283632",
"0.6281165",
"0.6269874",
"0.6242... | 0.0 | -1 |
This endpoint allows to search the status of flight. | def create_flight_status(body)
# Prepare query url.
_path_url = '/v1/airline/flights/actions/status'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flights\n result = Search.search_flights(params)\n if result\n # The search gave us something so we can return it\n render json: result\n else\n # Something went wrong, return a 500 error with no body\n render status: 500, json: nil\n end\n end",
"def search_status(...)\n ... | [
"0.6849581",
"0.66540754",
"0.6615017",
"0.6564172",
"0.6551583",
"0.6477663",
"0.6398683",
"0.6373105",
"0.6364397",
"0.62830853",
"0.62811834",
"0.62435615",
"0.62251574",
"0.6195616",
"0.6176018",
"0.61632705",
"0.6114024",
"0.61049366",
"0.6090004",
"0.60806763",
"0.60657... | 0.6053301 | 21 |
This endpoint allows to create a flight on the system and defines the mileage rules for the passenger. | def create_flight_creation(body)
# Prepare query url.
_path_url = '/v1/airline/flights'
_query_builder = Configuration.get_base_uri
_query_builder << _path_url
_query_url = APIHelper.clean_url _query_builder
# Prepare headers.
_headers = {
'accept' => 'applicati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @flight = Flight.new(flight_params)\n\n if @flight.save\n redirect_to admins_flights_path, notice: \"Flight was successfully created.\"\n else\n render :new, status: :unprocessable_entity\n end\n end",
"def create\n @flight = Flight.new(params[:flight])\n\n ... | [
"0.68296653",
"0.6589799",
"0.65811795",
"0.6577498",
"0.6577498",
"0.6577498",
"0.6577498",
"0.6577498",
"0.65240026",
"0.6470203",
"0.64222276",
"0.6397408",
"0.6370884",
"0.63406754",
"0.62585676",
"0.6208922",
"0.60870147",
"0.6082978",
"0.607295",
"0.6068988",
"0.6061297... | 0.5644909 | 66 |
controls the size of the image Validates the size of an uploaded picture. | def picture_size
if picture.size > 5.megabytes
errors.add(:picture, "should be less than 5MB")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def picture_size\n #errors.add(:image, 'should be less than 1MB') if image.size > 1.megabytes\n end",
"def picture_size\n errors.add :picture, t(\"upload_image_fail_msg\") if\n picture.size > Settings.limit_size_image.megabytes\n end",
"def picture_size\n errors.add(:picture, \"Settings.revi... | [
"0.79197097",
"0.7900917",
"0.78383046",
"0.7812938",
"0.7755706",
"0.7739449",
"0.77181834",
"0.77181834",
"0.77119845",
"0.7708025",
"0.77009445",
"0.77009445",
"0.76894385",
"0.768411",
"0.7678451",
"0.7676299",
"0.76750463",
"0.76608485",
"0.7636857",
"0.763275",
"0.76279... | 0.7591638 | 39 |
Generates a generic page title. Prepend +title+ with "gbchaosmaster" and a pipe for separation. If +title+ is blank, simply return "gbchaosmaster". page_title "Test Page" => "gbchaosmaster | Test Page" page_title nil => "gbchaosmaster" | def page_title(title)
"gbchaosmaster#{" | #{title}" unless title.blank?}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_title(page_title)\n puts @me.valid_user?\n if !@me.valid_user?\n site_title=\"Delta Kappa Epsilon - Sigma Tau\"\n else\n site_title=\"DKE Server\"\n end\n if (page_title!=\"\")\n return \"#{site_title} | #{page_title}\" \n else\n return site_title\n end\n end",
"... | [
"0.7925586",
"0.7809342",
"0.7803258",
"0.77756536",
"0.77394265",
"0.7739256",
"0.77079844",
"0.7650251",
"0.76311827",
"0.7623579",
"0.7589368",
"0.75782526",
"0.75709385",
"0.75579494",
"0.75576574",
"0.7548219",
"0.75446904",
"0.7524823",
"0.75178903",
"0.7514656",
"0.751... | 0.8203214 | 0 |
Generates a link for a navigation bar. It is an li element and will have the active class if the current location is in +paths+. If the current page is the root of the website: nav_link "Home", root_path => 'Home' If the current page is not the root of the website: nav_link "Home", root_path => 'Home' If multiple paths... | def nav_link(text, *paths)
attrs = paths.any? { |p| current_page?(p) } ? { :class => "active" } : {}
content_tag(:li, attrs) { link_to text, paths.first }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nav_link(text, path, link_args={})\n if path.kind_of? Array\n current = path.any? do |p|\n current_page?(p)\n end\n path = path[0]\n else\n current = current_page?(path)\n end\n\n link_args[:class] = \"#{current ? 'active' : ''} nav-link #{link_args[:class] || ''}\"\n\n ... | [
"0.73931694",
"0.70898575",
"0.692556",
"0.6834843",
"0.6833218",
"0.6824942",
"0.6781657",
"0.67557305",
"0.6713979",
"0.6592157",
"0.6551825",
"0.65287536",
"0.64468974",
"0.6446389",
"0.6425374",
"0.6413514",
"0.6412865",
"0.63116443",
"0.62895864",
"0.62798136",
"0.623489... | 0.7618068 | 0 |
Tested for [puma, thin, unicorn, webrick, Passenger] | def server_pids
`lsof -wni | grep ruby | grep IPv4 | awk '{print $2}'`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n flags = \"--config config/puma.rb --pidfile #{PID_FILE}\"\n system \"puma #{flags} > /dev/null 2>&1\"\n sleep(0.1)\n rails?\n end",
"def puma?\n option?(\"puma\")\n end",
"def start_unicorn\n puts \"Starting unicorn...\"\n for app in @apps\n # unicorn\n @confi... | [
"0.6397659",
"0.61415595",
"0.59291494",
"0.5855293",
"0.5841216",
"0.575296",
"0.56749874",
"0.56114256",
"0.5603478",
"0.55988693",
"0.55908835",
"0.55124366",
"0.5510969",
"0.54710746",
"0.5441891",
"0.5439759",
"0.5395343",
"0.53662574",
"0.5338841",
"0.5336932",
"0.53319... | 0.0 | -1 |
register a platform name | def platform(name=nil, path=nil)
error "Platform name is blank" if name.blank?
error "Platform path is blank" if path.blank?
error "Platform name is not a string" unless name.kind_of?(String)
debug "Registering platform name [#{name}] by engine path [#{path}]"
error ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_with_system(name)\n @unique_id = name.object_id\n end",
"def set_platform_name(name)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_set_platform_name(@handle.ptr, name)\n end",
"def platform_name\n self.pl... | [
"0.69418705",
"0.6764071",
"0.6753172",
"0.674723",
"0.669337",
"0.6612469",
"0.6560629",
"0.65149385",
"0.6347055",
"0.6340858",
"0.62837094",
"0.62524706",
"0.62071586",
"0.61959577",
"0.6172444",
"0.60425633",
"0.59939265",
"0.5974244",
"0.5974244",
"0.5961412",
"0.5921958... | 0.7697084 | 0 |
array of registered string engine names: ['totem', 'totem_core', ...] | def engines; engine_names; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engines\n self.class.engines_for_name(name)\n end",
"def engines_for_name(name)\n components_for_name(name).last\n end",
"def engines\n owner.json_api_command('tts-engines')\n end",
"def engines\n @engines\n end",
"def name_and_engine\n @engine_name_and_... | [
"0.71207666",
"0.6734724",
"0.6483996",
"0.64119405",
"0.6411118",
"0.6399408",
"0.6348651",
"0.63226324",
"0.6208553",
"0.6184096",
"0.61754787",
"0.616738",
"0.61513853",
"0.5867653",
"0.5866222",
"0.5844569",
"0.57978916",
"0.579348",
"0.57632893",
"0.5684904",
"0.5679987"... | 0.7655895 | 0 |
registered string framework name | def framework_name; registered_framework_name; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def framework_name\n self.name.split(\"::\").last.downcase\n end",
"def framework_name\n self.name.split(\"::\").last.downcase\n end",
"def platform_name; non_framework_platforms.first; end",
"def module_specifier_prefix\n if target.requires_frameworks?\n 'fram... | [
"0.76612204",
"0.76612204",
"0.64612365",
"0.6445506",
"0.634857",
"0.62026906",
"0.61614686",
"0.61385125",
"0.606731",
"0.60125387",
"0.600671",
"0.59998256",
"0.59795773",
"0.59790075",
"0.5973067",
"0.5938773",
"0.5909473",
"0.58711797",
"0.58711797",
"0.5836265",
"0.5820... | 0.83171517 | 0 |
array of string platform names: ['totem', 'platform', ...] | def platforms; platform_names; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def names\n platforms.map { |m| m.realname }\n end",
"def platform_list; ['all','xbox-360']; end",
"def default_platform_list\n [\n metadata.platform,\n *ruby_versions,\n *platforms,\n RbConfig::CONFIG['build']\n ]\n end",
"def all_plat... | [
"0.8087931",
"0.8012887",
"0.7395641",
"0.7392887",
"0.7348418",
"0.7341621",
"0.7303891",
"0.72947615",
"0.72838926",
"0.70222414",
"0.7018649",
"0.70133764",
"0.70074314",
"0.69786555",
"0.69771034",
"0.6911944",
"0.6911944",
"0.6897852",
"0.6894755",
"0.68660116",
"0.68496... | 0.85029393 | 0 |
assumes only one platform is running | def platform_name; non_framework_platforms.first; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def platform; end",
"def platform; end",
"def platform; end",
"def platform\n @platform ||= NoPlatform.new\n end",
"def platform\n raise NotImplementedError\n end",
"def platform\n raise NotImplementedError\n end",
"def valid_for_platform?; true; end",
"def platform\n @platform ||=... | [
"0.7777959",
"0.7777959",
"0.7777959",
"0.73855954",
"0.73657197",
"0.73657197",
"0.72230595",
"0.71345466",
"0.7060319",
"0.7060319",
"0.69603604",
"0.693154",
"0.693154",
"0.693154",
"0.6924074",
"0.6908046",
"0.6882995",
"0.6854704",
"0.6844907",
"0.67970407",
"0.6751769",... | 0.7099726 | 8 |
A new Driver instance with the given bridge. End users should use Selenium::WebDriver.for instead of using this directly. | def initialize(bridge, listener: nil)
@bridge = bridge
@bridge = Support::EventFiringBridge.new(bridge, listener) if listener
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_bridge(**opts)\n # for a new session request\n capabilities = opts.delete(:capabilities)\n bridge_opts = { http_client: opts.delete(:http_client), url: opts.delete(:url) }\n\n # for attaching to an existing session\n session_id = opts.delete(:existing_session... | [
"0.6765548",
"0.6549758",
"0.6311109",
"0.61391103",
"0.6125926",
"0.6062246",
"0.5937645",
"0.58854544",
"0.58355975",
"0.57812893",
"0.57768846",
"0.57540095",
"0.5749629",
"0.5749117",
"0.57432747",
"0.5722259",
"0.57148206",
"0.56932133",
"0.56876117",
"0.5666094",
"0.566... | 0.5263259 | 57 |
Opens the specified URL in the browser. | def get(url)
navigate.to(url)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open(url = @url)\n @browser.goto(url)\n wait_for_page_to_load\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open url\r\n command 'open', url_arg(url)\r\n end",
"def open_in_browser\n puts url\n `#{open} #{url}`\n end",
"def launch_browser(url)\n ... | [
"0.84294695",
"0.8407227",
"0.8407227",
"0.8354444",
"0.7973764",
"0.7948728",
"0.7948728",
"0.79295677",
"0.7855403",
"0.78456765",
"0.78176904",
"0.7814156",
"0.7649492",
"0.76404667",
"0.7610762",
"0.75995076",
"0.7589617",
"0.75871116",
"0.75786155",
"0.75419116",
"0.7503... | 0.63166964 | 67 |
Get the URL of the current page | def current_url
bridge.url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_url\n page.current_url\n end",
"def current_url\n page.current_url\n end",
"def current_url\n @rawpage.current_url\n end",
"def current_url\n evaluate(\"window.top.location.href\")\n end",
"def current_url\n request.env['REQUEST_URI']\n end",
"def curre... | [
"0.886142",
"0.886142",
"0.86133146",
"0.81880516",
"0.81306684",
"0.8050739",
"0.80100894",
"0.7834755",
"0.7808778",
"0.77781594",
"0.77584475",
"0.7673884",
"0.7639655",
"0.7639655",
"0.7587113",
"0.7570786",
"0.75698334",
"0.7531697",
"0.7525201",
"0.7494421",
"0.74900633... | 0.7303078 | 28 |
Get the title of the current page | def title
bridge.title
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_title\n page.title\n end",
"def title\n @title_pages.each { |tp| tp.title and return tp.title }\n nil\n end",
"def title\n @global_page.title\n end",
"def page_title\n @web_browser.page_title\n end",
"def page_title\n @page_title ||= format_strin... | [
"0.8640375",
"0.85080403",
"0.8472251",
"0.83716315",
"0.82762736",
"0.8269075",
"0.82617664",
"0.8243131",
"0.8178011",
"0.8116256",
"0.8005099",
"0.8005026",
"0.7994893",
"0.7986339",
"0.7954728",
"0.7945814",
"0.7944264",
"0.79423314",
"0.79090506",
"0.7904128",
"0.7897690... | 0.0 | -1 |
Get the source of the current page | def page_source
bridge.page_source
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def page_source\r\n @browser.page_source\r\n end",
"def page_source\n @web_browser.page_source\n end",
"def page_source\r\n @web_browser.page_source\r\n end",
"def html_source\n @page_source.page_source\n end",
"def current_url\n @rawpage.current_url\n end",
"d... | [
"0.82085437",
"0.818482",
"0.81673557",
"0.77395374",
"0.74788296",
"0.74394286",
"0.7306498",
"0.7119335",
"0.70359874",
"0.70359874",
"0.700822",
"0.6984468",
"0.69714725",
"0.67414075",
"0.67414075",
"0.6706782",
"0.6703949",
"0.6674284",
"0.66260195",
"0.6578876",
"0.6525... | 0.78113675 | 3 |
Close the current window, or the browser if no windows are left. | def close
bridge.close
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close()\r\n #puts \"current window number is : #{@@current_window}\"\r\n # Derek Berner 5/16/08\r\n # Try to join thread only if there is exactly one open window\r\n if js_eval(\"getWindows().length\").to_i == 1\r\n $jssh_socket.send(\" getWindows()[0]... | [
"0.78896767",
"0.7718472",
"0.766629",
"0.76594883",
"0.7577414",
"0.75425416",
"0.73647845",
"0.70748276",
"0.7019478",
"0.7011655",
"0.7007609",
"0.69853216",
"0.6936468",
"0.6897215",
"0.68433434",
"0.68182796",
"0.68169916",
"0.6808719",
"0.67738056",
"0.6765209",
"0.6759... | 0.0 | -1 |
Get the window handles of open browser windows. | def window_handles
bridge.window_handles
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def window_handles\n driver.window_handles\n end",
"def windows\n @driver.getWindowList.map do |java_window|\n QuickWindow.new(self,java_window)\n end.to_a\n end",
"def get_window_count\n return @browser.windows.count\n end",
"def firefox_windows(w = nil)\n\t\t\tcollection = [... | [
"0.7535629",
"0.7270034",
"0.71273226",
"0.6849873",
"0.6761626",
"0.66838485",
"0.63624346",
"0.6241978",
"0.6189276",
"0.616665",
"0.60464746",
"0.6037284",
"0.5969696",
"0.5853533",
"0.5799085",
"0.571166",
"0.5577692",
"0.55712867",
"0.5560847",
"0.55448204",
"0.5524869",... | 0.7942548 | 0 |
Get the current window handle | def window_handle
bridge.window_handle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_window\n @driver.window_handle\n rescue Selenium::WebDriver::Error::NoSuchWindowError\n nil\n end",
"def window_handle; end",
"def window\n @session.request(:vim_get_current_window)\n end",
"def window_handle\n driver.window_handle\n end",
"def hwnd\n Functi... | [
"0.7781272",
"0.76789564",
"0.7620053",
"0.75736654",
"0.7384918",
"0.72361344",
"0.72247577",
"0.72045654",
"0.7137868",
"0.7121852",
"0.6991232",
"0.69166875",
"0.6916038",
"0.6916038",
"0.6916038",
"0.67955166",
"0.66971135",
"0.66764915",
"0.66752243",
"0.66608435",
"0.66... | 0.8232448 | 0 |
Execute the given JavaScript | def execute_script(script, *args)
bridge.execute_script(script, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def j(javascript); end",
"def eval(js_code)\n full_cmd = @cmd % [escape_js(js_code)]\n `#{full_cmd}`\n end",
"def js_exec(js, timeout=30)\n print_status \"Running the privileged javascript...\"\n token = \"[[#{Rex::Text.rand_text_alpha(8)}]]\"\n js = js_obfuscate(js)\n session.shell_write(\"... | [
"0.74986565",
"0.71592474",
"0.7064215",
"0.7051076",
"0.6906406",
"0.67509776",
"0.66380864",
"0.6637981",
"0.6626376",
"0.6605366",
"0.658144",
"0.64053416",
"0.63955986",
"0.63835084",
"0.6375848",
"0.6234883",
"0.6233394",
"0.6199132",
"0.6199107",
"0.61919606",
"0.617733... | 0.57812625 | 41 |
Execute an asynchronous piece of JavaScript in the context of the currently selected frame or window. Unlike executing execute_script (synchronous JavaScript), scripts executed with this method must explicitly signal they are finished by invoking the provided callback. This callback is always injected into the executed... | def execute_async_script(script, *args)
bridge.execute_async_script(script, *args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute_callback(callback, *args)\n callback.call(*args) if callback\n end",
"def execute_script(script)\n current_frame.executeJavaScript(script)\n nil\n end",
"def execute(callback)\n unlock(:server)\n\n runtime_lock.execute(callback) do\n yield\n end\n ... | [
"0.5917898",
"0.58580285",
"0.5479702",
"0.5419432",
"0.5117172",
"0.50060207",
"0.4985286",
"0.4919477",
"0.47343296",
"0.46283385",
"0.4607438",
"0.45533097",
"0.45455554",
"0.4511543",
"0.44998994",
"0.44507954",
"0.44328284",
"0.44314447",
"0.44156158",
"0.43790162",
"0.4... | 0.5777386 | 2 |
Get the first element matching the given selector. If given a String or Symbol, it will be used as the id of the element. | def [](sel)
sel = {id: sel} if sel.is_a?(String) || sel.is_a?(Symbol)
find_element sel
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(selector)\n DOM::Element.from_node `#{@el}.querySelector(#{selector}) || Opal.nil`\n end",
"def find(selector)\n value = `#{@el}.querySelector(#{selector}) || false`\n value ? DOM::Element.fromNode(value) : nil\n end",
"def find_first(selector, data)\n data = @data unless data\... | [
"0.73091274",
"0.7219662",
"0.6720538",
"0.6613143",
"0.6274973",
"0.62003124",
"0.6190621",
"0.6160567",
"0.61303085",
"0.612353",
"0.6015964",
"0.59812623",
"0.5957856",
"0.587633",
"0.58339286",
"0.57866436",
"0.57444876",
"0.5739463",
"0.5738925",
"0.5659989",
"0.56534165... | 0.6974169 | 2 |
GET /tests GET /tests.json | def index
@q= Test.ransack(params[:q])
@tests = @q.result.uniq
@tests = @tests.order('id ASC').paginate(:page => params[:page], :per_page => 30)
respond_to do |format|
format.html
format.csv { send_data @tests.to_csv(['nombre', 'colegio', 'nivel', 'seccion', 'edad', 'ic', 'icm', 'pi_num'... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n render status: :ok, json: @tests\n end",
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def index\n @tests = Test.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tes... | [
"0.77513814",
"0.77281153",
"0.77281153",
"0.73835593",
"0.73397875",
"0.69955796",
"0.69955796",
"0.6836035",
"0.67343783",
"0.66843206",
"0.6667517",
"0.6658951",
"0.6608686",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
"0.65987116",
... | 0.0 | -1 |
GET /tests/1 GET /tests/1.json | def show
@años =(@test.edad/12).truncate
@meses = (@test.edad % 12).truncate
if @test.ic > 115 then
@a = "El/la estudiante ha adquirido las habilidades verbales por encima de lo esperado para su edad."
@b = "Se sugieren las siguientes estrategias para reforzar los logros de su hijo/a:"
elsif ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test\n get(\"/help/test.json\")\n end",
"def test\n get(\"/help/test.json\")\n end",
"def get_one\n test_data = @test.get_one\n return render json: test_data\n end",
"def index\n render status: :ok, json: @tests\n end",
"def index\n @tests = Test.all\n\n r... | [
"0.7404314",
"0.7404314",
"0.7304388",
"0.7279787",
"0.7125164",
"0.6878569",
"0.6878569",
"0.6849366",
"0.67718923",
"0.6757094",
"0.6669219",
"0.6624378",
"0.66209686",
"0.66169363",
"0.6546323",
"0.64791626",
"0.64788824",
"0.6474367",
"0.6439662",
"0.643125",
"0.6427616",... | 0.0 | -1 |
POST /tests POST /tests.json | def create
@test = Test.new(test_params)
respond_to do |format|
if @test.save
format.html { redirect_to @test, notice: 'Test was successfully created.' }
format.json { render :show, status: :created, location: @test }
else
format.html { render :new }
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def v2_tests_post(test_detail, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: TestsApi#v2_tests_post ...\"\n end\n \n # verify the required parameter 'test_detail' is set\n fail \"Missing the required parameter 'test_detail' when calling v2_tests... | [
"0.72139466",
"0.70664746",
"0.70649576",
"0.698973",
"0.68169713",
"0.6594761",
"0.65116346",
"0.64799345",
"0.64702207",
"0.6453199",
"0.6437914",
"0.6407723",
"0.63976455",
"0.6325744",
"0.6325744",
"0.6283378",
"0.62668014",
"0.6260816",
"0.62560624",
"0.62288237",
"0.619... | 0.6549934 | 11 |
PATCH/PUT /tests/1 PATCH/PUT /tests/1.json | def update
respond_to do |format|
if @test.update(test_params)
format.html { redirect_to root_path, notice: 'Test was successfully updated.' }
format.json { render :show, status: :ok, location: @test }
else
format.html { render :edit }
format.json { render json: @test.err... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @test = Test.find(params[:id])\n\n respond_to do |format|\n if @test.update_attributes(params[:test])\n format.html { redirect_to @test, notice: 'Test was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.66275895",
"0.6461085",
"0.641104",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6391308",
"0.6353196",
"0.63523674",
"0.63470954",
"0.6342605",
"0.6310571",
"0.6279947",
"0.62674844",
"0.62450176",
"0.6235671",
"0.6208939",
"0.61947995"... | 0.6462119 | 1 |
DELETE /tests/1 DELETE /tests/1.json | def destroy
@test.destroy
respond_to do |format|
format.html { redirect_to tests_url, notice: 'Test was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test.destroy\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n e... | [
"0.771419",
"0.771419",
"0.7699507",
"0.74376744",
"0.7390183",
"0.7322365",
"0.73147345",
"0.7270275",
"0.72675836",
"0.7227697",
"0.7193399",
"0.718793",
"0.7176366",
"0.715625",
"0.71377426",
"0.7136246",
"0.71350276",
"0.71236855",
"0.7106981",
"0.71050316",
"0.7105011",
... | 0.7418487 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_test
@test = Test.friendly.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 test_params
params.require(:test).permit(:nombre, :colegio, :nivel, :seccion, :edad, :ic, :icm, :pi_num, :pi_comp, :pi_cal, :pi_conc, :pf_conv, :pf_hecho, :pf_calc, :pf_conce)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.6981273",
"0.6783789",
"0.67460483",
"0.6742222",
"0.67354137",
"0.65934366",
"0.65028495",
"0.6497783",
"0.64826745",
"0.6479415",
"0.6456823",
"0.6440081",
"0.63800216",
"0.6376521",
"0.636652",
"0.6319898",
"0.6300256",
"0.62994003",
"0.6293621",
"0.6292629",
"0.6291586... | 0.0 | -1 |
Logs out the given user. | def log_out
session[:user_id] = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_log_out\n forget_user(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def user_log_out\n user_forget(current_user)\n session.delete(:user_id)\n @current_user = nil\n end",
"def log_out\n\t\tsession.delete(:user_id)\n\t\t@current_user = nil\n\tend",
"def lo... | [
"0.79455703",
"0.7933259",
"0.79232",
"0.79226893",
"0.79226893",
"0.79226893",
"0.79226893",
"0.7885247",
"0.78839123",
"0.78839123",
"0.78839123",
"0.78839123",
"0.78839123",
"0.7846962",
"0.78389424",
"0.7814662",
"0.7803803",
"0.7803675",
"0.7803675",
"0.7803675",
"0.7803... | 0.0 | -1 |
Returns the current loggedin user (if any). | def current_user
if session[:user_id] && !User.where(id: session[:user_id]).empty?
@current_user = User.find(session[:user_id])
else
log_out
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end",
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n return unless session[:user_id... | [
"0.85960984",
"0.8593657",
"0.855797",
"0.8545853",
"0.8534344",
"0.8497545",
"0.847914",
"0.8460573",
"0.8457271",
"0.84556973",
"0.84472865",
"0.8442264",
"0.8441092",
"0.84366953",
"0.8400402",
"0.83765614",
"0.8368829",
"0.8337418",
"0.8337418",
"0.8314651",
"0.8311652",
... | 0.0 | -1 |
Returns true if the user is logged in, false otherwise. | def logged_in?
!current_user.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n user._logged_in?\n end",
"def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n r... | [
"0.9082417",
"0.8764097",
"0.87552106",
"0.8718715",
"0.86894006",
"0.86498255",
"0.86469626",
"0.86372185",
"0.8631328",
"0.86285406",
"0.86285406",
"0.8582609",
"0.85669243",
"0.85613596",
"0.85613596",
"0.8551865",
"0.85491496",
"0.85443276",
"0.85409296",
"0.8539988",
"0.... | 0.0 | -1 |
Returns true if the user is admin, false otherwise. | def is_admin?
logged_in? && current_user && current_user.admin
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end",
"def user_admin?\n user_logged_in? && @current_user.type == 'Admin'\n end",
"def admin_user?\n (current_user.role == 'admin') if logged_in?\n end",
"def is_admin?(user)\n user.admin > 0\n end",
... | [
"0.889581",
"0.88150066",
"0.87862563",
"0.8752688",
"0.8721052",
"0.87146884",
"0.8699965",
"0.8683591",
"0.86785793",
"0.867183",
"0.8648363",
"0.8622057",
"0.8612408",
"0.86059827",
"0.85983676",
"0.8595314",
"0.8586797",
"0.8585778",
"0.8584833",
"0.857932",
"0.857507",
... | 0.8333808 | 68 |
a before_action check for use across controllers, kick nonadmins back to root and give them the error | def check_is_admin
unless is_admin?
bounce_chumps "You're not an admin."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_actions\n unless @current_admin.is_super_admin\n flash[:error]=\"You are not authorized to navigate to this page \"\n redirect_to admin_index_path\n return\n end\n end",
"def restrictToAdmin! ; redirect to('/login'),303 unless admin? ; end",
"def authorize_admin\n redirect_to... | [
"0.71333754",
"0.7100826",
"0.7033217",
"0.69939905",
"0.69824076",
"0.6979637",
"0.6954579",
"0.69519776",
"0.6905565",
"0.6894634",
"0.68928754",
"0.6885117",
"0.68832487",
"0.6865384",
"0.6850431",
"0.68429655",
"0.6825543",
"0.6825316",
"0.6823738",
"0.68178463",
"0.68156... | 0.0 | -1 |
helper for my helper, kick user back to url, display error msg | def bounce_chumps(msg, url=root_url)
flash[:danger] = msg
redirect_to root_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail_to_post_im\n redirect_to user_session_path, notice: \"Nickname is not valid!\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please try logging in again.\"\n end",
"def failure\n redirect_to login_path, notice: \"Sorry, something went wrong. Please tr... | [
"0.6867748",
"0.6633022",
"0.6633022",
"0.6576034",
"0.6563974",
"0.6549556",
"0.65393645",
"0.65393645",
"0.65298235",
"0.6495355",
"0.64936656",
"0.6435099",
"0.6391476",
"0.63548976",
"0.63439643",
"0.6336845",
"0.6326151",
"0.6293891",
"0.62602246",
"0.62557817",
"0.62546... | 0.0 | -1 |
Custom identify query def self.identify_query(bbox, radius) scoped.select().where().... end | def bbox
envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo
[envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n ... | [
"0.66721064",
"0.6290936",
"0.6258394",
"0.5966861",
"0.5930464",
"0.58599156",
"0.58520883",
"0.58520883",
"0.578433",
"0.57698905",
"0.5769563",
"0.5767218",
"0.57570136",
"0.57149935",
"0.56479704",
"0.56172335",
"0.55662376",
"0.55237085",
"0.55153334",
"0.5510968",
"0.54... | 0.0 | -1 |
update modification attributes (changed_by, etc.) Override in descendant classes | def modified_by(user)
#none by default
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def update(attrs)\n super(attrs)\n end",
"def modify\n super\n end",
"def update_attributes(attrs)\n super({})\n en... | [
"0.7094489",
"0.7094489",
"0.7094489",
"0.7094489",
"0.70514035",
"0.6626404",
"0.64937556",
"0.6460717",
"0.6423039",
"0.63254476",
"0.62903",
"0.6280143",
"0.6265232",
"0.6214112",
"0.6214112",
"0.6214112",
"0.6214112",
"0.6194792",
"0.61677366",
"0.6152287",
"0.6129018",
... | 0.0 | -1 |
header for CSV export | def csv_header
#empty by default
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_header csv = nil\n csv << indices\n end",
"def csv_header(*columns)\n csv.start(columns.flatten)\n end",
"def csv_header\n [\n 'project key',\n 'key',\n 'summary',\n 'description',\n 'issue type',\n 'epic name'\n ]\n end",
"def ... | [
"0.795292",
"0.78863126",
"0.77952063",
"0.77407753",
"0.7695519",
"0.75939745",
"0.75229716",
"0.74737644",
"0.7409826",
"0.73565865",
"0.7318806",
"0.7318806",
"0.7303383",
"0.72838557",
"0.7265608",
"0.7265608",
"0.7017066",
"0.6994554",
"0.69759184",
"0.69214886",
"0.6901... | 0.7965049 | 1 |
row values for CSV export | def csv_row
#empty by default
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_csv_row\n [@id, @name, @address]\n end",
"def csv_row\n [\n hub_id,\n tag_id,\n \"%2.2f\" % temperature,\n ACCELERATION_FORMAT % x_acceleration,\n ACCELERATION_FORMAT % y_acceleration,\n ACCELERATION_FORMAT % z_acceleration,\n rssi,\n timestamp.to_i\n ].jo... | [
"0.76100165",
"0.7114935",
"0.70905566",
"0.70905566",
"0.7062761",
"0.69704336",
"0.69647074",
"0.69535345",
"0.6878125",
"0.6827254",
"0.6727361",
"0.67201424",
"0.67081106",
"0.6699801",
"0.6610398",
"0.6595244",
"0.6591871",
"0.65683997",
"0.65583557",
"0.6528785",
"0.649... | 0.6537624 | 20 |
Counts the services under a given category. If lat and lng are passed, counts them within given radius of that point, defaulting to 30 miles | def service_count lat=nil, lng=nil, meters=30*1609.34
if lat && lng
services.within_x_meters(lat, lng, meters).count
else
services.count
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_of_places_in_categories_within_bounds(categories, bounds)\n one.number_of_places_in_categories_within_bounds(sql_categories(categories), bounds[:sw][:latitude], \n bounds[:sw][:longitude], bounds[:ne][:latitude], bounds[:ne][:longitude])['number_of_places_in_categories_within_boun... | [
"0.65952694",
"0.6069649",
"0.60338855",
"0.55164534",
"0.54931617",
"0.5443185",
"0.52970135",
"0.52757657",
"0.5268755",
"0.52555615",
"0.5233187",
"0.5228233",
"0.5176651",
"0.5163756",
"0.5163756",
"0.5157285",
"0.51448417",
"0.51092696",
"0.51054734",
"0.5104184",
"0.509... | 0.77324426 | 0 |
2. Satisfied I figured this one out, Big Time! | def transmogrifier (a, b, c)
((a * b) ** c)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def anchored; end",
"def schubert; end",
"def stderrs; end",
"def offences_by; end",
"def rassoc(p0) end",
"def internship_passed; end",
"def terpene; end",
"def leeway; end",
"def leeway; end",
"def berlioz; end",
"def hiss; end",
"def identify; en... | [
"0.6225095",
"0.6095853",
"0.5966423",
"0.5770216",
"0.5726718",
"0.56173086",
"0.561076",
"0.55952066",
"0.5512317",
"0.5449903",
"0.5449903",
"0.540996",
"0.54021853",
"0.53890663",
"0.5388305",
"0.5386345",
"0.53743017",
"0.53371596",
"0.53333676",
"0.5288742",
"0.52872807... | 0.0 | -1 |
3 doesnt work, just have to come back later finally figured out why Pry wasnt working,atom wasnt color code correctly | def toonify (accent, sentence)
if accent == 'daffy'
return sentence.gsub('s','th')
elsif accent =='elmer'
return sentence.gsub('r','w')
else
return sentence
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bg_red; use_code(41) end",
"def get_color_code\n\t\t{ r: @term_hex[0], g: @term_hex[1], b: @term_hex[2], alpha: @term_hex[-1] }\n\tend",
"def hsla_color; end",
"def colorized?; end",
"def scan_for_colors; end",
"def red\n colorize(31)\n end",
"def colour(name, text)\n if Pry.color\n ... | [
"0.69875705",
"0.68206906",
"0.67406154",
"0.6666188",
"0.664469",
"0.66230404",
"0.6506026",
"0.64943737",
"0.6451751",
"0.64425683",
"0.64157015",
"0.6403997",
"0.6399919",
"0.6375844",
"0.6370051",
"0.633768",
"0.628246",
"0.62615037",
"0.6249127",
"0.62110984",
"0.6210897... | 0.0 | -1 |
4 SIGH didnt need a to_s and also the spaces affect your answer | def wordReverse (str)
str.split(' ').reverse.join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def take_bath\n self.hygiene += 4\n return \"♪ Rub-a-dub just relaxing in the tub ♫\"\n end",
"def to_s()\r\n\t\treturn guessed_word().split('').join(' ')\r\n\tend",
"def to_s\n \t#Create an empty st... | [
"0.62774235",
"0.62774235",
"0.621174",
"0.61651784",
"0.61552423",
"0.61491066",
"0.6148192",
"0.61145896",
"0.60867953",
"0.60678303",
"0.5986069",
"0.59523994",
"0.59415764",
"0.5922887",
"0.59210575",
"0.59210575",
"0.5898727",
"0.5883289",
"0.5879344",
"0.58636963",
"0.5... | 0.0 | -1 |
5 it works but cant only be a space difference? | def letterReverse (str)
str.split('').reverse.join('')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def five_spaces\n 5.times do\n nbsp\n end\n end",
"def nine_point_five(word)\n\n end",
"def spaces; end",
"def spaces; end",
"def roll_five\n puts %Q{...........}\n puts %Q{: * * :}\n puts %Q{: * :}\n puts %Q{: * * :}\n puts %Q{'''''''''''}\nend",
"def yummie(n)\r\... | [
"0.67958164",
"0.61110485",
"0.6009017",
"0.6009017",
"0.59963244",
"0.59069663",
"0.58531207",
"0.5825161",
"0.5770335",
"0.57419324",
"0.57172257",
"0.56955814",
"0.56877786",
"0.56650263",
"0.5609521",
"0.55905306",
"0.55867755",
"0.5581871",
"0.5581871",
"0.5565977",
"0.5... | 0.0 | -1 |
an empty array accessible to all methods | def border
puts "--------------------------------".center(75)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def array\n raise \"Not implemented\"\n end",
"def another; return []; end",
"def all\n []\n end",
"def __array__; self; end",
"def to_ary\n\t []\n\tend",
"def variables\n EMPTY_ARRAY\n end",
"def array\n @@array\n end",
"def initialize; @ary = []; end",
"def to_a; []... | [
"0.73341405",
"0.7154377",
"0.70395124",
"0.6939797",
"0.68577194",
"0.6831367",
"0.67742383",
"0.67736715",
"0.6770608",
"0.675761",
"0.6746169",
"0.67191696",
"0.6681353",
"0.661779",
"0.661779",
"0.661779",
"0.661779",
"0.6611431",
"0.65442127",
"0.6529813",
"0.652277",
... | 0.0 | -1 |
FIXME: Somebody could please remove this duplication? This logic is already in the ApplicationController | def friendly_post_path(post)
friendly_post_show_path post.created_at.year,
"%02d" % post.published_at.month,
"#{post.friendly_id}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_pre_request( request )\n end",
"def on_pre_request( request ); end",
"def before_dispatch(_env)\n end",
"def before_dispatch(env); end",
"def before_filter; end",
"def after_view_setup\n end",
"def before_request\n end",
"def index\n # The hook below can access controller's instan... | [
"0.62319016",
"0.61627704",
"0.60880727",
"0.60674274",
"0.600287",
"0.5941887",
"0.57804185",
"0.5642012",
"0.5590832",
"0.5536981",
"0.5500991",
"0.5498878",
"0.54506963",
"0.54376",
"0.5403395",
"0.5403395",
"0.53921664",
"0.53921664",
"0.53391665",
"0.5326418",
"0.5321566... | 0.0 | -1 |
FIXME: make it generic | def inspect_post_html(id, element, regexp)
position = find("#post_#{id} #{element}").text =~ regexp
position.should be_a_kind_of Fixnum
position.should_not be_nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def identify; end",
"def suivre; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
... | [
"0.7342122",
"0.65914446",
"0.65914446",
"0.65914446",
"0.65914446",
"0.637899",
"0.6285067",
"0.6065699",
"0.6065699",
"0.60237616",
"0.5938141",
"0.59209174",
"0.5919319",
"0.5919319",
"0.5857363",
"0.5857363",
"0.58088505",
"0.58088505",
"0.58007675",
"0.57436574",
"0.5725... | 0.0 | -1 |
FIXME: make it generic | def get_html_element(handle, css_class)
find("##{handle_to_id(handle)} .description p a.#{css_class}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def identify; end",
"def suivre; end",
"def apply\n\t\t\n\tend",
"def apply\n\t\t\n\tend",
... | [
"0.7342122",
"0.65914446",
"0.65914446",
"0.65914446",
"0.65914446",
"0.637899",
"0.6285067",
"0.6065699",
"0.6065699",
"0.60237616",
"0.5938141",
"0.59209174",
"0.5919319",
"0.5919319",
"0.5857363",
"0.5857363",
"0.58088505",
"0.58088505",
"0.58007675",
"0.57436574",
"0.5725... | 0.0 | -1 |
For each branch across all remotes, create the most recent local version | def sync_remotes_to_local(repo)
local_branches = {}
remote_branches = {}
repo.branches.each {|branch|
before, after = branch.name.split('/')
if after.nil? # Test if this is a local branch
local_branches[before] = branch
else
if branch.type == :direct # I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recent_branches_fast\n\t\trefs = []\n\t\trefs.concat Pathname.glob(dot_git + 'refs/heads/**/*')\n\t\trefs.concat Pathname.glob(dot_git + 'refs/remotes/**/*')\n\n\t\tbranches = refs.reject {|r| r.directory? }.sort_by {|r| r.mtime }.last(@opts[:max_num]).map {|r|\n\t\t\tref = r.read.chomp\n\t\t\tif name = ref[/r... | [
"0.6456059",
"0.61433715",
"0.6111698",
"0.6100275",
"0.6029736",
"0.5928329",
"0.58990073",
"0.58990073",
"0.5838098",
"0.5792897",
"0.5786849",
"0.577321",
"0.5762894",
"0.5724506",
"0.57168084",
"0.5703052",
"0.5603026",
"0.56023556",
"0.5601449",
"0.5594883",
"0.55763453"... | 0.72239935 | 0 |
Custom comparison for Git commits The greatest commits are leaves, the least commits are parents | def commit_compare(repo, left, right)
if left == right
0
elsif repo.descendant_of? left, right
1
elsif repo.descendant_of? right, left
-1
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def branches_containing_commit(commit_ref); end",
"def branches_containing_commit(commit_ref); end",
"def compare_branches(join_request)\n working_repo = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n master_commit = working_repo.branches['master'].gcommit\n user = User.... | [
"0.6407233",
"0.64065945",
"0.6175936",
"0.61369807",
"0.6090733",
"0.6078224",
"0.59672207",
"0.5937576",
"0.58062774",
"0.580501",
"0.57094014",
"0.5683315",
"0.5678828",
"0.56471646",
"0.5612458",
"0.559004",
"0.5525835",
"0.55187565",
"0.54911506",
"0.54734087",
"0.547053... | 0.737213 | 0 |
this method is patterned after an analog in ActiveRecord::DynamicMatchers | def all_attributes_exists?(attribute_names)
attribute_names.reduce(true) {|result, att| ALL_FIELDS.include? att or SUPPORTED_ALTS.include? att}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matcher; end",
"def matcher; end",
"def submatchers; end",
"def mock_model(model,method,expected)\n expected=case\n# See ActiveRecord::Base method, '==='. Another way is to use object_id:\n when DirectoryPicture==model then Picture\n when FileTag ==model then Tag\n end.all.map... | [
"0.6095344",
"0.6095344",
"0.601724",
"0.586645",
"0.584155",
"0.57155013",
"0.57155013",
"0.56945103",
"0.56650347",
"0.56650347",
"0.56473196",
"0.55980855",
"0.5580978",
"0.5539212",
"0.55221885",
"0.5480839",
"0.54290557",
"0.5403255",
"0.5346151",
"0.5335227",
"0.5326324... | 0.0 | -1 |
Returns current stock data (hash table) | def get_current_stock_data(input)
url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}"
response = RestClient.get(url)
my_response = JSON.parse(response)
if my_response["Error Message"] == "Invalid API call. Please retry or visit the documen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_symbols\n @interface.stock_symbols\n end",
"def stock_historical_data(ticker)\n ############################################################################\n # Yahoo Finance historical quotes has been deprecated\n # YahooFinance::Client.new.historical_quotes(ticker, { start_date: Da... | [
"0.7228641",
"0.7185762",
"0.7049465",
"0.70317197",
"0.69627225",
"0.6918463",
"0.68774235",
"0.68412143",
"0.6807489",
"0.6789867",
"0.6692942",
"0.6646998",
"0.6639877",
"0.6573211",
"0.64786494",
"0.6422366",
"0.64222544",
"0.6397593",
"0.6381188",
"0.6366301",
"0.6289725... | 0.0 | -1 |
Returns current stock price (float) repeated code to avoid hitting the API twice for every request by using above function first | def get_current_stock_price(input)
url = "https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=#{input}&apikey=#{ENV['STOCKS_API_KEY']}"
response = RestClient.get(url)
my_response = JSON.parse(response)
if my_response["Error Message"] == "Invalid API call. Please retry or visit the docume... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_value\n current_price = YahooFinance::get_quotes(YahooFinance::StandardQuote, @ticker.upcase)[@ticker.upcase].lastTrade\n current_price * @shares\n end",
"def stock_price(ticker)\r\n\tstock_price = StockQuote::Stock.quote(ticker).last_trade_price_only\r\n\t\"The price of #{ticker} is $#{stock_pric... | [
"0.75771594",
"0.7495745",
"0.7484023",
"0.74617255",
"0.74582183",
"0.7453657",
"0.736764",
"0.73673195",
"0.72513604",
"0.72068346",
"0.71183693",
"0.70902747",
"0.7035769",
"0.70315003",
"0.7007922",
"0.69708025",
"0.69638246",
"0.69354945",
"0.69176143",
"0.6917052",
"0.6... | 0.7173752 | 10 |
GET /projects GET /projects.json | def index
@projects = Project.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def listprojects\n get('listprojects.json')['projects']\n end",
"def list\n get 'projects'\n end",
"def projects\n request(method: 'getAllProjects')\n end",
"def projects\n resource 'projects'\n end",
"def projects(params = {})\n make_get_request('/account/projects', params)\n e... | [
"0.85753775",
"0.8387346",
"0.8356146",
"0.8062963",
"0.8037377",
"0.8002495",
"0.78579885",
"0.7833898",
"0.7831125",
"0.78001004",
"0.7779268",
"0.7748593",
"0.7714022",
"0.7700959",
"0.7695963",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947564",
"0.76947... | 0.0 | -1 |
GET /projects/1 GET /projects/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list\n get 'projects'\n end",
"def listprojects\n get('listprojects.json')['projects']\n end",
"def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end",
"def projects\n... | [
"0.7868971",
"0.76979554",
"0.7680216",
"0.7611453",
"0.75334454",
"0.75258976",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74926496",
"0.74924207",
"0.7484109",
"0.7479275",
"0.7444873",
"0.74294627",
"0.74224764",
"0.7414947",
"0.... | 0.0 | -1 |
POST /projects POST /projects.json | def create
@project = Project.new(project_params)
@project.owner = current_user unless @project.owner
if @project.save
render :show, status: :created, location: @project
else
render json: @project.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new... | [
"0.7338948",
"0.73139244",
"0.7308003",
"0.7299582",
"0.7227503",
"0.7225945",
"0.71982473",
"0.71170384",
"0.7104803",
"0.7095263",
"0.7070636",
"0.70408624",
"0.70358187",
"0.7024969",
"0.70191896",
"0.7009597",
"0.698481",
"0.697517",
"0.6963753",
"0.6963096",
"0.6948756",... | 0.6750235 | 72 |
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json | def update
if @project.update(project_params)
render :show, status: :ok, location: @project
else
render json: @project.errors, status: :unprocessable_entity
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end",
"def update\n @project = Project.find(params[:id])\n\n if params[:name] == \"project_name\"\n project_name = pa... | [
"0.7001068",
"0.69119793",
"0.6911771",
"0.6889915",
"0.68893576",
"0.6878936",
"0.6868435",
"0.6858245",
"0.6854234",
"0.6854234",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
"0.6851268",
... | 0.0 | -1 |
DELETE /projects/1 DELETE /projects/1.json | def destroy
@project.destroy
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pr... | [
"0.78940606",
"0.78581154",
"0.7776677",
"0.7770321",
"0.77572984",
"0.7729462",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77290845",
"0.77231294",
"0.7717094",
"0.7717094",
"0.7717094",
"0.7717094",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703387",
"0.7703... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_project
@project = Project.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 project_params
params.require(:project).permit(:name, :description, :due_date, :status)
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.6980957",
"0.6783065",
"0.6747844",
"0.6741468",
"0.67356336",
"0.6592548",
"0.65036845",
"0.64978707",
"0.64825076",
"0.64795035",
"0.64560914",
"0.64397955",
"0.6379666",
"0.6376688",
"0.6366702",
"0.6319728",
"0.6300833",
"0.6300629",
"0.6294277",
"0.6293905",
"0.629117... | 0.0 | -1 |
in the array sums to zero, return the positions of those two numbers. If no pair of numbers sums to zero, return `nil`. Difficulty: medium. Steps: 1. First while condition is for the first addend. 2. Second while condition is for the second addend 3. The first while condition makes sure the addend is used to try out if... | def two_sum(nums)
idx1 = 0
idx2 = 1
while idx1 < nums.length
idx2 = idx1 + 1 #------>missed this line to increment idx2 for the next round or position
while idx2 < nums.length
sum = nums[idx1] + nums[idx2]
if sum == 0
return [idx1, idx2]
end
idx2 = idx2 + 1
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def two_sum(nums)\n idx1 = 0\n while idx1 < nums.length\n idx2 = idx1 + 1\n while idx2 < nums.length\n if nums[idx1] + nums[idx2] == 0\n return [idx1, idx2]\n end\n\n idx2 += 1\n end\n\n idx1 += 1\n end\n\n return nil\nend",
"def two_sum(nums)\n idx1 = 0\n while idx1 < num... | [
"0.79553497",
"0.79553497",
"0.79553497",
"0.79233676",
"0.78335655",
"0.77159125",
"0.76176894",
"0.76062435",
"0.76008654",
"0.7576136",
"0.75680906",
"0.7567333",
"0.7561526",
"0.75365806",
"0.7525222",
"0.74562836",
"0.73764396",
"0.73257273",
"0.7315657",
"0.72807586",
"... | 0.7481617 | 15 |
Running the .each method Running .each on the array | def each_map_exp
letters = ["aaa", "b", "c", "d", "e", "a", "b", "h"]
superheroes = {
superman: "flying",
batman: "World's greatest butler",
spiderman: "shooting web"
}
puts "\n\n Using .each\n"
#---------------------------------------
puts "This is before running the block."
p letters
letters.each d... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each\n to_a.each\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n @array.each(&block)\n end",
"def each(&block)\n ... | [
"0.7856046",
"0.7856046",
"0.7856046",
"0.7668916",
"0.7668916",
"0.76065975",
"0.7583112",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75376683",
"0.75316375",
"0.7493566",
"0.7459909",
"0.74490505",
"0.74490505",
"0.7388244",
"0.7388244",
"0.737... | 0.0 | -1 |
Running the destructive .map! on the Hash NO BUENO | def using_map_on_hash
p "This is before running the superhero hash .map! block"
p superheroes
superheroes.map! do |superhero, power|
p "#{superhero}, #{power}"
end
p "This is after running the superhero hash .map! block"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map(hash); end",
"def remap\n # This is Ruby magic for turning a hash into an array into a hash again\n Hash[*self.map do |key, value|\n yield key, value\n end.compact.flatten]\n end",
"def map! &block\n mapped = enumerable_map(&block)\n clear\n merge mapped\n end",... | [
"0.747928",
"0.6440531",
"0.63388914",
"0.62350595",
"0.6125194",
"0.61101097",
"0.6080118",
"0.6069318",
"0.6030853",
"0.60183483",
"0.6016846",
"0.599887",
"0.59868604",
"0.5980616",
"0.5945175",
"0.5896097",
"0.58908355",
"0.58881724",
"0.58865356",
"0.5882954",
"0.5867528... | 0.643643 | 2 |
main controller for customer vault | def show
# get user client obj for Box API calls
client = user_client
mixpanel_tab_event("My Vault", "Main Page")
@user_access_token = client.access_token
session[:current_page] = "vault"
threads = []
@breadcrumb = {}
session[:current_folder] = params[:id]
# get "My Files" and "Sh... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def controller\n end",
"def controller\n end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def controller; end",
"def... | [
"0.64976865",
"0.64976865",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.6269854",
"0.61270934",
"0.60087293",
"0.6000125",
"0.5980976",
"0.5927076",
"0.5894483",
"0.58390564",
"0.5775593",
"0.57695186... | 0.0 | -1 |
post to edit filename | def edit_filename
client = user_client
file = client.file_from_id(params[:fileId], fields: [:parent])
mixpanel_tab_event("My Vault", "Rename Item")
# set current folder id & new file name
session[:current_folder] = file.parent.id
newName = params[:fileName] + '.' + params[:fileExt]
# make... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n cur_path = current_path\n dir = Dir.new( cur_path )\n if request.post?\n original_name = params[:original_file_name].gsub(/\\.\\./, '')\n file_name = params[:file_name].gsub(/\\.\\./, '')\n if (original_name.blank? or file_name.blank?)\n @edit_file = original_name\n ... | [
"0.6418168",
"0.6351573",
"0.6298866",
"0.6258384",
"0.62566507",
"0.61811996",
"0.6138717",
"0.61205167",
"0.61205167",
"0.6066684",
"0.60456556",
"0.60418427",
"0.6008105",
"0.59850746",
"0.5951681",
"0.5945934",
"0.5941403",
"0.59028345",
"0.59028345",
"0.58943117",
"0.588... | 0.6155889 | 6 |
post to edit folder name | def edit_folder_name
client = user_client
mixpanel_tab_event("My Vault", "Rename Item")
# folder = client.folder_from_id(params[:folder_id])
session[:current_folder] = params[:folder_id]
# make Box API call to update folder name
begin
client.update_folder(params[:folderId], name: params[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n @mail_folder = MailFolder.find(params[:id])\n\n unless params[:thetisBoxEdit].blank?\n @mail_folder.name = params[:thetisBoxEdit]\n @mail_folder.save\n end\n render(:partial =... | [
"0.76888794",
"0.7291986",
"0.6354458",
"0.6345357",
"0.61824226",
"0.616339",
"0.6148135",
"0.60632044",
"0.6051421",
"0.60384834",
"0.5939813",
"0.58179855",
"0.58167875",
"0.58150536",
"0.581385",
"0.5789331",
"0.578092",
"0.57462656",
"0.57462656",
"0.57462656",
"0.574626... | 0.70620286 | 2 |
upload files to parameter specified folder ID | def upload
#http://www.dropzonejs.com/
session[:current_folder] = params[:folder_id]
uploaded_file = params[:file]
folder = params[:folder_id]
mixpanel_tab_event("My Vault", "Upload File")
# upload file to box from tmp folder
temp_file = File.open(Rails.root.join('tmp', uploaded_file.origi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def upload_file_to_folder(folder_name)\n upload_files_to_folder(folder_name)\n end",
"def upload(file, folder = 0)\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n # Make the upload.\n response = make_upload_call('/files/upload?parent_id... | [
"0.74013835",
"0.7001351",
"0.696491",
"0.6908442",
"0.68771386",
"0.6819738",
"0.67981625",
"0.67732066",
"0.66538364",
"0.6643929",
"0.66438466",
"0.6628339",
"0.6609764",
"0.6593928",
"0.6555811",
"0.6555811",
"0.654048",
"0.646475",
"0.6413081",
"0.64009106",
"0.6359396",... | 0.6249226 | 31 |
get file thumbnail from file ID | def thumbnail
image = Rails.cache.fetch("/image_thumbnail/#{params[:id]}", :expires_in => 10.minutes) do
puts "miss!"
user_client.thumbnail(params[:id], min_height: 256, min_width: 256)
end
send_data image, :type => 'image/png', :disposition => 'inline'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thumbnail\n \tobject.file.url(:thumb)\n end",
"def thumbnail_file(attribute)\n doc = scribd_document_for(attribute)\n\n if doc && doc.thumbnail_url\n open(doc.thumbnail_url).read\n else\n send(attribute).to_file(:thumb).open { |f| f.read }\n end\n rescue E... | [
"0.7399413",
"0.7376753",
"0.71843195",
"0.7139195",
"0.7119786",
"0.7089523",
"0.7009363",
"0.69929045",
"0.69928724",
"0.6945751",
"0.6917085",
"0.690358",
"0.690358",
"0.6903018",
"0.6870271",
"0.6870271",
"0.68289596",
"0.68130565",
"0.67734146",
"0.6773357",
"0.673857",
... | 0.64840627 | 37 |
download file from file ID | def download
session[:current_folder] = params[:folder]
mixpanel_tab_event("My Vault", "Download File")
download_url = Rails.cache.fetch("/download_url/#{params[:id]}", :expires_in => 10.minutes) do
user_client.download_url(params[:id])
end
redirect_to download_url
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download(id, filename)\n open(filename, \"w\").write(@res[\"/download?id=#{id}\"].get)\n return filename\n rescue\n puts $!\n return nil\n end",
"def download(file)\n uri = URI.parse(file)\n id=uri.query.match(/id=(.*)/)[1]\n\n Net::HTTP.start(uri.host) do |http|\n resp = http.get(uri.p... | [
"0.8333401",
"0.81282365",
"0.7895451",
"0.78229284",
"0.78001887",
"0.7737246",
"0.7664683",
"0.75497466",
"0.75373644",
"0.7442591",
"0.7435666",
"0.7383251",
"0.7301056",
"0.72994864",
"0.7259955",
"0.72374487",
"0.71839213",
"0.7178123",
"0.71344835",
"0.71321404",
"0.711... | 0.65532136 | 71 |
move file from personal vault to "Shared Files" folder | def share_file
id = params[:id]
mixpanel_tab_event("My Vault", "Share File")
session[:current_folder] = params[:folder]
client = user_client
# get shared folder, then move file into shared folder
sharedFolder = client.folder_from_path("#{session[:userinfo]['info']['name']} - Shared Files")
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) ... | [
"0.74314934",
"0.72868216",
"0.68529665",
"0.6645285",
"0.66320395",
"0.6386309",
"0.6350611",
"0.62262976",
"0.620629",
"0.6127031",
"0.6114249",
"0.60966414",
"0.6084613",
"0.60708374",
"0.6058741",
"0.6040684",
"0.6022039",
"0.6017292",
"0.601329",
"0.5978677",
"0.5930657"... | 0.70195264 | 2 |
move file from "Shared Files" folder to personal vault | def unshare_file
id = params[:id]
mixpanel_tab_event("My Vault", "Share File")
session[:current_folder] = params[:folder]
client = user_client
# get my folder, then move file into my folder
myFolder = client.folder_from_path('My Files')
client.move_file(id, myFolder)
flash[:notice] = "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) ... | [
"0.74406",
"0.70536304",
"0.6701537",
"0.6586538",
"0.6371236",
"0.6159885",
"0.6151179",
"0.61462015",
"0.6074617",
"0.6051112",
"0.60245913",
"0.60187715",
"0.59866375",
"0.5973807",
"0.5970023",
"0.59190345",
"0.58870184",
"0.58742493",
"0.586969",
"0.58451176",
"0.5836175... | 0.72317827 | 1 |
Create a new empty subfolder | def new_folder
puts "create new folder"
client = user_client
mixpanel_tab_event("My Vault", "New Folder")
# get "My Files" and "Shared Files" folder objects
@currentFolder = params[:parent_id]
# create new subfolder
begin
newFolder = client.create_folder(params[:folderName], @curren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mkdir path\n parent = lookup_single! File.dirname(path), RbVmomi::VIM::Folder\n parent.CreateFolder(:name => File.basename(path))\nend",
"def create\n create_directories\n end",
"def create_folder_if_needed path; Dir.mkdir(path) unless File.exists?(path) end",
"def create(folder)\n # Ensure ... | [
"0.72655004",
"0.7144939",
"0.7123008",
"0.712223",
"0.7011834",
"0.701061",
"0.6994109",
"0.6990473",
"0.6944186",
"0.68862987",
"0.68862987",
"0.6854912",
"0.6850851",
"0.68444425",
"0.68328834",
"0.6822164",
"0.6784889",
"0.6776958",
"0.67741275",
"0.67478126",
"0.6734044"... | 0.7022164 | 4 |
move dragged file into subfolder | def move_file
destFolder = params[:dest]
targetFile = params[:file_id]
client = user_client
mixpanel_tab_event("My Vault", "Move File - Drag & Drop")
# get folder
folder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder/#{params[:dest]}", :expires_in => 10.minutes) do
client.fol... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.... | [
"0.72120774",
"0.68330824",
"0.66458154",
"0.65818113",
"0.6581688",
"0.6527696",
"0.6506541",
"0.6477721",
"0.6449543",
"0.64494294",
"0.6447122",
"0.64245045",
"0.6417408",
"0.64039224",
"0.6388736",
"0.6387514",
"0.6376931",
"0.63647556",
"0.63243777",
"0.6302794",
"0.6276... | 0.6712039 | 2 |
move dragged file into subfolder | def move_folder
destFolder = params[:dest]
targetFolder = params[:folder_id]
client = user_client
mixpanel_tab_event("My Vault", "Move Folder - Drag & Drop")
# get folder
folder = Rails.cache.fetch("/folder/#{session[:box_id]}/my_folder/#{params[:dest]}", :expires_in => 10.minutes) do
cl... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_file\n\n end",
"def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.... | [
"0.72127473",
"0.6832489",
"0.67115253",
"0.6645521",
"0.65820056",
"0.65809214",
"0.652773",
"0.65077513",
"0.6478392",
"0.6450735",
"0.6449645",
"0.64478666",
"0.6424547",
"0.6403557",
"0.63891315",
"0.63879997",
"0.63768935",
"0.63656944",
"0.63237506",
"0.6302895",
"0.627... | 0.64167213 | 13 |
ToDo: Rename one or the other | def initialize(identity, resource: nil, cache: nil, primary: false)
@identity = identity
@cache = cache
@resource = resource
@primary = primary
@attributes = {}
@related = {}
@related_from = Set.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rename(old_name, new_name); end",
"def rename(old_name, new_name); end",
"def renamenx(old_name, new_name); end",
"def renamenx(old_name, new_name); end",
"def rename(a, b)\n @@__name_sets[@@__defining][b] = :\"__#{a}\"\n @@__name_sets[:original][a] = :\"__#{a}\"\n\n class<<self\n ... | [
"0.7053583",
"0.7053583",
"0.703",
"0.703",
"0.6923268",
"0.6917784",
"0.6786899",
"0.6752304",
"0.66085714",
"0.64938855",
"0.64371645",
"0.64196026",
"0.6345956",
"0.633506",
"0.6245946",
"0.62207645",
"0.62207645",
"0.62190044",
"0.61999255",
"0.6196539",
"0.61928827",
"... | 0.0 | -1 |
Get a (potentially cached) version of the compiled source code for sgNodeMapper. Returns an ExecJS::ExternalRuntime::Context. | def context
@context ||= ExecJS.compile(source)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def context\n @context ||= ExecJS.compile source\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def runtime\n @runtime ||= ExecJS.compile(source)\n end",
"def compile_sourcemap_string\n ... | [
"0.66099113",
"0.5837309",
"0.5837309",
"0.5837309",
"0.5808925",
"0.54550207",
"0.5448318",
"0.5448318",
"0.5442406",
"0.54374766",
"0.5399599",
"0.53495175",
"0.53482467",
"0.5344831",
"0.52739364",
"0.52581906",
"0.52345866",
"0.51970434",
"0.5185407",
"0.518362",
"0.51670... | 0.6672526 | 0 |
Get a string of the sgNodeMapper source code. Returns the String javascript source code. | def source
File.read(source_path)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_script_string\n @sources.string\n end",
"def compile_sourcemap_string\n JSON.dump(compile_sourcemap)\n end",
"def to_s\n @code.to_s\n end",
"def source_code\n next_node_line =\n if next_node\n next_node.line - 1\n else\n @document.source_lines.... | [
"0.67967236",
"0.66650015",
"0.6372571",
"0.6263538",
"0.62504077",
"0.6217658",
"0.6124969",
"0.6094473",
"0.60800767",
"0.6037791",
"0.6031039",
"0.6017846",
"0.5988912",
"0.5988912",
"0.58950084",
"0.58950084",
"0.58932173",
"0.5857154",
"0.5855219",
"0.5855219",
"0.583553... | 0.52073836 | 91 |
Get the full path to the sgNodeMapper.js source code. Returns the String path to sgNodeMapper. | def source_path
File.join(File.expand_path('../../', __FILE__), 'vendor', 'sg_node_mapper', 'nodemapper.js')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source_path\n source[:path]\n end",
"def code_path\n self.code.qualified_name\n end",
"def source_code_dir\n return pretty_path(File.join(Dir::COMMON_APPDATA, 'RightScale', 'src'))\n end",
"def source_path\n Pathname.new(self.config[:source_path])\n end",
"def so... | [
"0.64340115",
"0.6408442",
"0.6403649",
"0.6207961",
"0.6202468",
"0.6198204",
"0.61347044",
"0.608995",
"0.60389256",
"0.6012685",
"0.59948343",
"0.59767175",
"0.5898206",
"0.5887176",
"0.5826448",
"0.5802925",
"0.5752036",
"0.5748307",
"0.57396907",
"0.5728653",
"0.5728653"... | 0.78759164 | 0 |
def ingredient_list return ingredients.split(",") end def self.get_discounted Product.where("price < ?", 2) end | def friendly_created_at
return created_at.strftime("%A, %d %b %Y %l:%M %p")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def recipe_ingredients\n RecipeIngredient.all.select { |ri| ri.ingredient.name == @ing }\n end",
"def recipe_ingredients(perfect_10_recipe)\n return perfect_10_recipe\nend",
"def get_ingredients \n # get rid of all characters that are not: a-z A-Z 0-9 - [] () . ' / , blank;\n clean_ingredients = s... | [
"0.65997213",
"0.64969015",
"0.6429482",
"0.6423304",
"0.63065237",
"0.6298558",
"0.6292207",
"0.6289943",
"0.625009",
"0.61613816",
"0.61325073",
"0.6085409",
"0.6082717",
"0.60139555",
"0.6012992",
"0.5984362",
"0.59690243",
"0.5963172",
"0.5951004",
"0.59345365",
"0.591400... | 0.0 | -1 |
matrix.columns = [ [1, 4, 7, 8], [2, 5, 8, 7], [3, 6, 9, 6] ] col1 = [1, 4, 7, 8] col2 = [2, 5, 8, 7] col3 = [3, 6, 9, 6] | def to_columns(data)
col_arr = []
data.split("\n").each do |row|
row.split(' ').each_with_index do |num, ind|
if col_arr[ind] == nil
col_arr << [num.to_i]
else
col_arr[ind] << num.to_i
end
end
#col_arr = [[1], [2], [3]]
end
col_arr
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_columns! *columns\r\n matrix_new = add_columns *columns\r\n @rows = matrix_new.to_a\r\n @column_size = @rows[0].size\r\n end",
"def column(matrix, col_index)\n (0...matrix.size).inject([]) do |column, row_index|\n column << matrix[row_index][col_index]\n end\nend",
"def matrix\n end",
... | [
"0.65260106",
"0.63653755",
"0.63053805",
"0.6255817",
"0.6248656",
"0.6241616",
"0.6232743",
"0.6181638",
"0.6173346",
"0.61722976",
"0.6169507",
"0.6158061",
"0.61462843",
"0.6134155",
"0.6114014",
"0.61026573",
"0.6084009",
"0.6051057",
"0.60505414",
"0.60351807",
"0.60201... | 0.0 | -1 |
USAGE : the require statement in console : enter > require "./lib/mysqldataprocessingverifierfiber.rb" enter > doing_verified_unique ^^^^^^^^^^^^^^^^^^ that command runs that named fiber shown below file_name allows you to name the file that conatains your data to be processed, using any method below that calls for it | def file_name
file_name = ("./tmp/database_doings/doing_uniques/uniques_done.txt")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run( file_name )\n application = select_app( file_name )\n system( \"#{application} #{file_name}\" )\n end",
"def run(file_name)\n application = select_app(file_name)\n system \"#{application} #{file_name}\"\n end",
"def run file_name\n application = select_app file_name\n sys... | [
"0.56375444",
"0.56337976",
"0.56209457",
"0.56209457",
"0.5618388",
"0.5599762",
"0.55736756",
"0.5506167",
"0.5505519",
"0.5465258",
"0.54086673",
"0.5403425",
"0.5294604",
"0.5281221",
"0.5272631",
"0.5216795",
"0.5216795",
"0.51940566",
"0.5191786",
"0.5171591",
"0.515896... | 0.47417822 | 77 |
after_break is used at end of fiber method doing_verified_unique to end processing and save the file addended to. to load the data produced by this fiber method ^^^^^^^^^^ use these commands in mysql console : in Terminal $ cd ./desideratus/apotomoing_sequencers $ mysql mysql> use sequencers_production or developent my... | def after_break
#open(file_name, "r") do |f|
open("./tmp/database_doings/doing_uniques/uniques_done.txt", "r") do |f|
g = f.read
f.close
exit(puts "Processing is complete >> ./tmp/database_doings/doing_uniques/uniques_done.txt << is closed, console has been exited")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doing_raw_file_to_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.read(\"../../Documents/20111224-research.txt\")\n\t new = a.to_textual\n#TODO finishe\t \n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n en... | [
"0.589236",
"0.56867844",
"0.5574628",
"0.5516077",
"0.54441416",
"0.54441416",
"0.5395817",
"0.53481835",
"0.52646875",
"0.52332073",
"0.5228371",
"0.5208886",
"0.5206068",
"0.5206068",
"0.51739043",
"0.5160106",
"0.5130472",
"0.50951594",
"0.5053847",
"0.5053847",
"0.501336... | 0.6073639 | 0 |
fiber this method first reads the input file and downcase sorts it, | def doing_verified_unique_researches # adjustable line length filter
consumer = Fiber.new do |producer, queue|
a = File.readlines("./tmp/insert_researches.txt")
@megadata = a.sort do |x,y|
x.downcase <=> y.downcase
end
@megadata_unique = @megadata.uniq
f = open("./tmp/database... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def humongous_sort\n list = File.readlines(file_name)\n full_list = list.sort_by { |x| x.downcase }\n end",
"def sorting_file\n a = File.readlines(file_name)\n a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n end",
"def textualed\n list = File.readlines(file_name)\n full_list = l... | [
"0.76309335",
"0.75582564",
"0.6894346",
"0.6351122",
"0.60568416",
"0.59933263",
"0.58964384",
"0.5872514",
"0.5859685",
"0.58449686",
"0.5794771",
"0.5769028",
"0.5715029",
"0.56965905",
"0.56913704",
"0.56820774",
"0.5674456",
"0.5672027",
"0.5663047",
"0.56256324",
"0.561... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.