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
Text transformation ex. 'default_address_of_org_1' Used to set the default_address below
def contact_type_category(type) 'default_' + type + '_of_org_' + id.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_full_address\n \"#{address_line1}, #{city}, #{state} #{zip}\"\n end", "def default_email_address_header\n default_email_address.nil? ? original_email_address_header : default_email_address.to_header\n end", "def text_address\n [street, city, state].join(\" \")\n end", "def default_addr...
[ "0.6105305", "0.6079006", "0.6054513", "0.59237885", "0.59237885", "0.59062296", "0.58603483", "0.5835429", "0.5776266", "0.5756829", "0.5748823", "0.5744186", "0.57026845", "0.56967884", "0.5664088", "0.5657215", "0.56533146", "0.5644183", "0.564179", "0.56285185", "0.562747...
0.0
-1
When an address is set as default, a type_category matching the comments in the method contact_type_category is created in the mastertype table. The below method creates the string using the contact_type_category method And then searches for it returning the default address (probably uses the contact id under the attribute type_value.) TODO: this can probably be written differently. A default address join table?
def default_address type_category = contact_type_category('address') MasterType.find_by_type_category(type_category) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_address\n type_category = contactable.contact_type_category('address')\n\n MasterType.find_by_type_category_and_type_value(type_category, id)\n end", "def contact_type_category(type)\n 'default_' + type + '_of_org_' + id.to_s\n end", "def define_address_type\n if @address_type.nil?\...
[ "0.73766905", "0.6837767", "0.5996671", "0.5986107", "0.58268756", "0.5826182", "0.5783171", "0.578068", "0.57455057", "0.56673944", "0.56240344", "0.5600963", "0.55686855", "0.55672014", "0.5553719", "0.5537314", "0.54946166", "0.5483968", "0.5414645", "0.5367014", "0.534175...
0.75310737
0
This takes a username and by default assumes the password is 'password'.
def log_in_as(login, plaintext_password = 'password') visit '/' fill_in 'username_or_email', with: login fill_in 'password', with: plaintext_password click_on 'Login' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate(username, password)\n @username = username\n @password = password\n end", "def set_auth(username, password)\r\n raise CLXException, 'Username must be a string' unless username.is_a? String\r\n raise CLXException, 'Password must be a string' unless password.is_a? String\r\n ...
[ "0.7413063", "0.7411752", "0.7403149", "0.738217", "0.7093911", "0.70523447", "0.70449036", "0.7001279", "0.6996472", "0.6996472", "0.6996472", "0.69935536", "0.6991774", "0.6946115", "0.6946115", "0.69422925", "0.6931004", "0.69279367", "0.6862819", "0.68492925", "0.6835423"...
0.0
-1
GET /transactions GET /transactions.json
def index if session[:user_id] @transactions = Transaction.where(user_id: session[:user_id]) elsif session[:admin_id] @transactions = Transaction.where(nil) else redirect_to login_path end @transactions = @transactions.search(params[:search_name], params[:search_phone] , params[:search_amount], params[:search_status], params[:search_date ]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end", "def all_transactions\n json_respo...
[ "0.81652683", "0.79636127", "0.77844745", "0.7750792", "0.77279794", "0.770617", "0.7691486", "0.7651025", "0.7590181", "0.7566847", "0.7546931", "0.75178045", "0.7510041", "0.7459159", "0.7459159", "0.7459159", "0.7396793", "0.73277", "0.73007756", "0.72888684", "0.72888684"...
0.0
-1
GET /transactions/1 GET /transactions/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def index\n @transactions...
[ "0.8032809", "0.7573631", "0.7533766", "0.7436738", "0.7417449", "0.7408112", "0.7356934", "0.7356934", "0.7356934", "0.7301243", "0.72784877", "0.71866506", "0.71780527", "0.7136698", "0.7113767", "0.7072636", "0.7037816", "0.7037816", "0.7037816", "0.7037816", "0.7037816", ...
0.0
-1
POST /transactions POST /transactions.json
def create @transaction = Transaction.new(transaction_params) @transaction.update(user_id: session[:user_id]) @transaction.update(status: 'Scheduled') @timingsList = [] @datesList = [] @timings = Timing.find_by_sql("SELECT day, hours, minutes, ampm FROM timings") @timings.each do |timing| timing.day = date_of_next(timing.day).strftime("%d %b %Y") + " - " + timing.hours + ":" + timing.minutes + " " + timing.ampm @timingsList.push([timing.day, timing.day]) end for i in 0..9 @datesList.push([(Date.today+i).strftime("%d %b %Y"), (Date.today+i).strftime("%d %b %Y")]) end respond_to do |format| if @transaction.save format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' } format.json { render :show, status: :created, location: @transaction } else format.html { render :new } format.json { render json: @transaction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/js...
[ "0.7124941", "0.71085167", "0.7107366", "0.70616746", "0.6970805", "0.69395524", "0.6882131", "0.6873944", "0.6864678", "0.68382066", "0.682873", "0.6797429", "0.6790942", "0.67898583", "0.6742485", "0.67210656", "0.67054796", "0.66835666", "0.6677946", "0.66753876", "0.66521...
0.0
-1
PATCH/PUT /transactions/1 PATCH/PUT /transactions/1.json
def update respond_to do |format| if @transaction.update(transaction_params) format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' } format.json { render :show, status: :ok, location: @transaction } else format.html { render :edit } format.json { render json: @transaction.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n @transaction.account.update_transactions\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully updated.' }\n ...
[ "0.6728593", "0.64818925", "0.6465238", "0.6443382", "0.6443382", "0.6443382", "0.6443382", "0.6398909", "0.6378174", "0.6312184", "0.6295733", "0.62920517", "0.62920517", "0.62920517", "0.62892616", "0.6287991", "0.6283921", "0.62743086", "0.62710637", "0.6248585", "0.623636...
0.6126792
41
Use callbacks to share common setup or constraints between actions.
def set_transaction @transaction = Transaction.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.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def transaction_params params.require(:transaction).permit(:amount, :phone_number, :provider, :location, :status, :scheduledPickupStartDT, :scheduledPickupEndDT, :messagedPickupDT, :pickedUpDT, :rechargeDueDT, :rechargedDT, :remarks, :search_name, :search_phone , :search_amount, :search_status, :search_date, :pickupDate, :rechargeDate) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /quotes GET /quotes.json
def index @quote = Quote.all @quote = Quote.order(params[:sort]) # Quote.where(created_at: (Time.now.midnight - 1.day)..Time.now.midnight) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @quotes = Quote.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @quotes }\n end\n end", "def quotes(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/latest\", options: params.compact).tap do |resp|\n...
[ "0.7574393", "0.7534979", "0.7397915", "0.72969544", "0.7244606", "0.71744335", "0.71322304", "0.71322304", "0.71322304", "0.68993473", "0.68982375", "0.68472123", "0.684421", "0.682846", "0.6799134", "0.66930014", "0.668739", "0.6683595", "0.6668972", "0.6637092", "0.6636319...
0.0
-1
GET /quotes/1 GET /quotes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n quote = Quote.find(params[:id])\n render json: quote\n end", "def quotes(**args)\n params = convert_params(args)\n client.get(\"#{ENDPOINT}/quotes/latest\", options: params.compact).tap do |resp|\n resp.body = [resp.body]\n end\n end", "def index\n @quote...
[ "0.7524633", "0.7448385", "0.73920596", "0.72778296", "0.72778296", "0.72778296", "0.72688764", "0.725871", "0.7143846", "0.6917484", "0.6889942", "0.68706185", "0.677486", "0.67238706", "0.6722878", "0.667574", "0.66452146", "0.65847296", "0.65645874", "0.65523225", "0.65519...
0.0
-1
POST /quotes POST /quotes.json
def create @quote = Quote.new(quote_params) respond_to do |format| if @quote.save format.html { redirect_to @quote, notice: 'Quote was successfully created.' } format.json { render action: 'show', status: :created, location: @quote } else format.html { render action: 'new' } format.json { render json: @quote.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n quote = Quote.create({\n quote_text: params[:quote_text],\n author: params[:author]\n })\n render json: quote\n end", "def create\n @quoteable = find_quoteable\n @quote = @quoteable.quotes.build(params[:quote])\n\n respond_to do |format|\n if @quote.save\n ...
[ "0.7378766", "0.6996544", "0.6901537", "0.6855313", "0.68146306", "0.67977977", "0.67977977", "0.6587669", "0.6576362", "0.6540236", "0.6528948", "0.6507583", "0.6452878", "0.6372788", "0.63491195", "0.6336383", "0.6270909", "0.6241265", "0.62391186", "0.6228806", "0.622391",...
0.67124504
7
PATCH/PUT /quotes/1 PATCH/PUT /quotes/1.json
def update @quote = Quote.find(params[:id]) @quote.update_attributes(quote_params) respond_to do |format| if @quote.save format.html { redirect_to @quote, notice: 'Quote was successfully created.' } format.json { render action: 'show', status: :created, location: @quote } else format.html { render action: 'new' } format.json { render json: @quote.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @quote.update_attributes(params[:quote])\n respond_with(@quote)\n end", "def update\n @quote = Quote.find(params[:id])\n\n respond_to do |format|\n if @quote.update_attributes(params[:quote])\n format.html { redirect_to @quote, notice: 'Quote was successfully updated.' }\n ...
[ "0.7003056", "0.69530714", "0.695291", "0.69527584", "0.69527584", "0.6746774", "0.6746774", "0.6746774", "0.6746774", "0.6746774", "0.6746774", "0.6746774", "0.67330897", "0.67225546", "0.6716594", "0.665291", "0.66361725", "0.6625031", "0.66159296", "0.65909237", "0.6584734...
0.65700096
21
DELETE /quotes/1 DELETE /quotes/1.json
def destroy @quote.destroy respond_to do |format| format.html { redirect_to quotes_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.html { redirect_to quotes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @quote = Quote.find(params[:id])\n @quote.destroy\n\n respond_to do |format|\n format.ht...
[ "0.765682", "0.7637694", "0.7637694", "0.7637694", "0.76247776", "0.74798775", "0.7419686", "0.74045354", "0.736864", "0.736864", "0.73087656", "0.7285351", "0.72845095", "0.72845095", "0.72845095", "0.72845095", "0.72845095", "0.72845095", "0.72845095", "0.72845095", "0.7284...
0.76115805
5
Use callbacks to share common setup or constraints between actions.
def set_quote @quote = Quote.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.533122...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def quote_params params.require(:quote).permit(:company_name, :quote_information, :quote_amount, :quote_due_date, :artwork_due_date, :artwork_proof_link, :production_notes, :quote_status, :quote_link, :order_ship_date, :order_installation_date) 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.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
Returns elapsed time in seconds, total (system plus user) CPU time in seconds, and maximum resident set size (memory usage) in Kilobytes, which I think means KiB.
def parse_time(time_pathname) elapsed, sys, user, max_rss = File.read(time_pathname).split [elapsed.to_f, sys.to_f + user.to_f, max_rss.to_i] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpu_time\n @cpu_time_finish - @cpu_time_start\n end", "def get_total_runtime_ms\n (TimeDifference.between(*get_runtime_timestamps).in_seconds * 1000).to_i\n end", "def cpu_time_used\n domain_info[:cpuTime]\n end", "def cpu_time_used\n domain_info[:cpuTime]\n end", "def e...
[ "0.7701808", "0.72406816", "0.7156466", "0.7156466", "0.69826204", "0.67972475", "0.67111003", "0.6694018", "0.6659475", "0.665843", "0.6608414", "0.64848685", "0.64848685", "0.64446646", "0.64298344", "0.6408587", "0.63998556", "0.63932174", "0.63745147", "0.6340304", "0.630...
0.0
-1
Dat sweetsweet Unicode regex checking
def japanese? !!(self =~ /\p{Katakana}|\p{Hiragana}/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_unicode_9_0\n assert \"A\\u{17000}B\".match(/\\p{Tangut}/)\nend", "def isutf8(str)\n RegexpUtf8.match( str )\n end", "def has_special_ch?(str)\n (str =~ @@regex)?true:false\n end", "def trans_kana?(vstring)\n /[ア-ンヴヵヶ]/ =~ vstring || /[ア-ン]/ =~ vstring\n end", "def iseuc(str)\n Reg...
[ "0.7407552", "0.70853555", "0.67760134", "0.65974146", "0.6575224", "0.64058834", "0.63543683", "0.63214236", "0.6251349", "0.624938", "0.6244508", "0.6235166", "0.61933124", "0.6183879", "0.60442567", "0.6025537", "0.60225445", "0.6011539", "0.5993703", "0.5979552", "0.59609...
0.0
-1
Gets an access totken for Azure
def get_token(azure_key) token_url = "https://api.cognitive.microsoft.com/sts/v1.0/issueToken" response = Curl.post(token_url) do |response| response.headers['Ocp-Apim-Subscription-key'] = azure_key end return response.body_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_access_token\n # Get the current token hash from session\n token_hash = session[:azure_token]\n\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :...
[ "0.7171353", "0.6953558", "0.67467415", "0.6645198", "0.6447677", "0.64002395", "0.62887967", "0.62575674", "0.62481457", "0.62458706", "0.620723", "0.61961854", "0.61929196", "0.618594", "0.6176729", "0.6165305", "0.61023355", "0.60963196", "0.6096008", "0.6090057", "0.60895...
0.60951704
19
Connects to Azure and translate the toot's content
def translate_toot(toot, token) toot_content = toot.content.strip_tags translation_url = "http://api.microsofttranslator.com/v2/Http.svc/Translate?" + "text=" + toot_content + "&to=en&from=ja" begin response = Curl.get(translation_url) do |response| response.headers['Authorization'] = "Bearer " + token end rescue return false end if response.status != "200 OK" return false end return response.body_str.strip_tags end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(items)\n return nil if super(items).nil?\n\n url = 'https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to='\n @uri = URI.parse(url + @langs.key(@settings['translation_language']))\n @headers = { 'Ocp-Apim-Subscription-Key' => @settings['api_key'] }\n ['Content-Type', 'Ac...
[ "0.6183417", "0.616856", "0.6140199", "0.60634655", "0.58402056", "0.58127576", "0.56791383", "0.55997115", "0.5583961", "0.5516086", "0.55159795", "0.5418572", "0.5408986", "0.52271056", "0.52140695", "0.518717", "0.5174988", "0.5174988", "0.5174988", "0.5174988", "0.5174988...
0.69592875
0
Does the work of establishing the connection to Mastodon
def connect_to_mastodon(token) Mastodon::REST::Client.new( base_url: 'https://mastodon.cloud', bearer_token: token ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def establish_connection\n end", "def connect!; end", "def connect!; end", "def connect\n end", "def connect\n @connection.create\n end", "def connect; end", "def connect\n\tend", "def connect\n @connection.open\n end", "def connect\n @connection_manager.connect\n...
[ "0.72771007", "0.7011882", "0.7011882", "0.69862294", "0.69190335", "0.69172907", "0.69022495", "0.6846247", "0.67761856", "0.67502856", "0.6718504", "0.670629", "0.6591799", "0.6571475", "0.6571475", "0.6571475", "0.6571475", "0.6571475", "0.6571475", "0.6571475", "0.6571475...
0.6376265
27
Inject our custom handling of require into the Kernel.
def hook_require! @hooking_require = true # There are two independent require methods. Joy! ::Kernel.prepend RequireLogger (class << ::Kernel; self; end).prepend RequireLogger @hooking_require = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.module_eval do\n class << self\n orig_public_require = Kernel.public_method(:require)\n define_method(:require) do |path, *args|\n ::Bumbler...
[ "0.70425624", "0.7013503", "0.6855929", "0.6590154", "0.6470833", "0.6356053", "0.63532203", "0.6295362", "0.62836945", "0.6269593", "0.62223274", "0.60974556", "0.6090209", "0.60423344", "0.60407245", "0.5941881", "0.593823", "0.59351546", "0.59351546", "0.5900883", "0.57822...
0.66858834
3
Even better: Other gems hook require as well. The instance method one at least.
def watch_require! ::Kernel.module_eval do # It isn't previously defined in Kernel. This could be a bit dangerous, though. def self.method_added(method_name, *_args) if method_name == :require && !::Bumbler::Hooks.hooking_require? # Fix those hooks. ::Bumbler::Hooks.hook_require! end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hook_require!\n hook_instance_require!\n hook_singleton_require!\n end", "def hook_require!\n @hooking_require = true\n\n # There are two independent require methods. Joy!\n ::Kernel.module_eval do\n class << self\n orig_public_require = Kernel.pub...
[ "0.8043912", "0.7666401", "0.7288238", "0.70787036", "0.6923136", "0.6812155", "0.67527807", "0.6531326", "0.6527504", "0.6515599", "0.64916587", "0.64413476", "0.6325919", "0.63209134", "0.62476844", "0.6242521", "0.61783916", "0.61498034", "0.6141116", "0.6138257", "0.61188...
0.6900693
5
Actually do something about a require here.
def handle_require(path, &block) # break out early if we're already handling the path return yield if path == @previous_require @previous_require = path # ignore untracked gem return yield unless (gem_name = Bumbler::Bundler.gem_for_require(path)) # track load starts Bumbler::Bundler.require_started(gem_name) unless @started_items[gem_name] @started_items[gem_name] = true time, result = benchmark(path, &block) # TODO: for items with multiple paths we need to add the times Bumbler::Bundler.require_finished(gem_name, path, time) if result result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require!\n @required = true\n end", "def require!\n @required = true\n end", "def conscientious_require; end", "def require(p0) end", "def require!\n yield if block_given?\n require @require_path\n rescue LoadError => exception\n @error = exception\n @satisfi...
[ "0.725932", "0.725932", "0.72304857", "0.7071184", "0.7039408", "0.6885414", "0.68483645", "0.68399", "0.66655064", "0.6621615", "0.6601988", "0.66002756", "0.6568051", "0.6534264", "0.64713836", "0.64713836", "0.6388922", "0.6380855", "0.63397706", "0.6338342", "0.6321265", ...
0.6852467
7
GET /client_events GET /client_events.json
def index @client_events = ClientEvent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(reques...
[ "0.7801329", "0.74775034", "0.7406579", "0.73452014", "0.72535944", "0.71210814", "0.7117756", "0.7093984", "0.7072594", "0.7023973", "0.7013762", "0.69860274", "0.6932043", "0.69098604", "0.6866279", "0.68397945", "0.68276334", "0.6827364", "0.67713875", "0.6745214", "0.6731...
0.7582464
1
GET /client_events/1 GET /client_events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def index\n @client_events = ClientEvent.all\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n @event = Event.find(params[:id])\n ...
[ "0.7490008", "0.736981", "0.726539", "0.72412294", "0.6944167", "0.6925251", "0.6916995", "0.68882126", "0.68478894", "0.6815063", "0.677966", "0.6774698", "0.676071", "0.67255354", "0.67101765", "0.6702525", "0.6699395", "0.6696671", "0.6690183", "0.6672842", "0.665375", "...
0.0
-1
POST /client_events POST /client_events.json
def create @client_event = ClientEvent.new(client_event_params) respond_to do |format| if @client_event.save format.html { redirect_to @client_event, notice: 'Client event was successfully created.' } format.json { render :show, status: :created, location: @client_event } else format.html { render :new } format.json { render json: @client_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @event = Event.new(event_params)\n @event.user = current_user\n @event.client = Client.find(params[:event][:client_id])\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show,...
[ "0.7194454", "0.7095184", "0.69364196", "0.6768759", "0.6691625", "0.6639225", "0.66091347", "0.65675455", "0.65646034", "0.6539156", "0.6537612", "0.65373", "0.65210396", "0.650589", "0.6489856", "0.6485164", "0.6449328", "0.64478916", "0.644352", "0.644352", "0.64017564", ...
0.7536565
0
PATCH/PUT /client_events/1 PATCH/PUT /client_events/1.json
def update respond_to do |format| if @client_event.update(client_event_params) format.html { redirect_to @client_event, notice: 'Client event was successfully updated.' } format.json { render :show, status: :ok, location: @client_event } else format.html { render :edit } format.json { render json: @client_event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j...
[ "0.71390975", "0.68285114", "0.67913556", "0.6673604", "0.66540617", "0.66480815", "0.6642359", "0.6626081", "0.659541", "0.6568784", "0.6568784", "0.65275955", "0.6510078", "0.6482932", "0.6427157", "0.64257115", "0.6400649", "0.63769853", "0.6369708", "0.6366965", "0.636368...
0.7116103
1
DELETE /client_events/1 DELETE /client_events/1.json
def destroy @client_event.destroy respond_to do |format| format.html { redirect_to client_events_url, notice: 'Client event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_event = ClientEven...
[ "0.77055633", "0.757925", "0.7160958", "0.7137524", "0.7137524", "0.7137524", "0.71352696", "0.70228666", "0.6967035", "0.69651294", "0.69423985", "0.6925719", "0.6908847", "0.6903957", "0.6903573", "0.6901902", "0.6901632", "0.68941975", "0.68941975", "0.68941975", "0.689419...
0.7538971
2
Use callbacks to share common setup or constraints between actions.
def set_client_event @client_event = ClientEvent.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 client_event_params params.require(:client_event).permit(:event_id, :client_id, :payment_method_id, :ticket_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
Connects signals for all desired widget behaviors.
def connect_signals add_events Gdk::Event::BUTTON_PRESS_MASK signal_connect('button_press_event') do |w, e| begin_move_drag e.button, e.x_root, e.y_root, e.time end signal_connect('delete-event') { Gtk.main_quit } @tagbox.signal_connect('activate') do |w| if @scroller_thr @scroller_thr.kill @picturebox.children.each { |child| @picturebox.remove child } @combined_size = 0 GC.start end size = if @size_used == :tiny || @size_used == :small :thumb else :small end @scroller = Scroller.new(w.text.strip, size) @scroller.add_observer self Thread.abort_on_exception = true @scroller_thr = Thread.new(@scroller) { |scroller| @scroller.scroll } @interactionbox.visible = false @waitingbox.visible = true @infolabel.text = '' end signal_connect('enter_notify_event') { |w, e| grab_focus } signal_connect('expose-event') do |w, e| cr = w.window.create_cairo_context cr.set_operator Cairo::OPERATOR_SOURCE cr.set_source_rgba 0.0, 0.0, 0.0, 0.85 cr.paint false # cr end signal_connect('screen-changed') { |w, e| screen_changed w } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_signals; end", "def declare_signals\n self.signal_connect(:delete_event){finish_commands}\n @new_btn.signal_connect(:clicked){finish_commands}\n @quit_btn.signal_connect(:clicked){Gtk.main_quit}\n @idiom_rdo[0].signal_connect(:clicked){\n change_idiom_to(:en)\n self.create_texts\n...
[ "0.62195396", "0.61161315", "0.6039746", "0.598376", "0.5764635", "0.5760507", "0.56830484", "0.56692564", "0.54832184", "0.5299848", "0.5134381", "0.5134381", "0.5125885", "0.5054053", "0.4978948", "0.49441764", "0.4915691", "0.48811945", "0.48777592", "0.48469704", "0.48459...
0.5353961
9
for the h method
def initialize(output) @output = output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_h\n end", "def H(*args)\n end", "def inc_h\n end", "def cp_h\n end", "def hd\n \n end", "def add_a_h\n end", "def hiss; end", "def hamlet; end", "def private; end", "def hvals(key); end", "def hvals(key); end", "def sub_hl\n end", "def header; end", ...
[ "0.7422639", "0.73702604", "0.7024651", "0.68995863", "0.67918754", "0.6784133", "0.6761726", "0.6591199", "0.6564148", "0.6468458", "0.6468458", "0.6312357", "0.63058585", "0.63058585", "0.63058585", "0.6282117", "0.6240452", "0.61907476", "0.61813563", "0.6150867", "0.60524...
0.0
-1
Sets the authentication credentials. Also accepts whether to use WSSE digest.
def credentials(username, password, digest = false) self.username = username self.password = password self.digest = digest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_credentials(credentials)\n @credentials = credentials\n end", "def set_auth(username, password)\r\n @http_client.http_adapter.set_auth(username, password)\r\n end", "def set_auth(username, password)\r\n raise CLXException, 'Username must be a string' unless username.is_a? Strin...
[ "0.76725245", "0.71587014", "0.69552517", "0.6911157", "0.6888115", "0.6874198", "0.6874198", "0.68380433", "0.68262726", "0.6807011", "0.673695", "0.6669921", "0.6632165", "0.6605321", "0.66034335", "0.660308", "0.65115404", "0.6497339", "0.64758164", "0.6453456", "0.6369223...
0.7503084
2
Returns whether to use WSSE digest. Defaults to +false+.
def digest? !!@digest end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest?\n mechanism == :digest\n end", "def digest?\n mechanism == :digest\n end", "def digest?\n type == :digest\n end", "def digest?\n !!asset_config[\"digest\"]\n end", "def secure?\n false\n end", "def digest\n serve_assets == \"local_dynam...
[ "0.6633049", "0.6550017", "0.6339106", "0.6265998", "0.542191", "0.53634596", "0.53450143", "0.5307047", "0.52868557", "0.52820957", "0.52300596", "0.52300596", "0.5218898", "0.51919043", "0.51839936", "0.5159496", "0.5158406", "0.51576203", "0.5148059", "0.51427096", "0.5139...
0.6833854
1
Returns the XML for a WSSE header or an empty String unless authentication credentials were specified.
def to_xml return "" unless username && password builder = Builder::XmlMarkup.new builder.wsse :Security, "xmlns:wsse" => WSENamespace do |xml| xml.wsse :UsernameToken, "wsu:Id" => wsu_id, "xmlns:wsu" => WSUNamespace do xml.wsse :Username, username xml.wsse :Nonce, nonce xml.wsu :Created, timestamp xml.wsse :Password, password_node, :Type => password_type end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def header_xml(xml, wsa)\n xml.Header {\n xml[\"#{namespace_key(:wsa)}\"].Action(wsa, \"#{namespace_key(:envelope)}:mustUnderstand\" => true)\n }\n xml\n end", "def to_xml\n if username_token? && timestamp?\n Gyoku.xml wsse_username_token.merge!(wsu_timestamp) {\n |k...
[ "0.62620586", "0.6116602", "0.55583596", "0.55488455", "0.55266804", "0.5518609", "0.549727", "0.54357797", "0.5357185", "0.5305983", "0.52768224", "0.5267183", "0.5237209", "0.5158985", "0.5133196", "0.51279855", "0.5052228", "0.5047822", "0.5037644", "0.5020285", "0.5019442...
0.59855944
2
Returns the WSSE password. Encrypts the password for digest authentication.
def password_node return password unless digest? token = nonce + timestamp + password Base64.encode64(Digest::SHA1.hexdigest(token)).chomp! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end", "def encryption_password\n res = @resource[:encryption_password]\n ph = @property_hash[:encryption_password]\n return ph if res.nil?\n return :default if res == :default &&\n ph == @...
[ "0.71960443", "0.7057638", "0.70571667", "0.70546055", "0.6930377", "0.69248474", "0.68975097", "0.6888087", "0.68452305", "0.68433106", "0.6822599", "0.6821194", "0.6817553", "0.6792712", "0.6792085", "0.67581606", "0.6748899", "0.6747734", "0.67435724", "0.6731464", "0.6718...
0.0
-1
Returns a WSSE nonce.
def nonce @nonce ||= Digest::SHA1.hexdigest random_string + timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nonce\n ((Time.now.to_f * 1000000).to_i << 10).to_s\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce\n Array.new( 5 ) { rand(256) }.pack('C*').unpack('H*').first\n end", "def nonce_bytes\n NONCEBYTES\n end", "def cnon...
[ "0.7927963", "0.7742119", "0.7644662", "0.7194758", "0.7194092", "0.7079512", "0.70336485", "0.7002088", "0.69553787", "0.6899624", "0.6767053", "0.6686583", "0.6603039", "0.65828663", "0.6551832", "0.6257097", "0.62165266", "0.6041158", "0.6041158", "0.60358864", "0.60245466...
0.7639202
4
Returns a random String of 100 characters.
def random_string (0...100).map { ("a".."z").to_a[rand(26)] }.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string\n\t# generate a bucket of chars for randomization\n\tbucket = [('a'..'z'),('A'..'Z'),(0..9)].map{|i| i.to_a}.flatten\n\t # pick random chars from the bucket and return a 255 char string\n\treturn (0...255).map{ bucket[rand(bucket.length)] }.join\nend", "def random_big_string offset = rand(1..5...
[ "0.79790276", "0.7601809", "0.75339526", "0.75045025", "0.74976283", "0.7492114", "0.7491424", "0.7474522", "0.7456702", "0.7442442", "0.7417522", "0.74075186", "0.739285", "0.73904014", "0.73853624", "0.7362929", "0.7351046", "0.7320435", "0.73202103", "0.7314947", "0.729174...
0.80276877
1
Returns a WSSE timestamp.
def timestamp @timestamp ||= Time.now.strftime Savon::SOAP::DateTimeFormat end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wsu_timestamp\n security_hash :wsu, \"Timestamp\",\n \"wsu:Created\" => (created_at || Time.now).xs_datetime,\n \"wsu:Expires\" => (expires_at || (created_at || Time.now) + 60).xs_datetime\n end", "def get_timestamp\n timestamp = Time.now.gmtime\n timestamp = timestamp.strftim...
[ "0.7040136", "0.69389045", "0.68198305", "0.6795696", "0.6778105", "0.67495114", "0.66303873", "0.6617634", "0.651699", "0.6506801", "0.64699054", "0.64686257", "0.6398484", "0.63360065", "0.63325804", "0.6285629", "0.6277766", "0.627716", "0.62627083", "0.6256061", "0.623655...
0.6140435
31
Returns the "wsu:Id" attribute.
def wsu_id "UsernameToken-#{count}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id\n @attributes[\"#{self.class.to_s.split('::').last.underscore.downcase}_id\".to_sym]\n end", "def confly_id\n attributes['id']\n end", "def scribd_id\n @attributes[:id]\n end", "def id\n attr_val('cda:act/cda:id/@root')\n end", "def id\r\n attributes[\"ino:id...
[ "0.68776965", "0.6702408", "0.6550218", "0.6535572", "0.6502311", "0.6478713", "0.6462469", "0.64349055", "0.6357645", "0.6341309", "0.6334125", "0.630942", "0.62902457", "0.6272034", "0.62697345", "0.6260516", "0.6260516", "0.6260516", "0.6242404", "0.6236836", "0.6234061", ...
0.64884
5
Create a new Clock instance.
def initialize() @start = Clock.runtime() @last_tick = @start @ticks = 0 @target_frametime = nil yield self if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 50\n @clock.calibrate\n @clock.enable_tick_events\n end", "def make_clock\n @clock = Clock.new()\n @clock.target_framerate = 30\n @clock.calibrate\n end", "def setup_clock\n @clock = Clock.new()\n @clock.targ...
[ "0.73306537", "0.70946765", "0.6298238", "0.5995245", "0.5979759", "0.59792733", "0.59792733", "0.59792733", "0.59792733", "0.58591765", "0.5784605", "0.5701488", "0.5701488", "0.56346196", "0.5607356", "0.54216933", "0.5419295", "0.5416386", "0.5382455", "0.5344144", "0.5332...
0.5566571
15
Returns the current target framerate (frames/second).
def target_framerate if @target_frametime 1000.0 / @target_frametime else nil end rescue ZeroDivisionError return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def framerate\n\t\t\t\t# below is same as: return @ticks / (lifetime / 1000.0)\n\t\t\t\treturn 1000.0 * @ticks / lifetime()\n\t\t\trescue ZeroDivisionError\n\t\t\t\treturn 0\n\t\t\tend", "def getFramesPerSecond\n @framesPerSecond\n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n ...
[ "0.82842237", "0.7603003", "0.75797176", "0.75797176", "0.75797176", "0.7559734", "0.7525969", "0.7448878", "0.7386453", "0.724796", "0.71540594", "0.70360285", "0.70153373", "0.6926557", "0.6914581", "0.68974066", "0.68974066", "0.68310887", "0.68310887", "0.6795025", "0.679...
0.7960962
1
Sets the target number of frames per second to +framerate+.
def target_framerate=( framerate ) if framerate @target_frametime = 1000.0 / framerate else @target_frametime = nil end rescue ZeroDivisionError @target_frametime = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame_rate=(rate)\n @list.each { |c| c.change_frame_rate(@fps, rate) }\n @fps = rate\n end", "def set_frame_rate(rate)\n @cue_list.frame_rate = rate\n end", "def fps=(fps)\n validator = EnumAttributeValidator.new('Float', [12, 15, 23.976, 24, 25, 29.97, 30])\n unless validato...
[ "0.6792937", "0.65795815", "0.65573776", "0.65374345", "0.65290767", "0.636487", "0.63075143", "0.61844426", "0.5878046", "0.5878046", "0.5878046", "0.5653454", "0.56234765", "0.5623449", "0.5623449", "0.5623449", "0.5623449", "0.5623449", "0.5623449", "0.5623449", "0.5623449...
0.8092805
0
callseq: lifetime() > Numeric Returns time in milliseconds since this Clock instance was created.
def lifetime Clock.runtime() - @start end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def length\n seconds.to_runtime\n end", "def lifetime_in_minutes\n return @lifetime_in_minutes\n end", "def lifetime\n if running?\n Time.now - start_time\n elsif finished?\n end_time - start_time\n end\n end", ...
[ "0.7161245", "0.7108412", "0.70091206", "0.70091206", "0.6760255", "0.6725017", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.6669904", "0.66186184", "0.659012", "0.65864587", "0.6586233", "0.6581402", "0.6571587", ...
0.78252715
0
callseq: framerate() > Numeric Return the actual framerate (frames per second) recorded by the Clock. See tick. TODO: sample only a few seconds in the past, instead of the entire lifetime of the Clock.
def framerate # below is same as: return @ticks / (lifetime / 1000.0) return 1000.0 * @ticks / lifetime() rescue ZeroDivisionError return 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def framerate(input)\n process(:framerate, input)\n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def fps\r\n @fps_counter.fps\r\n end", "def fps\n @fps\n end", "def frame_rate\n @cue_...
[ "0.7505094", "0.74421257", "0.74421257", "0.74421257", "0.70242864", "0.69934696", "0.6986008", "0.6965169", "0.692625", "0.6842809", "0.6791858", "0.67755085", "0.67642707", "0.6596985", "0.6487149", "0.6428744", "0.64041656", "0.6389907", "0.63779736", "0.6289188", "0.62507...
0.8297467
0
Returns the number of milliseconds since you last called this method. You must call this method once per frame (i.e. per iteration of your main loop) if you want to use the framerate monitoring and/or framerate limiting features. Framerate monitoring allows you to check the framerate (frames per second) with the framerate method. Framerate limiting allows you to prevent the application from running too fast (and using 100% of processor time) by pausing the program very briefly each frame. The pause duration is calculated each frame to maintain a constant framerate. Framerate limiting is only enabled if you have set the target_framerate= or target_frametime=. If you have done that, this method will automatically perform the delay each time you call it. (Please note that no effort is made to correct a framerate which is slower than the target framerate. Clock can't make your code run faster, only slow it down if it is running too fast.)
def tick() passed = Clock.runtime() - @last_tick # how long since the last tick? if @target_frametime return Clock.delay(@target_frametime - passed) + passed end return passed ensure @last_tick = Clock.runtime() @ticks += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def frame_interval\n 1.0/@fps\n end", "def framerate\n\t\t\t\t# below is same as: return @ticks / (lifetime / 1000.0)\n\t\t\t\treturn 1000.0 * @ticks / lifetime()\n\t\t\trescue ZeroDivisionError\n\t\t\t\treturn 0\n\t\t\...
[ "0.6894787", "0.6894787", "0.6894787", "0.6764167", "0.65949506", "0.65922385", "0.6495816", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", "0.6382315", ...
0.57993084
56
Set locale in response to client's browser setting.
def set_locale accept_language = request.headers['Accept-Language'] return if accept_language.blank? available = %w{en ja} accept_language.split(',').each do |locale_set| locale = locale_set.split(';').first if available.include?(locale) I18n.locale = locale break end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def set_locale\r\n I18n.locale = extract_locale_from_request\r\n end", "def set_locale\n logger.debug \"* Accept-Language: #{request.env['HTTP_ACCEPT_LANGUAGE']}\"\n I18n.locale = extract_locale_from_accept_language_heade...
[ "0.8105122", "0.81030905", "0.80395216", "0.8016898", "0.8014043", "0.7870455", "0.78487563", "0.78177893", "0.7745602", "0.7694138", "0.7694138", "0.7672791", "0.7648218", "0.7646294", "0.76131725", "0.7599411", "0.7597719", "0.75818646", "0.75601023", "0.7557214", "0.753507...
0.75328463
21
use only on controller that we want to protect.
def index @jobs = Job.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access_control\n \n end", "def auth_controller?\n false\n end", "def protect?(_action)\n true\n end", "def protect?(_action)\n true\n end", "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def protect?(action)\n true\n end", "def protec...
[ "0.7080534", "0.69622827", "0.6765631", "0.6765631", "0.67591524", "0.6738321", "0.6738321", "0.6738321", "0.6738321", "0.67368114", "0.67142683", "0.6609042", "0.6604534", "0.6565764", "0.6553195", "0.65493375", "0.65237033", "0.6518185", "0.64972883", "0.6491293", "0.647475...
0.0
-1
LIST Get a list of currently installed webhooks. GET /api_v2/webhooks.json
def all raw_response = get_request('webhooks') parse_response(raw_response, :webhooks) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get(uri: '/webhooks/')\n end", "def list()\n _params = {}\n return @master.call 'webhooks/list', _params\n end", "def list\n Mailgun.submit(:get, webhook_url)[\"webhooks\"] || []\n end", "def list_webhooks(opts = {})\n data, _status_code, _headers = list_webho...
[ "0.89823323", "0.8862308", "0.88597757", "0.8271589", "0.76914054", "0.7600376", "0.7472983", "0.7157942", "0.70819867", "0.7011999", "0.7011999", "0.7011999", "0.7011999", "0.7011999", "0.7011999", "0.6816213", "0.6779262", "0.66562766", "0.66527826", "0.6556652", "0.6472769...
0.80103993
4
get block header information.
def getblockheader(block_id, verbose) block_hash = block_id.rhex entry = node.chain.find_entry_by_hash(block_hash) raise ArgumentError.new('Block not found') unless entry if verbose { hash: block_id, height: entry.height, version: entry.header.version, versionHex: entry.header.version.to_even_length_hex, merkleroot: entry.header.merkle_root.rhex, time: entry.header.time, mediantime: node.chain.mtp(block_hash), nonce: entry.header.nonce, bits: entry.header.bits.to_even_length_hex, previousblockhash: entry.prev_hash.rhex, nextblockhash: node.chain.next_hash(block_hash).rhex } else entry.header.to_hex end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_block_headers(options = {block_range: (0..0)}, &block)\n get_block_objects(options.merge(object: :block_header), block)\n end", "def header\n return @header\n end", "def getHeader() @header1 end", "def read_block_header # :nodoc:\n unless header = rio.read(BLOCK_HEADER_SIZE)\n ...
[ "0.741483", "0.7320797", "0.7244565", "0.71885586", "0.711902", "0.7043221", "0.69760096", "0.6791572", "0.6784318", "0.6771961", "0.67525303", "0.6741439", "0.6725684", "0.6715721", "0.6711397", "0.6611485", "0.65868527", "0.6580698", "0.65793", "0.6535806", "0.652683", "0...
0.7377386
1
Returns connected peer information.
def getpeerinfo node.pool.peers.map do |peer| local_addr = "#{peer.remote_version.remote_addr.addr_string}:18333" { id: peer.id, addr: "#{peer.host}:#{peer.port}", addrlocal: local_addr, services: peer.remote_version.services.to_even_length_hex.rjust(16, '0'), relaytxes: peer.remote_version.relay, lastsend: peer.last_send, lastrecv: peer.last_recv, bytessent: peer.bytes_sent, bytesrecv: peer.bytes_recv, conntime: peer.conn_time, pingtime: peer.ping_time, minping: peer.min_ping, version: peer.remote_version.version, subver: peer.remote_version.user_agent, inbound: !peer.outbound?, startingheight: peer.remote_version.start_height, best_hash: peer.best_hash, best_height: peer.best_height } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def peerinfo\n if (pi = getpeername_as_array)\n return pi[1] + ':' + pi[2].to_s\n end\n end", "def peerinfo\n if self.conn\n pi = self.conn.peerinfo || nil\n if pi\n return {\n 'addr' => pi.split(':')[0],\n 'port' => pi.split(':')[1].to_i\n }\n end\n ...
[ "0.7729055", "0.76506734", "0.7561899", "0.7330514", "0.7282007", "0.72470534", "0.7240406", "0.7210152", "0.67571473", "0.6720465", "0.67098105", "0.65575016", "0.6375734", "0.63240236", "0.6225883", "0.6174784", "0.6131208", "0.6130755", "0.6066736", "0.6053425", "0.6046468...
0.72539407
5
wallet api create wallet
def createwallet(wallet_id = 1, wallet_path_prefix = Bitcoin::Wallet::Base.default_path_prefix) wallet = Bitcoin::Wallet::Base.create(wallet_id, wallet_path_prefix) node.wallet = wallet unless node.wallet {wallet_id: wallet.wallet_id, mnemonic: wallet.master_key.mnemonic} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wallet = Wallet.build_secure_wallet(wallet_params)\n\n respond_to do |format|\n if @wallet.save\n format.html { redirect_to @wallet, notice: 'Wallet was successfully created.' }\n format.json { render :show, status: :created, location: @wallet }\n else\n format.ht...
[ "0.79354465", "0.7789154", "0.7512338", "0.7409217", "0.740591", "0.7384002", "0.73325056", "0.72742593", "0.7222498", "0.7128111", "0.7081233", "0.7044476", "0.7033374", "0.69705826", "0.6930262", "0.6926095", "0.6909015", "0.6822887", "0.6803207", "0.6803207", "0.6803207", ...
0.75413585
2
get current wallet information.
def getwalletinfo node.wallet ? node.wallet.to_h : {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def wallet\n get 'wallet'\n end", "def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'appl...
[ "0.84152645", "0.7884375", "0.7647404", "0.725685", "0.72041637", "0.7085868", "0.69463634", "0.6891384", "0.6499245", "0.6471868", "0.6412507", "0.637937", "0.62032247", "0.6135825", "0.61055845", "0.6098647", "0.6065132", "0.6064917", "0.60542965", "0.6039482", "0.60071117"...
0.826012
1
get the list of current Wallet accounts.
def listaccounts return {} unless node.wallet accounts = {} node.wallet.accounts.each do |a| accounts[a.name] = node.wallet.get_balance(a) end accounts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accounts\n return [] if self.id.nil?\n @accounts ||= \n OrgSync::Base.request(\"#{self.class.endpoint}/#{self.id}/accounts\", {}, @api_key).map { |json| \n OrgSync::Account.new(json, @api_key) \n }\n end", "def accounts\n account_data = request('listaccounts')\n ...
[ "0.7455087", "0.73201716", "0.73093945", "0.72517806", "0.72109795", "0.7198059", "0.7146572", "0.7120139", "0.70756197", "0.70464563", "0.7044432", "0.7023931", "0.70052165", "0.698824", "0.69784474", "0.69708824", "0.69318813", "0.6929535", "0.6919083", "0.68674046", "0.685...
0.7909116
0
create new bitcoin address for receiving payments.
def getnewaddress(account_name) node.wallet.generate_new_address(account_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_address(wallet_id: default_wallet_id, chain: 0)\n call :post, '/wallet/' + wallet_id + '/address/' + chain\n end", "def new_address\n private_key, public_key = Bitcoin::generate_key\n address = Bitcoin::pubkey_to_address(public_key)\n [private_key, public_key, address]\nend", "def new...
[ "0.7754658", "0.7528756", "0.74703246", "0.7433558", "0.73707724", "0.71086234", "0.7055674", "0.70255035", "0.6988528", "0.6969735", "0.6841215", "0.67682123", "0.6759193", "0.6758243", "0.67544425", "0.6693221", "0.6693068", "0.6639762", "0.6630913", "0.65733373", "0.657138...
0.6920437
10
GET /api/v1/user_to_progresses GET /api/v1/user_to_progresses.json
def index @api_v1_user_to_progresses = Api::V1::UserToProgress.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def index\n @api_v1_progresses = Api::V1::Progress.all\n end", "def userrequests\n @requests = Reque...
[ "0.71781546", "0.59070694", "0.5542092", "0.53976023", "0.53976023", "0.53424305", "0.5280096", "0.52716476", "0.52421373", "0.5179127", "0.51781964", "0.51571774", "0.50834745", "0.5074525", "0.505837", "0.5054464", "0.5050817", "0.5050817", "0.5035786", "0.5027724", "0.5023...
0.7613742
0
GET /api/v1/user_to_progresses/1 GET /api/v1/user_to_progresses/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @api_v1_user_to_progresses = Api::V1::UserToProgress.all\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def index\n @api_v1_prog...
[ "0.7481306", "0.7212402", "0.60471237", "0.5498404", "0.5498404", "0.54838216", "0.53526294", "0.5306619", "0.5259572", "0.51806855", "0.51682216", "0.51681465", "0.51543486", "0.5151636", "0.51248854", "0.5119331", "0.5047976", "0.5023606", "0.5016016", "0.49975455", "0.4995...
0.0
-1
POST /api/v1/user_to_progresses POST /api/v1/user_to_progresses.json
def create @api_v1_user_to_progress = Api::V1::UserToProgress.new(api_v1_user_to_progress_params) respond_to do |format| if @api_v1_user_to_progress.save format.html { redirect_to @api_v1_user_to_progress, notice: 'User to progress was successfully created.' } format.json { render :show, status: :created, location: @api_v1_user_to_progress } else format.html { render :new } format.json { render json: @api_v1_user_to_progress.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @api_v1_user_to_progresses = Api::V1::UserToProgress.all\n end", "def user_info\n user = User.find_by(id: params[:id])\n progresses = user.progresses.select {|p| p.habit.user.id == params[:id]} \n \n render json: progresses\n end", "def create\n\n @congress...
[ "0.673966", "0.6134533", "0.5592537", "0.54869896", "0.5336699", "0.5335965", "0.5212116", "0.509057", "0.50455683", "0.5034891", "0.5026885", "0.499189", "0.49904582", "0.49638963", "0.49280876", "0.4876373", "0.48483104", "0.4844041", "0.48384604", "0.4837638", "0.48252356"...
0.5191465
7
PATCH/PUT /api/v1/user_to_progresses/1 PATCH/PUT /api/v1/user_to_progresses/1.json
def update respond_to do |format| if @api_v1_user_to_progress.update(api_v1_user_to_progress_params) format.html { redirect_to @api_v1_user_to_progress, notice: 'User to progress was successfully updated.' } format.json { render :show, status: :ok, location: @api_v1_user_to_progress } else format.html { render :edit } format.json { render json: @api_v1_user_to_progress.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @user\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def appr...
[ "0.60007125", "0.5847844", "0.56976855", "0.5669065", "0.5664125", "0.5658824", "0.5658824", "0.5654539", "0.5651676", "0.56068534", "0.5603188", "0.5592018", "0.5575931", "0.55752486", "0.5548085", "0.5517836", "0.5505345", "0.5495891", "0.5491814", "0.548762", "0.54784566",...
0.5769589
2
DELETE /api/v1/user_to_progresses/1 DELETE /api/v1/user_to_progresses/1.json
def destroy @api_v1_user_to_progress.destroy respond_to do |format| format.html { redirect_to api_v1_user_to_progresses_url, notice: 'User to progress was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.js...
[ "0.6321449", "0.6306389", "0.628742", "0.62230974", "0.61828655", "0.6179564", "0.6164015", "0.60934246", "0.6070472", "0.6069447", "0.6050719", "0.6045418", "0.60361326", "0.60293937", "0.60189223", "0.6017308", "0.6013181", "0.5992445", "0.5972203", "0.5961343", "0.5949925"...
0.7023359
0
Use callbacks to share common setup or constraints between actions.
def set_api_v1_user_to_progress @api_v1_user_to_progress = Api::V1::UserToProgress.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 api_v1_user_to_progress_params params.require(:api_v1_user_to_progress).permit(:user_id, :course_id, :category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
Solution one For every element in find_nums, hit every element in nums O(MN) Time complextiy, O(N) space
def next_greater_element(find_nums, nums) result = [] find_nums.each do |num| i = nums.length - 1 closest_greater_num = -1 while nums[i] != num do if nums[i] > num closest_greater_num = nums[i] end i -= 1 end result << closest_greater_num end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solve(nums)\n arr = nums.map {|num| num * num}\n arr.each_with_index do |el1, idx1|\n arr.each_with_index do |el2, idx2|\n if idx2 > idx1\n if arr.include?(el1 + el2)\n if (arr.index(el1 + el2) != idx1) && (arr.index(el1 + el2) != idx2)\n ...
[ "0.7494658", "0.6971952", "0.6679571", "0.6529512", "0.6451176", "0.6413557", "0.63684535", "0.63109535", "0.6306744", "0.6267235", "0.62649876", "0.6253772", "0.6222617", "0.618507", "0.6159525", "0.6156932", "0.6155139", "0.61477983", "0.61364216", "0.6125789", "0.6125464",...
0.0
-1
GET /databases/1 GET /databases/1.json
def show @database = Database.find(params[:id]) @database.refresh_database_state # If the rds was restored from a snapshot, a few fields have to be modify after becomes available: security_groups, password, size @database_client = @database.sync_agi_fields_to_rds unless @database.snapshot_id.blank? respond_to do |format| format.html # show.html.erb format.json { render json: @database } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(database_id:)\n path = '/databases/{databaseId}'\n .gsub('{databaseId}', database_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n params = {\n }\n ...
[ "0.74316555", "0.72443676", "0.70786995", "0.70450383", "0.7023893", "0.68812215", "0.6874336", "0.686257", "0.682454", "0.67674804", "0.67674804", "0.6759645", "0.66504323", "0.6558165", "0.65539783", "0.64491403", "0.641716", "0.63856256", "0.63038117", "0.62991023", "0.628...
0.6250999
21
GET /databases/new GET /databases/new.json
def new @database = Database.new @restore_db_instance_from_db_snapshot = params[:restore_db_instance_from_db_snapshot] || false load_parameter_groups respond_to do |format| format.html # new.html.erb format.json { render json: @database } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @database = Database.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @database }\n end\n end", "def new\n @database = Database.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json=> @datab...
[ "0.7388292", "0.7358827", "0.6625329", "0.65818465", "0.6541608", "0.6531798", "0.6527999", "0.64768904", "0.6426396", "0.63567394", "0.63227177", "0.62528217", "0.62200356", "0.6098111", "0.6073905", "0.6010282", "0.5992603", "0.5920863", "0.5900302", "0.5893924", "0.5874020...
0.6831317
2
POST /databases POST /databases.json
def create @database = Database.new(params[:database]) @database.started = false @database.state = 'stopped' respond_to do |format| if @database.save format.html { redirect_to @database, notice: 'Database was successfully created.' } format.json { render json: @database, status: :created, location: @database } else format.html { render action: "new" } format.json { render json: @database.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(database_id:, name:)\n path = '/databases'\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if name.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"nam...
[ "0.67222893", "0.6284033", "0.6246424", "0.61982185", "0.6078135", "0.60154533", "0.5951128", "0.5753527", "0.5732933", "0.569083", "0.56786764", "0.5658349", "0.56253177", "0.5596215", "0.5569166", "0.55486286", "0.55414313", "0.55411404", "0.5488448", "0.5475935", "0.541764...
0.56980187
9
PUT /databases/1 PUT /databases/1.json
def update @database = Database.find(params[:id]) load_parameter_groups respond_to do |format| if @database.update_attributes(params[:database]) format.html { redirect_to @database, notice: 'Database was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } format.json { render json: @database.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(database_id:, name:)\n path = '/databases/{databaseId}'\n .gsub('{databaseId}', database_id)\n\n if database_id.nil?\n raise Appwrite::Exception.new('Missing required parameter: \"databaseId\"')\n end\n\n if name.nil?\n ...
[ "0.6775889", "0.6549423", "0.65219116", "0.6271367", "0.61528236", "0.6001172", "0.5974114", "0.58394384", "0.57932705", "0.57336724", "0.56951535", "0.5673141", "0.5673141", "0.56350434", "0.5569889", "0.5569889", "0.55048215", "0.542903", "0.5427414", "0.5419818", "0.541394...
0.5601062
14
DELETE /databases/1 DELETE /databases/1.json
def destroy @database = Database.find(params[:id]) if @database.started @database_client = RdsServer.find(@database.name) @database_client.destroy end @database.destroy respond_to do |format| format.html { redirect_to databases_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def db_destroy_sqlite3(*args)\n\t\t\t...
[ "0.7380417", "0.7144193", "0.7080206", "0.6988758", "0.69717085", "0.6815921", "0.67519933", "0.6720937", "0.6719557", "0.6670649", "0.66636664", "0.66582775", "0.66210383", "0.6616237", "0.6612994", "0.6547018", "0.6507088", "0.6420997", "0.6360254", "0.6320872", "0.6313677"...
0.66585267
11
RdsServer gets the raw errors from aws, this method try to parse those errors and assaign it to a specifc database field, if not just, add the error to base.
def transform_active_resource_erros_to_database(active_resource,database) # this hash, maps aws errors to specific agi database fields errors_map = { "DBInstanceAlreadyExists" => :name, "DBInstanceIdentifier" => :name, "DBSecurityGroupName" => :security_group_name, "availability zone" => :availability_zone, "boolean must follow" => :multi_az, "master_username" => :username, "master user name" => :username, "password" => :password, "MasterUserPassword" => :password, "DBName" => :db_name, "DB engine" => :db_type, "Cannot find version" => :engine_version, "storage size" => :instance_storage, "DB instance" => :instance_class, "DBParameterGroup" => :parameter_group, "DBSecurityGroup" => :security_group_name } active_resource.errors.messages.each_value do |aws_raw_error| field_message = errors_map.select { |aws_error_pattern,db_field| aws_raw_error.join =~ /#{aws_error_pattern}/ } if field_message.blank? database.errors.add(:base,aws_raw_error) else field_message.each_value { |db_field| database.errors.add(db_field,aws_raw_error) } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mssql_parse_error(data, info)\n\t\tlen = data.slice!(0,2).unpack('v')[0]\n\t\tbuff = data.slice!(0,len)\n\n\t\terrno,state,sev,elen = buff.slice!(0,8).unpack('VCCv')\n\t\temsg = buff.slice!(0,elen * 2)\n\t\temsg.gsub!(\"\\x00\", '')\n\n\t\tinfo[:errors] << \"SQL Server Error ##{errno} (State:#{state} Severity...
[ "0.6034448", "0.597305", "0.5952843", "0.59249187", "0.5899661", "0.58690035", "0.56473905", "0.5638912", "0.56341636", "0.5624099", "0.5594304", "0.55866677", "0.55704576", "0.55324113", "0.55260086", "0.54994124", "0.5464977", "0.5446316", "0.54342896", "0.54144716", "0.541...
0.5747455
6
def welcome system "clear" puts "Welcome To It's Not Me!" puts "The Game Where You Have To Find The Hider!" puts "But Watch Out For The Decoys!" puts "" end
def game_finder puts puts "Looking For An Empty Lobby!" sleep(3) puts "Oh Look, Game 1 Is Empty" #Futrue version will display all empty games #Seeker will then start each round end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def welcome\n system \"clear\" or system \"cls\"\n puts \"\\n____________________________________________________________________________\\n\"\n puts \" __ __ _ _ _ _ _____ __ ______ \\n\"\n puts \" / ) / ) /| / /| / / ' / ) / ...
[ "0.87751955", "0.86822325", "0.8643117", "0.8576781", "0.8508052", "0.83776456", "0.8321204", "0.8305405", "0.8228183", "0.81931895", "0.81665313", "0.8147975", "0.8040826", "0.80072266", "0.8006309", "0.7934207", "0.78982997", "0.78342295", "0.78245264", "0.7818041", "0.7797...
0.0
-1
Thread that reduces penalty for QueueObjects
def fair_queue worker_threaded do while @connected sleep(Ricer4::Queue::Frame::SECONDS * 2) @queue_lock.synchronize do @queue.each{|to, queue| queue.reduce_penalty } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue; end", "def queue; end", "def queue(_); end", "def queue(_); end", "def queue_job; end", "def push(obj)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.push obj\n begin\n...
[ "0.729671", "0.729671", "0.7059103", "0.7059103", "0.64638656", "0.64069587", "0.63913757", "0.63847995", "0.63376063", "0.633618", "0.6311486", "0.62768364", "0.62768364", "0.62768364", "0.62594014", "0.62206227", "0.614732", "0.61268866", "0.61231047", "0.61130494", "0.6103...
0.66096026
4
Thread that sends QueueObject lines
def send_queue worker_threaded do while @connected @queue_lock.synchronize do @queue.each do |to, queue| break if @frame.exceeded? if reply = queue.pop send_socket_reply(reply) end end @queue.select! { |to,queue| !queue.empty? } @queue = Hash[@queue.sort_by { |to,queue| queue.penalty }] end sleep @frame.sleeptime end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_queue\n puts \"Waiting for new messages\"\n th = Thread.new do\n Thread.current.abort_on_exception = true\n loop do\n # This will sit around and wait forever.\n key, raw_msg = @redis_client.blpop(@redis_in_key, 0)\n json_m...
[ "0.6836388", "0.6821761", "0.6614647", "0.6606657", "0.6577586", "0.648388", "0.64328533", "0.64328533", "0.6247655", "0.6228128", "0.6215361", "0.6215361", "0.61933315", "0.61071163", "0.60890234", "0.6054446", "0.6035651", "0.60131", "0.6012607", "0.595716", "0.59443927", ...
0.6504961
5
GET /supports GET /supports.json
def index @supports = Support.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n @supports = Support.all\n end", "def supports?\n raise \"Method 'supports?' must be defined\"\n end", "def supports_json?\n false\n end", "def supports_json?\n false\n end", "def supports?\n fail \"Method 'supports?' must be defined\"\n end...
[ "0.65853333", "0.6422839", "0.63477075", "0.63477075", "0.6326838", "0.609027", "0.58829504", "0.5830267", "0.5814108", "0.5788244", "0.5697201", "0.5682357", "0.5648367", "0.5647686", "0.56413645", "0.563323", "0.563323", "0.563323", "0.563323", "0.563323", "0.56207055", "...
0.67538
0
GET /supports/1 GET /supports/1.json
def show if freelance_signed_in? puts 'freelance' @chat_usr_name = current_freelance.username @chat_usr_type = true else if client_signed_in? @client = current_client @chat_usr_name = current_client.username @chat_usr_type = false else render :file => 'public/401.html', status: 401 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @supports = Support.all\n end", "def index \n @supports = Support.all\n end", "def stub_supports(model, feature = :update, supported: true)\n model = model.class unless model.kind_of?(Class)\n feature = feature.to_sym\n\n receive_supports = receive(:supports?).wit...
[ "0.6743048", "0.6593895", "0.5887677", "0.5844582", "0.5844582", "0.57594365", "0.5661326", "0.56551814", "0.56301284", "0.5617321", "0.5609965", "0.5609565", "0.5507689", "0.5496344", "0.54921454", "0.5473292", "0.5473292", "0.5471692", "0.5454781", "0.5444586", "0.54396456"...
0.0
-1
POST /supports POST /supports.json
def create @support = Support.where("client_id=" + params[:client_id] + " and freelance_id=" + current_freelance.id.to_s).limit(1).take! puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxx' puts @support puts 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXxxx' if @support == nil @support = Support.new @support.client_id = params[:client_id] @support.freelance_id = current_freelance.id if @support.save newAddr = supports_path + '/' + @support.id.to_s redirect_to newAddr else render :file => 'public/500.html', status: :unprocessable_entity end return end if freelance_signed_in? @sender_type=true else if client_signed_in? @sender_type=false end end newAddr = supports_path + '/' + @support.id.to_s redirect_to newAddr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def supports_json?\n false\n end", "def supports_json?\n false\n end", "def supports?\n raise \"Method 'supports?' must be defined\"\n end", "def create\n authorize! :create, @profile\n respond_to do |format|\n begin\n @profile.supports.create!(support_pa...
[ "0.64081514", "0.64081514", "0.6333461", "0.63132405", "0.6254459", "0.6207655", "0.613188", "0.5687742", "0.5614414", "0.5614414", "0.5614414", "0.5614414", "0.5614414", "0.5571969", "0.5499869", "0.54893255", "0.54795915", "0.54771554", "0.54771554", "0.5471995", "0.5459676...
0.0
-1
PATCH/PUT /supports/1 PATCH/PUT /supports/1.json
def update respond_to do |format| if @support.update(support_params) format.html { redirect_to @support, notice: 'Support was successfully updated.' } format.json { render :show, status: :ok, location: @support } else format.html { render :edit } format.json { render json: @support.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_method_modifies_resource?\n ['PUT','POST','PATCH'].include?(method.to_s.upcase)\n end", "def update!(**args)\n @supports_client_op_preloading = args[:supports_client_op_preloading] if args.key?(:supports_client_op_preloading)\n @supports_non_finalized_responses = args[:supp...
[ "0.6337599", "0.61145085", "0.61079365", "0.606134", "0.6034466", "0.60016066", "0.59969866", "0.58654237", "0.58440465", "0.5826982", "0.5826982", "0.5819661", "0.5817146", "0.57922274", "0.5789094", "0.57717687", "0.56022835", "0.56017977", "0.55928594", "0.55739206", "0.54...
0.0
-1
DELETE /supports/1 DELETE /supports/1.json
def destroy @support.destroy respond_to do |format| format.html { redirect_to supports_url, notice: 'Support was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @support.destroy\n respond_to do |format|\n format.html { redirect_to supports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @profile\n @support = @profile.supports.find(params[:id])\n @support.destroy\n respond_to do |for...
[ "0.6980216", "0.68277854", "0.64929026", "0.6443757", "0.6426991", "0.6336529", "0.6333236", "0.63124", "0.6283868", "0.6261545", "0.62305", "0.6219751", "0.6174292", "0.61652225", "0.6163297", "0.6155852", "0.6125349", "0.61144525", "0.61100334", "0.6102022", "0.6097525", ...
0.6483201
3
Use callbacks to share common setup or constraints between actions.
def set_support @support = Support.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163821", "0.6045432", "0.5945441", "0.5916224", "0.58894575", "0.5834073", "0.57764685", "0.5702474", "0.5702474", "0.5653258", "0.56211996", "0.54235053", "0.5410683", "0.5410683", "0.5410683", "0.53948104", "0.5378064", "0.5356684", "0.53400385", "0.53399503", "0.533122...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def support_params #params.fetch(:support, {}) 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.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
The story's authors sees only the comments All the others see the commments after the story
def story_card_comments_link(story, story_locale = nil) if can? :edit, story story_comments_path(story) else story_path(story, anchor: 'comments-anchor', story_locale: story_locale) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def news_topics_comments\r\n @story = hacker_news_client.item(params[:id])\r\n @comments = (@story['kids'] || []).map do |comment|\r\n hacker_news_client.item(comment)\r\n end\r\n end", "def comments; end", "def comments; end", "def comments; end", "def comments; end", "def comments; end",...
[ "0.6549357", "0.6430767", "0.6430767", "0.6430767", "0.6430767", "0.6430767", "0.6430767", "0.63495076", "0.61491174", "0.61481893", "0.61076", "0.61076", "0.6101553", "0.60664284", "0.6036549", "0.6035874", "0.6014352", "0.59832233", "0.5981177", "0.5969402", "0.5961738", ...
0.5992393
17
use different parser for different file type add new parser to extend this function
def import_data path, file_type if file_type == :csv csv_parse(path).each { |params| Product.new(params).save } elsif file_type == :xls #xls_parse(path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluggable_parser; end", "def parser; end", "def parser; end", "def parser; end", "def parser; end", "def parser_type_for_filename(filename); end", "def parser(content_type); end", "def open_parser(this_file)\n\t\t@file = this_file\n\t\t@parser = PbfParser.new(file)\n\tend", "def select_parser(c...
[ "0.7183639", "0.7091951", "0.7091951", "0.7091951", "0.7091951", "0.6952098", "0.6870687", "0.6623837", "0.6592744", "0.64905286", "0.6428499", "0.63916093", "0.63772833", "0.63529366", "0.6348397", "0.6340142", "0.6338437", "0.6308203", "0.6281736", "0.624619", "0.6235846", ...
0.0
-1
GET /contents GET /contents.json
def index puts "index" @contents = Content.all respond_to do |format| format.html # index.html.erb format.js format.json { render json: @contents } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n\n @contents = Content.all\n\n respond_to do |f...
[ "0.74262136", "0.7269371", "0.7266361", "0.72174233", "0.7038064", "0.69323933", "0.6910215", "0.66560143", "0.66524565", "0.66425157", "0.6599564", "0.6599564", "0.6574353", "0.6479462", "0.64792967", "0.630142", "0.6301243", "0.6278448", "0.6272318", "0.6272318", "0.6272318...
0.6578063
12
GET /contents/1 GET /contents/1.json
def show @content = Content.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n\n @contents = Content.all\n\n respond_to do |f...
[ "0.73382056", "0.72770315", "0.7272879", "0.72427475", "0.6950326", "0.68929857", "0.6776605", "0.6776605", "0.6757675", "0.6703292", "0.6669753", "0.6638511", "0.66024095", "0.65535367", "0.64556605", "0.6426458", "0.6398575", "0.63938487", "0.63766253", "0.6351906", "0.6341...
0.6455098
20
GET /contents/new GET /contents/new.json
def new @content = Content.new respond_to do |format| format.html # new.html.erb format.json { render json: @content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @title = t 'view.contents.new_title'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @content }\n end\n end", "def new\n @content = Content.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json =...
[ "0.7067716", "0.7024418", "0.67535186", "0.6737475", "0.66857255", "0.6648103", "0.6637698", "0.6588164", "0.65232074", "0.64825094", "0.6481895", "0.6481895", "0.6481895", "0.6481895", "0.6481895", "0.6481895", "0.6481895", "0.6481895", "0.64777744", "0.64554465", "0.6429762...
0.706326
5
POST /contents POST /contents.json
def create @content = Content.new(params[:content]) respond_to do |format| if @content.save format.html { redirect_to @content, notice: 'Content was successfully created.' } format.json { render json: @content, status: :created, location: @content } else format.html { render action: "new" } format.json { render json: @content.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def create(contents, params = {:language => \"Plain Text\", :private => false})\n params = params.merge({:contents => contents}.merge(@base_params))\n self.class.post(\"/paste\", :body => params).parsed_response\n end", "...
[ "0.6282009", "0.62486786", "0.620182", "0.60974866", "0.60562325", "0.6044423", "0.6020207", "0.5959216", "0.59045476", "0.5900914", "0.58946466", "0.58662325", "0.5840403", "0.5793481", "0.5786892", "0.5785959", "0.57757515", "0.5762252", "0.5748183", "0.5742464", "0.5740254...
0.5670805
26
PUT /contents/1 PUT /contents/1.json
def update @content = Content.find(params[:id]) respond_to do |format| if @content.update_attributes(params[:content]) format.html { redirect_to @content, notice: 'Content was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @content.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path]...
[ "0.65913343", "0.65913343", "0.6412978", "0.6361471", "0.6277382", "0.62092793", "0.61958116", "0.6082109", "0.6079336", "0.603147", "0.60219884", "0.597553", "0.59204835", "0.59085745", "0.5868048", "0.583082", "0.5788616", "0.5771957", "0.57678777", "0.5738109", "0.5733235"...
0.57885087
18
DELETE /contents/1 DELETE /contents/1.json
def destroy @content = Content.find(params[:id]) @content.destroy respond_to do |format| format.html { redirect_to contents_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :ok }\n end\n end", "def destroy...
[ "0.7508528", "0.734377", "0.73066396", "0.73066396", "0.73066396", "0.7073485", "0.7073485", "0.70593846", "0.7046281", "0.70352846", "0.7026785", "0.6990942", "0.6968309", "0.6968309", "0.6968309", "0.6957546", "0.694398", "0.6918344", "0.6886133", "0.6856177", "0.6854174", ...
0.72924906
6
Wait for a request, process it, publish the response and exit
def process_request! job = Thread.current[:redis_blocking].brpop(Scales::Storage::REQUEST_QUEUE, 0).last id, response = nil, nil Thread.current[:post_process_queue] = [] id, response = process!(job) post_process!(job) @status.put_response_in_queue!(response) Thread.current[:redis_nonblocking].publish(Scales::Storage::RESPONSE_CHANNEL, JSON.generate(response)) [id, response] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def response\n parse_request\n do_something\n put_response\n end", "def finalize(env)\n # closing the write end of the pipe will mark EOF on the read end\n env[\"tus.input-writer\"].close unless env[\"tus.input-writer\"].closed?\n # wait for the request to finish\n result = env[\"tus.reques...
[ "0.6529517", "0.6393831", "0.63797176", "0.63797176", "0.63562065", "0.6333659", "0.6293019", "0.61389834", "0.61286837", "0.6056373", "0.6052501", "0.60214144", "0.60179335", "0.59543693", "0.595228", "0.59519786", "0.59297657", "0.5928587", "0.59216446", "0.5905827", "0.590...
0.6594524
0
Loop the processing of requests
def work! @status.start! puts "Environment: #{Scales.env}".green puts "Application: #{@type.name}".green puts "Path: #{Dir.pwd}".green puts "Log Path: #{@status.log_path}".green puts "Threads: #{Scales.config.worker_threads}".green puts "Redis: #{Scales.config.host}:#{Scales.config.port}/#{Scales.config.database}".green begin start_pool! rescue Interrupt => e @pool.map(&:exit) puts "Goodbye".green end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_loop\n @request_queue.receive_messages.each do |msg|\n yield(get_request(msg))\n end\n end", "def each_request(&block)\n\t\trequests.each do |request|\n\t\t\tblock.call(request)\n\t\tend\n\tend", "def each_request(&block)\n\t\trequests.each do |request|\n\t\t\tblock.call(request...
[ "0.7097106", "0.7072495", "0.7072495", "0.6738869", "0.6632572", "0.65287", "0.6479477", "0.64657074", "0.6462482", "0.64335835", "0.6420938", "0.6413606", "0.63958514", "0.6391231", "0.63857836", "0.6363095", "0.6363095", "0.6358364", "0.6321755", "0.6306611", "0.62965995", ...
0.0
-1
Gather CPU Related metrics and report them in %
def get_cpu(snmp = nil) snmp = snmp_manager unless snmp get_routing_engines(snmp) if @routing_engines.empty? res = gather_snmp_metrics_by_name("CPU", @routing_engines, ROUTING_ENGINE_CPU, snmp) NewRelic::PlatformLogger.debug("Device: Got #{res.size}/#{@routing_engines.size} CPU metrics") return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_cpu\n self.report('cpu_report')\n end", "def cpu_metrics\n super\n end", "def processor_percents\n reply = `sar -P ALL #{@sleep} 1`\n lines = reply.split(\"\\n\")\n header = lines.shift\n num_cpus = header[/\\((\\d+) CPU\\)$/, 1].to_i\n # read a cycle\n 3.times { lines....
[ "0.7919583", "0.7893225", "0.74063504", "0.7344866", "0.73241127", "0.7282253", "0.72657156", "0.7094688", "0.708847", "0.68820524", "0.6840267", "0.67180115", "0.6595953", "0.6587819", "0.6544213", "0.6516299", "0.64363414", "0.62975687", "0.6285765", "0.62831366", "0.628313...
0.674401
11
Gather Memory related metrics and report them in bytes
def get_memory_used(snmp = nil) snmp = snmp_manager unless snmp get_routing_engines(snmp) if @routing_engines.empty? res = gather_snmp_metrics_by_name("Memory/Used", @routing_engines, ROUTING_ENGINE_MEM_USED, snmp) NewRelic::PlatformLogger.debug("Device: Got #{res.size}/#{@routing_engines.size} Memory used metrics") return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memory(_)\n query = @client.percent_query_free(\n 'node_memory_MemTotal',\n 'node_memory_MemAvailable'\n )\n prepare_metrics('memory', @client.query(query))\n end", "def report_mem\n self.report('mem_report')\n end", "def memstats\n # initializ...
[ "0.74418414", "0.7294135", "0.717905", "0.7062964", "0.70488745", "0.70176446", "0.6961453", "0.6906771", "0.68042123", "0.67519623", "0.6718585", "0.6691843", "0.66700333", "0.66674834", "0.66674834", "0.6597135", "0.6553773", "0.649104", "0.64778304", "0.6445398", "0.641262...
0.5970332
58
Gather routing engine temps (degrees C)
def get_temp(snmp = nil) snmp = snmp_manager unless snmp get_routing_engines(snmp) if @routing_engines.empty? res = gather_snmp_metrics_by_name("Temp", @routing_engines, ROUTING_ENGINE_TEMP, snmp) NewRelic::PlatformLogger.debug("Device: Got #{res.size}/#{@routing_engines.size} Temperature metrics") return res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_temp\n result = HTTParty.get( @tstat_ip + '/tstat/temp', :headers => @headers) \n \n degrees = result['temp']\n\n if @units == :c || @units == :celsius\n degrees = ( degrees - 32 ) * 5 / 9\n end\n\n return degrees\n end", "def ctof(celsius)\n\n (celsius * 9/5) + 32\n\nend"...
[ "0.6204321", "0.5792086", "0.5787065", "0.5750113", "0.5727417", "0.5704229", "0.5682346", "0.56662166", "0.5646205", "0.56395537", "0.56269366", "0.56153077", "0.5606483", "0.5581437", "0.5576509", "0.5570889", "0.55379117", "0.55367804", "0.55267227", "0.55255204", "0.55168...
0.52652186
59
define method for media_creation
def add_media(db, mediatype, title, rentLease, mediaconsumed) db.execute('INSERT INTO media (mediatype, title, rentLease, mediaconsumed) VALUES (?, ?, ?, ?)', [mediatype, title, rentLease, mediaconsumed]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n media = params[:media]\n record = MediaElement.new :media => media\n record.title = params[:title_placeholder] != '0' ? '' : params[:title]\n record.description = params[:description_placeholder] != '0' ? '' : params[:description]\n record.tags = params[:tags_value]\n record.user_id ...
[ "0.7313374", "0.7199341", "0.71456945", "0.71271825", "0.70796543", "0.7030121", "0.6905268", "0.68991286", "0.6839315", "0.681701", "0.6781552", "0.67316693", "0.6654799", "0.66346395", "0.65206015", "0.65158343", "0.65127534", "0.6503987", "0.64839935", "0.64553195", "0.645...
0.6224946
41
determine if it's X's or O's turn
def current_player(board) if turn_count(board) % 2 == 0 "X" elsif turn_count(board) % 2 == 1 "O" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_turn\n\t\t@turn == \"x\" ? \"o\" : \"x\"\n\tend", "def whose_turn\n if @turn % 2 == 0\n return \"X\"\n end\n return \"O\"\n end", "def taken?(input_position)\n self.position(input_position) == \"X\" || self.position(input_position) == \"O\"\n end", "def taken?(input)\n (po...
[ "0.77829874", "0.7590653", "0.700774", "0.69270676", "0.6915988", "0.6915988", "0.683864", "0.6834583", "0.6789349", "0.6749229", "0.67407763", "0.6731489", "0.6703628", "0.6691296", "0.66836625", "0.66722846", "0.66687965", "0.666355", "0.6661683", "0.6656759", "0.66479725",...
0.0
-1
Allows adding a new message to the Flash hash in controllers by providing a single type argument which will use translations to build the message. There are 2 ways of storing flash messages in translations : The first is to place translations under : flash... Ex: flash.tasks.create.success The second is to use a shared controller key : flash... Ex: flash.shared.create.success If no controller specific key exists, then the shared one will be picked up Translation options : All options passed to the `flash_message` helper will be forwarded to the `I18n::translate` call, except for the `:model` option that will be first converted to a string with .class.model_name.human, which will use default activerecord translations Example : In TasksControllercreate :
def flash_message(type, options = {}) controller_path = "flash.#{ params[:controller] }.#{ params[:action] }.#{ type }" shared_path = "flash.shared.#{ params[:action] }.#{ type }" options[:model] = options[:model].class.model_name.human if options[:model] options[:default] = I18n.t(shared_path, options) flash[type] = I18n.t(controller_path, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flash_message(type, text)\n flash[type.to_sym] ||= []\n flash[type.to_sym] << text\n end", "def flash_message(type, message)\n flash[type] ||= []\n flash[type] << message\n end", "def build_flash_message(type, options = {})\n final_action_name = action_name.dup\n ...
[ "0.7867448", "0.77774805", "0.7757049", "0.76084095", "0.7047072", "0.6988701", "0.6948092", "0.69285655", "0.67685914", "0.67046475", "0.6692215", "0.6640412", "0.65609044", "0.65609044", "0.6502587", "0.6502587", "0.65002507", "0.64999104", "0.64902973", "0.6483529", "0.646...
0.8403498
0
can be called with curl using http_basic authentication curl u user_name:pass curl u user_name:pass note: user_name should be in the form of user_name, not user.name
def authenticate_member_with_basic_auth! if member = authenticate_with_http_basic { |u,p| Member.find_by_user_name(u).authenticate(p) } session[:member_id] = member.id else authenticate_member! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_the_get_call(args)\n\tputs \"----- GET: #{args[:url]} -----\"\n\tc = Curl::Easy.new(args[:url]) do |curl|\n\t\tcurl.http_auth_types = :basic\n\t\tcurl.username = args[:user]\n\tend\n\tc.perform\n\tc.body_str\nend", "def basic_auth(opts); end", "def basic_auth(*args, &block); end", "def basic_authentic...
[ "0.7266768", "0.71050924", "0.7040935", "0.69562334", "0.6878598", "0.6826907", "0.67120516", "0.668687", "0.66416544", "0.65998554", "0.65905887", "0.6555795", "0.655391", "0.653266", "0.64833903", "0.6441724", "0.6437592", "0.64245266", "0.6415786", "0.64056456", "0.6400182...
0.0
-1
Public: Defines the conditions for a document to be Lazyable. doc the Jekyll::Document or Jekyll::Page Returns true if the doc is written & is HTML.
def Lazyable?(doc) (doc.is_a?(Jekyll::Page) || doc.write?) && doc.output_ext == ".html" || (doc.permalink && doc.permalink.end_with?("/")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def document_processable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))\n end", "def doc?\n (doc && !doc.empty?)\n end", "def doc?\n (doc && !doc.empty?)\n end", "def document?\n ...
[ "0.676577", "0.6468816", "0.6468816", "0.64517033", "0.6122326", "0.61153936", "0.6078838", "0.59953517", "0.59603065", "0.5815682", "0.58019066", "0.57814705", "0.5770814", "0.5735419", "0.5729897", "0.5729897", "0.56717545", "0.5662838", "0.5657163", "0.56318414", "0.559289...
0.76906896
0
GET /admin/shirt_colors/new GET /admin/shirt_colors/new.json
def new @shirt_color = ShirtColor.new respond_to do |format| format.html # new.html.erb format.json { render json: @shirt_color } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @shirt_color = ShirtColor.new(params[:shirt_color])\n\n respond_to do |format|\n if @shirt_color.save\n format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }\n format.json { render json: @shirt_color, status: :created, location: @...
[ "0.77584344", "0.7582571", "0.7562297", "0.75208503", "0.73672837", "0.73672837", "0.73396665", "0.7132455", "0.70843923", "0.70398074", "0.7018187", "0.6976214", "0.6909768", "0.6902758", "0.6843193", "0.6803663", "0.68021286", "0.6784806", "0.6783694", "0.675867", "0.672147...
0.7623322
1
POST /admin/shirt_colors POST /admin/shirt_colors.json
def create @shirt_color = ShirtColor.new(params[:shirt_color]) respond_to do |format| if @shirt_color.save format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' } format.json { render json: @shirt_color, status: :created, location: @shirt_color } else format.html { render action: "new" } format.json { render json: @shirt_color.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to ...
[ "0.72730416", "0.69259435", "0.66636676", "0.6632885", "0.64424765", "0.640716", "0.63633823", "0.63038796", "0.62913734", "0.6279191", "0.62573063", "0.6252593", "0.6213767", "0.619297", "0.6181122", "0.61311877", "0.60835236", "0.60806257", "0.607118", "0.60634327", "0.6062...
0.7479431
0