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
Tracking an Active User
def track_user_id(id) key = current_key redis.sadd(key, id) #redis will reset ttl after modified redis.expire(key, 10.minutes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_user\n user = pending_user\n user.activate! if user.valid?\n user\n end", "def record_user_activity\n current_user.touch :last_active_at if current_user\n end", "def active_user\n User.find_by(activated: true)\n end", "def user_on\n session[:user_id] = '3980284084'\n end"...
[ "0.7422001", "0.74075115", "0.73481596", "0.7023266", "0.6925559", "0.6925559", "0.6910809", "0.69004494", "0.68457526", "0.6792804", "0.676616", "0.67520046", "0.67092717", "0.66756845", "0.66612995", "0.66324973", "0.66241276", "0.65256494", "0.65150255", "0.64568603", "0.6...
0.0
-1
Key to the DayRules date as YYYYMMDD.
def key_by_date self.strftime('%Y-%m-%d') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_date_key(day_or_date)\n if day_or_date.class == Symbol\n day_or_date\n else\n Time.parse(day_or_date).key_by_date\n end\n end", "def day_rule\n @day_rules[@this_day.key_by_date] || @day_rules[@this_day.key_by_day]\n end", "def key_name(time, date_type=RailsRank::Types::Date::HO...
[ "0.7459862", "0.7171333", "0.6430385", "0.6401752", "0.6386605", "0.61568725", "0.60638314", "0.60541236", "0.58978295", "0.5639983", "0.5601566", "0.5574164", "0.5461416", "0.5457718", "0.5438473", "0.5438401", "0.5427033", "0.5420543", "0.53826493", "0.53648925", "0.5346579...
0.69803876
2
Start of the next day.
def next_day_at_midnight Time.parse(self.strftime('%Y-%m-%d')) + (24*60*60) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_day\n advance(days: 1)\n end", "def tomorrow\n advance(days: 1)\n end", "def next_day\r\n if @next_day.nil?\r\n @next_day = convert_day_to_date(current_day).tomorrow.strftime('%Y%m%d')\r\n end\r\n @next_day\r\n end", "def find_next_day\n day = ...
[ "0.84815437", "0.78166044", "0.7723444", "0.7707851", "0.75736594", "0.7510096", "0.7407895", "0.7347865", "0.72259986", "0.69753015", "0.6970478", "0.69278306", "0.69217384", "0.6913323", "0.6911397", "0.68833613", "0.6872237", "0.6845637", "0.6771086", "0.676311", "0.668276...
0.73627293
7
Number of seconds from the given time until closing time.
def seconds_in_day_from(time) if @is_closed || time > time.set_time_to( @closing_time ) 0 else time.set_time_to( @closing_time ) - start_time(time) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seconds_until\n (start_time - Time.now).to_i\n end", "def seconds_until\n (start_time - Time.now).to_i\n end", "def quantity_of_seconds(time)\n time.hour * 60 + time.minute * 60 + time.second + time.second_fraction\nend", "def time_counter\n counter = Time.new.to_i - @time_counter\n...
[ "0.67538863", "0.67538863", "0.65364385", "0.64713395", "0.6439139", "0.6402261", "0.6377659", "0.63767797", "0.63659745", "0.63657176", "0.63496643", "0.6309448", "0.6294882", "0.6254112", "0.6237019", "0.6219408", "0.6185131", "0.61685985", "0.6134612", "0.61067045", "0.603...
0.8058208
0
Bring a time forward to the opening time if it is earlier.
def start_time(time) if time < time.set_time_to( @opening_time ) time.set_time_to( @opening_time ) else time end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_before?(other_time, leeway = 5)\n other_time += leeway\n self <= other_time\n end", "def next_opens\n opening_time.advance(weeks: 1)\n end", "def time_already_open(date)\n open = open_close_times(date).first\n date - open > 0 ? date - open : 0\n end", "def advance(date, tim...
[ "0.6482124", "0.6434191", "0.62325686", "0.6117079", "0.6098094", "0.6071532", "0.6022339", "0.6019682", "0.6016304", "0.600647", "0.5936691", "0.5846651", "0.5846651", "0.5845433", "0.5841385", "0.58318067", "0.58063227", "0.5768151", "0.5761357", "0.5730434", "0.57070196", ...
0.70759255
0
Find the matching day rule. First check using the specific date as those rules have precedence over the day of the week rules.
def day_rule @day_rules[@this_day.key_by_date] || @day_rules[@this_day.key_by_day] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def for(date = Date.today)\n # Format date into a Date class\n date = case date.class.name\n when 'String'\n Date.parse(date)\n when 'Date'\n date\n when 'DateTime'\n Date.new(date.year, date.month, date.day)\n when 'Time'\n ...
[ "0.63275003", "0.6241601", "0.616834", "0.6121707", "0.60301137", "0.5916613", "0.5837747", "0.58228177", "0.581304", "0.57474595", "0.5713819", "0.5676363", "0.5666129", "0.56470656", "0.56469876", "0.5627283", "0.5577233", "0.5549086", "0.5546752", "0.55403084", "0.5539466"...
0.7879755
0
Make sure the keys to be used in seeking the day rules are consistent. This ensures that hours.update "Dec 24, 2010", "8:00 AM", "1:00 PM" and hours.update "20101224", "8:00 AM", "1:00 PM" do the same thing.
def make_date_key(day_or_date) if day_or_date.class == Symbol day_or_date else Time.parse(day_or_date).key_by_date end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @exception = args[:exception] if args.key?(:exception)\n @regular_hours = args[:regular_hours] if args.key?(:regular_hours)\n end", "def update!(**args)\n @open_now = args[:open_now] if args.key?(:open_now)\n @periods = args[:periods] if args.key?(...
[ "0.61807203", "0.61703753", "0.6164932", "0.616049", "0.616049", "0.616049", "0.616049", "0.6067901", "0.6040793", "0.6034855", "0.6014263", "0.5983823", "0.5806015", "0.5806015", "0.5778264", "0.57781523", "0.57781523", "0.57612", "0.5756513", "0.5755601", "0.57374537", "0...
0.0
-1
Creates an atom from the specified value.
def initialize(value) @value = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_with_value(value)\n AwesomeObject.new(self, value)\n end", "def new_value(value)\n AwesomeObject.new(self, value)\n end", "def create_node(value)\n Node.new(value)\n end", "def associate_atom!(arg)\n if arg.is_a?(Rubabel::Atom)\n @ob.add_atom(arg.ob)\n arg\n el...
[ "0.59564257", "0.5843915", "0.57185996", "0.57069856", "0.5629697", "0.5451383", "0.53609186", "0.5340622", "0.5310373", "0.5295968", "0.52945167", "0.5187465", "0.51125383", "0.51125383", "0.508364", "0.5080354", "0.5079267", "0.50664127", "0.5055896", "0.5055638", "0.503898...
0.50202054
26
Returns whether this atom is equivalent to another object. This defines a helper which unwraps the inner value of the atom to compare against a literal value, saving us having to do it ourselves everywhere else.
def ==(other) @value == (other.is_a?(Atom) ? other.instance_variable_get(:@value) : other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def equivalentValues(other) # JS == operator\n other.is_a?(Object) && unwrap.eql?(other.unwrap)\n end", "def equivalent?(other)\n Equivalence.new.call(self, other)\n end", "def ==(other)\n case other\n when Literal\n self.value.eql?(other.value) &&\n self.langu...
[ "0.6780366", "0.64078087", "0.63429123", "0.6277745", "0.6187082", "0.6141528", "0.6137125", "0.6107537", "0.5996793", "0.5970057", "0.5963086", "0.5886822", "0.58511436", "0.58382344", "0.58366925", "0.5808417", "0.57996863", "0.57996863", "0.5797689", "0.57840645", "0.57840...
0.70195657
0
The actual report table is lazyloaded separately via companiestop_employees_report endpoint
def index setup_leaderboard(skip_report: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emp_report\n \n end", "def report_data\n @data[:employees].map do |id, employee_data|\n employee = Employee.new(employee_data)\n [employee.name, week_date_ranges.map { |range| \n employee.net_hours_for_date_range(range)} ]\n end\n end", "def generate_new_hire_rep...
[ "0.6838069", "0.6665061", "0.64740306", "0.6429597", "0.64244986", "0.6321203", "0.624391", "0.6215372", "0.6215372", "0.6202006", "0.61624175", "0.6139874", "0.61251545", "0.6110205", "0.60828125", "0.60785574", "0.607804", "0.6076898", "0.606459", "0.6058391", "0.6048608", ...
0.0
-1
Public: Lazily loads the Faraday::Connection for the current Service instance. options Optional Hash of Faraday::Connection options. Returns a Faraday::Connection instance.
def http(options = {}) @http ||= begin Faraday.new(options) do |b| b.request :url_encoded b.adapter :net_http end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connection(options = {})\n\n options = self.connection_options(options)\n \n if @connection_options != options\n @connection = nil\n @connection_options = options\n end\n\n @connection ||= Faraday.new(@connection_options.merge(:builder => self.stack))\n ...
[ "0.8099782", "0.80900896", "0.7511626", "0.74729407", "0.74725205", "0.74248254", "0.7415028", "0.73807716", "0.7292202", "0.72913295", "0.7288038", "0.7261711", "0.72330177", "0.72116613", "0.72102493", "0.7174551", "0.71350133", "0.71350133", "0.71350133", "0.71350133", "0....
0.62010527
83
Public: Shortens the given URL with bit.ly. url String URL to be shortened. Returns the String URL response from bit.ly.
def shorten_url(url) res = http_post("http://crash.io", :url => url) if res.status == 201 res.headers['location'] else url end rescue TimeoutError url end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shorten(url)\n bitly_url = \"http://api.bit.ly/shorten?version=2.0.1&login=#{BITLY_LOGIN}&apiKey=#{BITLY_API_KEY}&longUrl=#{CGI::escape(url)}\"\n resp = open(bitly_url).read\n JSON.parse(resp)['results'][url]['shortUrl']\n rescue\n logger.debug(\"Unable to generate Bit.ly url for #{url}\")\n ni...
[ "0.87098056", "0.8485014", "0.80419445", "0.8018109", "0.7977175", "0.7852668", "0.78525496", "0.7813891", "0.7798159", "0.7744888", "0.7506186", "0.74737936", "0.7431729", "0.73325807", "0.73167527", "0.7308875", "0.73070323", "0.7220229", "0.7197947", "0.71728444", "0.71666...
0.7549438
10
automatically passes :component assign to child widgets
def widget(target, assigns = {}, options = {}, &block) assigns.merge!(:component => @component) {|_,old,_| old } if target.is_a? Class super target, assigns, options, &block end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def widget_assigns\n { :component => self, :root_widget => true }\n end", "def component\n @parent.component\n end", "def configure_component component\n #component.set_form @parent <<--- definitely NOT\n component.form = @parent\n component.rows_panned = component.cols_panned ...
[ "0.6881649", "0.68025726", "0.66947114", "0.66408396", "0.6637107", "0.659715", "0.62813354", "0.6273859", "0.62724733", "0.61902887", "0.61902887", "0.6117658", "0.60560924", "0.60560924", "0.6017192", "0.5968309", "0.59292716", "0.591211", "0.5873916", "0.5825335", "0.57976...
0.6409966
6
calls missing methods on component
def method_missing(method, *args, &block) if component.respond_to?(method) component.__send__ method, *args, &block else super end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(component)\n fail NotImplementedError\n end", "def method_missing(method_name, *args, &block)\n component.send(method_name,*args,&block)\n end", "def components; end", "def components\n\n end", "def method_missing(*)\n invertable nil\n end", "def invoke\r\n # TODO: re...
[ "0.73136926", "0.71193856", "0.61787844", "0.6176889", "0.60938114", "0.6024488", "0.6019996", "0.5987049", "0.59820014", "0.59576154", "0.59576154", "0.5935466", "0.5935466", "0.59147376", "0.59136045", "0.5857288", "0.5846599", "0.5841639", "0.5821873", "0.5812347", "0.5809...
0.7464866
0
sores by method element which will be rendered later with callbacks
def method_missing(method, *args, &block) raise "invalid state, flush first #{self.inspect}" if @tag @tag, @block = method, block @options = args.extract_options! @args = args self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method, *args, &block)\n super(method, *args) unless block_given?\n options, attrs, element = (args.detect { |arg| arg.is_a?(Hash) } || {}), {}, nil\n\n # handle methods separately if they match the pre-defined elements\n if ELEMENTS.include?(method.to_sym)\n ...
[ "0.63674176", "0.59263605", "0.58885354", "0.58885354", "0.58885354", "0.58885354", "0.5827079", "0.5821013", "0.58022124", "0.5787525", "0.5787525", "0.5787525", "0.5787525", "0.5787525", "0.5771295", "0.57624626", "0.57592857", "0.57307124", "0.5719842", "0.5719842", "0.571...
0.0
-1
on which event will be callback triggered
def event(event) # TODO args for events like keypress @events << event self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback( which, *args )\n block = instance_variable_get( \"@on_#{which.to_s}\" )\n block.call( *args ) if block\n end", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def callback\n\n end", "def callback\n\tend", "def callback\n end",...
[ "0.7500958", "0.74192274", "0.73675275", "0.7298433", "0.72571516", "0.7186925", "0.7186925", "0.7186925", "0.69712186", "0.69659215", "0.69659215", "0.6945361", "0.692129", "0.68964577", "0.68964577", "0.6864818", "0.6864818", "0.6864818", "0.6864818", "0.6864818", "0.686481...
0.0
-1
transforms Hash to JSON
def simple_json(hash) str = hash.inject('{') {|str, pair| str << pair[0].to_s.inspect << ':' << pair[1].inspect << "," } str[-1] = '}' str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_hash(hash)\n return hash.to_json\n end", "def hash_to_json( hash )\r\n data = hash.map { |key, value| \"#{key.inspect}: #{value.inspect}\" }\r\n \"{#{data.join(',')}}\"\r\n end", "def jsonify_hash hash\n hash = (hash || {}).to_h\n return hash if hash.empty?\n ...
[ "0.81379545", "0.80404496", "0.76999104", "0.76837564", "0.761577", "0.7597592", "0.75688845", "0.75372785", "0.74694407", "0.74694407", "0.74661547", "0.7448954", "0.7427152", "0.7427152", "0.7427152", "0.7427152", "0.7427152", "0.7427152", "0.7427152", "0.7427152", "0.74271...
0.7501233
8
format the value output depending on the metric format
def formatted_metric_value metric_value return "MISSING" unless metric_value.value case metric_value.metric.metric_format(:type) when :currency number_to_currency(metric_value.value, :unit => metric_value.metric.metric_format(:before)) when :days, :hours, :minutes, :percentage "#{metric_valu...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pretty_metric_value(value)\n case value\n when Float, BigDecimal\n \"#{number_with_delimiter(value.floor)}%\"\n when Integer\n number_with_delimiter value\n when Date, Time\n l value.to_date\n when Array\n value.to_sentence\n else\n value\n end\n end", "def form...
[ "0.7803156", "0.7052148", "0.6871179", "0.6759549", "0.6660498", "0.66550493", "0.64902955", "0.64512056", "0.6438909", "0.6438909", "0.6438909", "0.64102566", "0.6403296", "0.63606465", "0.63482213", "0.63482213", "0.63482213", "0.63482213", "0.63482213", "0.63482213", "0.63...
0.80308735
0
calculate the status of the metric based upon the given average
def metric_status current_value, average_metric classes = ["metric-status"] if current_value if current_value > average_metric content = "Above average" classes << "above-average" elsif current_value < average_metric content = "Below average" classes << "below-average...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cal_mean\n sum = @data.inject(0) do |accu, hash|\n accu + hash[:prediction] - hash[:rating]\n end\n sum.to_f / @data.size\n end", "def mean_overall\n sum_overall / hits_overall\n end", "def running_average; end", "def mean\n return @mean if @mean\n @mean = 0\n @thresholds....
[ "0.68096423", "0.67828786", "0.67606694", "0.6644572", "0.6609905", "0.65569615", "0.6520954", "0.65142006", "0.6509285", "0.6477682", "0.64426136", "0.64398354", "0.6427016", "0.6419187", "0.641197", "0.63806933", "0.6366753", "0.6364972", "0.6331576", "0.6305781", "0.625125...
0.63437325
18
Processed when the form is submitted, see the controller 'processFormSubmission()' method
def onSubmit(request, response, form, errors) return form end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r...
[ "0.75516355", "0.75516355", "0.74962014", "0.74962014", "0.74962014", "0.74962014", "0.729959", "0.7246208", "0.7189243", "0.70873225", "0.6691015", "0.66698605", "0.66587365", "0.6632622", "0.6632622", "0.6575577", "0.65610856", "0.65281606", "0.6476586", "0.64667046", "0.63...
0.75965226
0
TODO: mock out the Consumer to test the Consumer/AccessToken interaction.
def test_get_access_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exchange_oauth_tokens\n end", "def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n auth...
[ "0.7097688", "0.69562364", "0.6932017", "0.68188286", "0.6810641", "0.68077075", "0.6681768", "0.6639974", "0.66045856", "0.65868807", "0.6573504", "0.6532259", "0.65029716", "0.64904195", "0.64606816", "0.64559853", "0.64514965", "0.64431185", "0.6419354", "0.6405302", "0.64...
0.6805447
6
DELETE /photos/1 DELETE /photos/1.json
def destroy @term = Term.find(params[:id]) @term.destroy respond_to do |format| format.html { redirect_to taxonomies_url } format.js format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.ht...
[ "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.7743858", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77150726", "0.77036476", "0.7683938", "0.7666516", "0.7664305", "0.7664305", "0.7651935", "0.7651935", "0.76373297", "0.75912905", "0.75888...
0.0
-1
== [27, 50, 77]
def multiply_list2(arr1, arr2) arr1.zip(arr2).map { |a, b| a * b } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def given\n [6,5,3,1,8,7,2,3]\nend", "def secret_numbers\n\t\t(1..5).to_a \n\tend", "def all_square_equal_to_350(square_intResult)\n res = []\n c = 0\n for i in 0..square_intResult.length()-1\n if (square_intResult[i] === 350)\n res[c] = square_intResult[i]\n c = c + 1\n end\n end\n retur...
[ "0.7216556", "0.5883198", "0.5862995", "0.57557404", "0.57470137", "0.5707889", "0.56806356", "0.56708384", "0.56565374", "0.56495345", "0.5611176", "0.5601692", "0.559951", "0.557273", "0.5568656", "0.55554044", "0.555232", "0.5539062", "0.55226135", "0.55194104", "0.5505407...
0.0
-1
find class of links with the most inlinks dab
def score(class_id, dab, from_id) retain = @classes[class_id].map { |x| x.to_a}.flatten values = BookmarkColorer.color(from_id, @alpha, 0.0000001, retain) do |article| edges = (@out_links[article] || "").split(/\t/) edges.delete(dab) [edges, Array.new(edges.length, 1)] end #p values ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_similar_links\n num_elements(\".sim a\")\n end", "def depth_of_index(link)\n self.avoid_zero_division(1, self.avoid_zero_division(self.depth_of_page_in_url(link), @dpus.values.max))\n end", "def depth_of_page_in_url(link)\n @dpus[link]\n end", "def score(class_id, dab_id, fro...
[ "0.62401724", "0.6148867", "0.5998546", "0.5932003", "0.5861372", "0.5754966", "0.567848", "0.5603947", "0.55686516", "0.55657846", "0.5492117", "0.5456434", "0.54399234", "0.54399234", "0.54151535", "0.5399381", "0.5391796", "0.5388989", "0.5311632", "0.5310796", "0.5300057"...
0.5612039
7
Forms are never themselves persisted
def persisted? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forms; end", "def form; end", "def injection_form\n # Nothing to do here\n end", "def save_form_fields\n @save_form_fields ||= collect_save_form_fields\n end", "def form\n end", "def ing_form; end", "def save_form(values)\n mp values\n persist\n\n back_to_previous_scre...
[ "0.6842453", "0.6679668", "0.661812", "0.6437998", "0.63546854", "0.6255559", "0.6254652", "0.61767834", "0.61639786", "0.61219305", "0.61186904", "0.61013347", "0.60735506", "0.6067733", "0.60620064", "0.60620064", "0.6018028", "0.60148674", "0.5989171", "0.5965017", "0.5910...
0.0
-1
we commonly want to lookup SSM parameters to use as stack parameters
def aws_ssm_get(name, region: nil) ::Aws::SSM::Client.new({region: region}.compact).get_parameter(name: name)&.parameter&.value rescue ::Aws::SSM::Errors::ParameterNotFound fail_task("#{name} not found in #{region||aws_region}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_global_parameters(stack)\n Smash.new(\n \"AWS::Region\" => stack.api.aws_region,\n \"AWS::AccountId\" => stack.id.split(\":\")[4],\n \"AWS::NotificationARNs\" => stack.notification_topics,\n \"AWS::StackId\" => stack.id,\n \"AWS::StackName\" => stack.name...
[ "0.6644256", "0.6324462", "0.60518116", "0.6019418", "0.59660304", "0.5700113", "0.5700113", "0.557355", "0.55480427", "0.5538113", "0.5507595", "0.5502739", "0.5498883", "0.5440053", "0.5428557", "0.540037", "0.53696233", "0.53618973", "0.53483963", "0.5334183", "0.53014255"...
0.60595006
2
find or create a stack object
def stack(id) c = id.to_s.split(/[_-]/).map(&:capitalize).join # convert symbol to class string object = Stax.const_get(c) ObjectSpace.each_object(object).first || object.new([], options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack(which, name)\n @@stacks[which][name]\n end", "def set_stack\n @stack = Stack.find(params[:id])\n end", "def set_stack\n @stack = Stack.find(params[:id])\n end", "def find_in_stack(klass)\n @stack.find { |(processor, _options)| processor.class == klass }\n end", ...
[ "0.6417584", "0.6211281", "0.6211281", "0.603127", "0.6001074", "0.5985277", "0.5817627", "0.5770522", "0.5767264", "0.57400894", "0.5728767", "0.56719744", "0.5638562", "0.55931413", "0.55931413", "0.5585444", "0.5573621", "0.55659217", "0.55659217", "0.55616987", "0.5549527...
0.64674765
0
alias for stack to preserve semantics
def command(id) stack(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stack; end", "def stack; end", "def stack(*args); end", "def stack(new_scope = T.unsafe(nil)); end", "def to_stack; end", "def __stack\n @stack\n end", "def stack\n @stack\n end", "def __stack\n @stack ||= []\n end", "def take_from_stack\n stack.pop\n end",...
[ "0.8295861", "0.8295861", "0.816012", "0.8026022", "0.7927871", "0.77457035", "0.77077395", "0.74664575", "0.72045505", "0.71467537", "0.7064339", "0.6957503", "0.689578", "0.6884206", "0.6841867", "0.68368894", "0.6822945", "0.68183774", "0.6793651", "0.6790535", "0.6790535"...
0.0
-1
return true only if all given env vars are set
def env_set?(*vars) vars.map{ |v| ENV.has_key?(v) }.all? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def env?(*keys)\n if keys.respond_to?(:all?)\n !keys.all? { |k| ENV[k].blank? }\n else\n !ENV[keys].blank?\n end\n end", "def all_env_variables_non_nil?\n return FastlaneCI.env.all.none? { |_k, v| v.nil? || v.empty? }\n end", "def validate_envs?()\n\t\tenv = @options[:en...
[ "0.83284986", "0.77748394", "0.74178106", "0.7396992", "0.7346968", "0.7142848", "0.69552106", "0.6791875", "0.663045", "0.66277754", "0.6590576", "0.6540427", "0.6463013", "0.6313852", "0.6298961", "0.62655395", "0.6209721", "0.61830336", "0.61450607", "0.613323", "0.612644"...
0.8805137
0
fail unless given env vars are set
def ensure_env(*vars) unless env_set?(*vars) fail_task("Please set env: #{vars.join(' ')}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_vars\n req_env_vars = ['REDMINE_BASE_URL', 'REDMINE_API_KEY', 'SLACK_WEBHOOK_URL', 'DATABASE_URL']\n missing_env_vars = req_env_vars - ENV.keys\n unless missing_env_vars.empty?\n puts \"The following environment variables are required: #{missing_env_vars.join ', '}\"\n exit\n end\nend", "def ...
[ "0.7837147", "0.7256019", "0.7242858", "0.7242858", "0.7191041", "0.70610267", "0.70248973", "0.6949048", "0.69454706", "0.68674815", "0.68254316", "0.6814778", "0.6801986", "0.6709522", "0.66966724", "0.6672307", "0.6628502", "0.6538672", "0.6470639", "0.64598185", "0.643270...
0.8170824
0
color a string according to current class COLORS hash
def color(string, hash = nil) hash ||= self.class::COLORS set_color(string, hash.fetch(string.to_sym, :yellow)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def colorize!(color_code) \"#{COLORS[color_code]}#{self.to_s}\\e[0m\" ; end", "def color\n @color ||= COLORS[label.length%COLORS.length].to_sym\n end", "def colorize string, data\n case data\n when String\n \"\\033[0;36m#{string}\\033[0m\"\n when Numeric\n \"\\033[0;33m#{st...
[ "0.7488263", "0.74552876", "0.73812246", "0.729887", "0.723849", "0.7213263", "0.71919507", "0.70826906", "0.7047763", "0.7043678", "0.7008353", "0.6994506", "0.69821715", "0.69821715", "0.69821715", "0.69821715", "0.69821715", "0.6981085", "0.6974854", "0.69625664", "0.69522...
0.7334401
3
make string safe to use in naming CFN stuff
def cfn_safe(string) string.gsub(/[\W_]/, '-') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createValidName(inname)\r\n outname = inname.gsub(/[\\s\\/\\\\?*#+]/,'') # Remove illegal chars (replace with underscore).\r\n outname.gsub!(/_+/,\"_\") # Replace consecutive uscores with single uscore.\r\n outname.gsub!(/\\./,\"-\") # Replace per...
[ "0.7487275", "0.7313276", "0.7242803", "0.7193378", "0.71297145", "0.69505566", "0.6859603", "0.68253267", "0.6821766", "0.6809657", "0.67616796", "0.6761389", "0.66557074", "0.6655305", "0.6655117", "0.6638677", "0.6626994", "0.6619177", "0.66061556", "0.65796906", "0.657920...
0.69799674
5
psycho version of thor yes?() that demands a y or n answer
def y_or_n?(statement, color = nil) loop do case ask(statement, color, :add_to_history => false).downcase when 'y' return true when 'n' return false else puts "please respond 'y' or 'n'" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yes?\r\n input.to_s[0,1].downcase == 'y' or input.to_i == 1\r\n end", "def ask_yes_or_no question\n case(r = ask_getch(question, \"ynYN\"))\n when ?y.ord, ?Y.ord\n true\n when nil\n nil\n else\n false\n end\n end", "def yes?(question)\r\n answer = ask(question).d...
[ "0.79527706", "0.78055114", "0.7797998", "0.7732804", "0.7656808", "0.76001304", "0.7565236", "0.7530418", "0.7523378", "0.74265206", "0.7411285", "0.7363062", "0.73233443", "0.7317779", "0.7302465", "0.7254583", "0.72488445", "0.72302383", "0.72286654", "0.7226493", "0.71828...
0.6616067
44
convert a diff in seconds to d h m s
def human_time_diff(t, n = 5) t = t.round # handle fractional seconds mm, ss = t.divmod(60) hh, mm = mm.divmod(60) dd, hh = hh.divmod(24) {d: dd, h: hh, m: mm, s: ss}.reject{ |_,v| v == 0 }.map{ |k,v| "#{v.round}#{k}" }.first(n).join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_delta_string( seconds )\n\t\treturn 'less than a minute' if seconds < 1.minute \n\t\treturn (seconds / 1.minute).to_s + ' minute' + (seconds/60 == 1 ? '' : 's') if seconds < 50.minutes\n\t\treturn 'about one hour' if seconds < 90.minutes\n\t\treturn (seconds / 1.hour).to_s + ' hours' if seconds < 18.hours...
[ "0.7339125", "0.7339125", "0.7338819", "0.73004925", "0.7246478", "0.71006966", "0.70444286", "0.6987687", "0.69080997", "0.6901143", "0.6868657", "0.68508184", "0.68079084", "0.67942303", "0.6784591", "0.6781948", "0.6777732", "0.6761793", "0.67614836", "0.6699869", "0.66916...
0.62754214
65
convert bytes to nearest unit
def human_bytes(bytes, precision = 0) return 0.to_s if bytes < 1 {T: 1000*1000*1000*1000, G: 1000*1000*1000, M: 1000*1000, K: 1000, B: 1}.each do |unit, value| return "#{(bytes.to_f/value).round(precision)}#{unit}" if bytes >= value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unit2raw(str)\n val, unit = str.split()\n\n if unit.casecmp(\"kb\")\n ret = val.to_i * 1024\n elsif unit.casecmp(\"mb\")\n ret = val.to_i * 1024 * 1024\n elsif unit.casecmp(\"gb\")\n ret = val.to_i * 1024 * 1024 * 1024\n end\n \n return ret.to_s\nend", "def convert_to_bytes(size, unit)\n ...
[ "0.68877494", "0.68741614", "0.67541", "0.6694261", "0.657827", "0.65379673", "0.65186447", "0.65186447", "0.64519507", "0.6256372", "0.6203815", "0.61458737", "0.6114995", "0.6018053", "0.60167557", "0.60004026", "0.59977996", "0.5979549", "0.586703", "0.586351", "0.5860167"...
0.63707167
9
run desktop open command
def os_open(*args) cmd = RUBY_PLATFORM.end_with?('linux') ? 'xdg-open' : 'open' system(cmd, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_command\n if darwin?\n 'open'\n elsif windows?\n 'start'\n else\n 'xdg-open'\n end\n end", "def open_command\r\n if RbConfig::CONFIG[\"host_os\"] =~ /mswin|mingw/\r\n \"start\"\r\n elsif RbConfig::CONFIG[\"host_os\"] =~ /darwin/\r\n \"open\"\r\n else\...
[ "0.7432532", "0.7294065", "0.72898966", "0.7183462", "0.68780845", "0.68710256", "0.680096", "0.6766027", "0.6766027", "0.6683771", "0.6651988", "0.6575658", "0.6543906", "0.6533828", "0.64548147", "0.6374017", "0.63531154", "0.63291776", "0.6316198", "0.63001746", "0.6299867...
0.67784435
7
reports is a hash report_display_name => report
def notification_mail(reports, staff) @reports = reports @reports_keys = reports.keys @first_name = staff.first_name @last_name = staff.last_name # This is an AF kludge...need to revisit subject = reports.size > 1 ? "Radar Digest" : "Radar #{reports.first[1][0].display_name} #{reports.first[1]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n reports = Hash.new \n hours_trackers = HoursTracker.where(report_id: params[:report_id]) \n HoursTracker.where(report_id: params[:report_id]).find_each do |hours_tracker|\n Report.add_hours_tracked(hours_tracker)\n end\n @reports = Report.generate_report\n end", "def report_list_h...
[ "0.73040164", "0.71707076", "0.7108071", "0.706679", "0.69568586", "0.686103", "0.6849966", "0.68121165", "0.6685689", "0.66576236", "0.66337407", "0.6532947", "0.65306824", "0.6509749", "0.64957577", "0.64655215", "0.64428663", "0.63977414", "0.63937753", "0.6385709", "0.638...
0.0
-1
added this to get the current card in round class
def get_a_card(card_number) @cards[card_number] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_card\n @deck.cards[0]\n end", "def current_card\n @deck.cards[@turns.count]\n end", "def current_card\n @deck.cards[count]\n end", "def current_card\n deck.cards[@number_correct]\n end", "def get_card\n end", "def get_card()\n @shoe.get_card()\n end", "def getCard(p...
[ "0.76039016", "0.7554424", "0.741652", "0.7288886", "0.66914487", "0.6628273", "0.6625683", "0.65893614", "0.6559712", "0.6465022", "0.64617866", "0.6457621", "0.6448615", "0.64266795", "0.6421155", "0.6417366", "0.63783205", "0.63562924", "0.6244912", "0.6244296", "0.6221666...
0.5939406
40
Use callbacks to share common setup or constraints between actions.
def set_time_table_item @time_table_item = TimeTableItem.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Only allow a trusted parameter "white list" through.
def time_table_item_params params.require(:time_table_item).permit(:start_time, :end_time, :item_type) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121862", "0.70524937", "0.6947974", "0.69016707", "0.6735245", "0.67157984", "0.66887176", "0.66779864", "0.6660236", "0.6554225", "0.6527208", "0.6456831", "0.6451704", "0.64509416", "0.64478475", "0.6432556", "0.6411603", "0.6411603", "0.6389978", "0.63789994", "0.63789...
0.0
-1
Authenticate at Podio with script credentials
def authenticate sleep(3600) unless $podio_flag == true $podio_flag = true Podio.setup(:api_key => @enum_robot[:api_key], :api_secret => @enum_robot[:api_secret]) Podio.client.authenticate_with_credentials(@enum_robot[:username], @enum_robot[:password]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } ...
[ "0.6593625", "0.646071", "0.64325804", "0.61484915", "0.6068064", "0.6067752", "0.60212606", "0.60040724", "0.59972924", "0.5995871", "0.5976228", "0.5973792", "0.59728163", "0.5957203", "0.5957203", "0.5957203", "0.5957203", "0.5957203", "0.59277254", "0.5923029", "0.5922603...
0.7271011
0
Queries Twitter for all the lists that this username has
def lists Rails.cache.fetch("#{owner_screen_name}.lists", :expires_in => 12.hours) do begin list = Twitter.lists(owner_screen_name) rescue Twitter::Error::TooManyRequests rescue Twitter::Error::NotFound [] end if list list.collect do |item| [item.name, item.slug] end else [...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # specific_assigned_version_process(__callee__, params)\n @twitter_users = current_user.twitter_users.all\n end", "def get_tweets(list)\n if list.authorized?(@user)\n list.tweets\n else\n []\n end\nend", "def list_tweets\n tweets\n end", "def search_user(q)\n uri = ...
[ "0.71793693", "0.6999042", "0.6913897", "0.67187345", "0.6718251", "0.67140234", "0.65930617", "0.6565962", "0.65535504", "0.65433246", "0.6532192", "0.6532157", "0.6520167", "0.651419", "0.64845115", "0.6478773", "0.64739287", "0.6458318", "0.6454964", "0.64533806", "0.64515...
0.7119225
1
Receive a request from the WebServer and route it appropriately Based on the path that was received, we'll forward to one of our _route methods which will respond with a specific format. Both our WebServer and WebApplication have to agree on the shape of the request and response objects. We've defined the request objec...
def process(request_hash) request = Request.new(request_hash) case request.path when '/' index_route(request) when %r{^/sleep/\d+$} sleep_route(request) else Response.new( "No route found for #{request.path}. Try '/' or '/sleep/3'.", status: 404 ) end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req....
[ "0.657722", "0.64970136", "0.64486194", "0.62754196", "0.6156451", "0.60541224", "0.6016809", "0.5994752", "0.5901397", "0.58814", "0.5817839", "0.5814691", "0.57647747", "0.57447237", "0.5723611", "0.5716648", "0.56887937", "0.56512505", "0.562761", "0.5625242", "0.5600505",...
0.6126615
5
GET /weekly_updates GET /weekly_updates.json
def index @weekly_updates = WeeklyUpdate.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekly_goals\n get(\"/user/#{@user_id}/activities/goals/weekly.json\")\n end", "def weekly(workspace_id, params={})\n get_report('weekly', workspace_id, params)\n end", "def weekly\n render json: Question.active.weekly.not_seen(@api_current_user.id).first\n end", "def set_weekly_updat...
[ "0.7098849", "0.6964557", "0.6905869", "0.6853905", "0.66285336", "0.62908894", "0.61153245", "0.6092366", "0.60340023", "0.60138756", "0.59785545", "0.59785545", "0.59476644", "0.5914093", "0.5905965", "0.58643174", "0.5806427", "0.57703847", "0.5752036", "0.5730683", "0.570...
0.78156585
0
GET /weekly_updates/1 GET /weekly_updates/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @weekly_updates = WeeklyUpdate.all\n end", "def set_weekly_update\n @weekly_update = WeeklyUpdate.find(params[:id])\n end", "def weekly\n render json: Question.active.weekly.not_seen(@api_current_user.id).first\n end", "def weekly_goals\n get(\"/user/#{@user_id}/activities/go...
[ "0.777619", "0.70166934", "0.7005389", "0.6978755", "0.68540317", "0.6632465", "0.618908", "0.61814386", "0.6136663", "0.602736", "0.5880841", "0.58579445", "0.58180815", "0.57938826", "0.57916176", "0.5769939", "0.5766307", "0.576456", "0.5764414", "0.57608694", "0.5754226",...
0.0
-1
DELETE /weekly_updates/1 DELETE /weekly_updates/1.json
def destroy @weekly_update.destroy respond_to do |format| format.html { redirect_to weekly_updates_url, notice: 'Weekly update was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @weekly_note.destroy\n respond_to do |format|\n format.html { redirect_to weekly_notes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @battery_weekly_test = BatteryWeeklyTest.find(params[:id])\n @battery_weekly_test.destroy\n\n respond_to do |form...
[ "0.66100174", "0.6521704", "0.64126444", "0.6387574", "0.6333375", "0.6289999", "0.6283616", "0.62631905", "0.6251708", "0.623096", "0.6230762", "0.62199354", "0.62157565", "0.62157565", "0.6167775", "0.6167775", "0.61668456", "0.61668456", "0.616236", "0.6158102", "0.6156779...
0.74066997
0
private Use callbacks to share common setup or constraints between actions.
def set_weekly_update @weekly_update = WeeklyUpdate.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 actions; end", "def define_action_hook; end", "def add_actions; end", "def define_action_helpers\n if super && action == :save\n @ins...
[ "0.6448985", "0.64102066", "0.62795347", "0.6195416", "0.612736", "0.61068505", "0.5978872", "0.5806761", "0.5772149", "0.5759514", "0.5759514", "0.5759514", "0.5709277", "0.5690439", "0.5656979", "0.5656979", "0.5600194", "0.5590277", "0.55782163", "0.55782163", "0.55782163"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def weekly_update_params #params.require(:weekly_update).permit(:project_id, :person_id, :weekstart, :rag, :percent, :comment) params.require(:weekly_update).permit! #(:project, :person, :weekstart, :rag, :percent, :comment) 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
show the specific dream
def show @dreamlist = Dream.all @likeList = Like.all @dream = Dream.find_by_id(params[:id]) if @dream.state != nil @time = @dream.created_at + (@dream.state).to_i.days end @user = User.find_by_id(session[:remember_token]) respond_to do |format| format.html # show.html.erb fo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n e = first_element('show')\n text = e ? e.text : nil\n case text\n when 'away' then :away\n when 'chat' then :chat\n when 'dnd' then :dnd\n when 'xa' then :xa\n else nil\n end\n end", "def show # shows the selected word of the day (redundant)\n ...
[ "0.6322422", "0.6320768", "0.6284746", "0.609321", "0.60820866", "0.605116", "0.604211", "0.60232943", "0.59412694", "0.5900894", "0.5883045", "0.58807003", "0.58695203", "0.58653396", "0.5844577", "0.5826365", "0.58102924", "0.58102924", "0.58102924", "0.58102226", "0.579973...
0.0
-1
loads the pages with a form to add a dream
def new @dream = Dream.new respond_to do |format| format.html # new.html.erb format.json { render :json => @dream } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @page = Page.new\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n\t@meta[:title] = \"DondeVoyAComer.com | Ingres...
[ "0.6247934", "0.60923266", "0.5988759", "0.5985726", "0.5956043", "0.59491867", "0.5935043", "0.59006023", "0.58736247", "0.58667946", "0.5838776", "0.5804962", "0.57712114", "0.5763966", "0.57462686", "0.5740011", "0.57107234", "0.5698935", "0.569692", "0.56900036", "0.56887...
0.57596433
14
store a dream into the db. A dream has user_id(FK), user_name, content, rank(likes), privacy(boolean)
def create @user = User.find_by_id(session[:remember_token]) @p = params[:dream][:privacy] if @p == 'false' @privacy = false else @privacy = true #private, dream not visible to others end @dream = Dream.new(:name => @user.name, :user_id => @user.id, :content => params[:dre...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def like\n @dream = Dream.find(params[:id])\n @user = User.find_by_id(session[:remember_token]) \n @likee = @dream.user_id\n @dream.rank +=1\n @like = Like.new(:user_id=>@user.id, :likee_id=>@likee, :dream_id=>params[:id])\n @like.save\n if(@dream.save! && @like.save)\n redirect_to :contr...
[ "0.66675854", "0.6517227", "0.6184037", "0.6102725", "0.58795327", "0.5801931", "0.57680744", "0.56688285", "0.5659117", "0.562001", "0.56094956", "0.5596992", "0.55906606", "0.5579211", "0.557797", "0.55489135", "0.5513774", "0.5495211", "0.5493944", "0.54885894", "0.5482005...
0.67639095
0
method for the view that shows dreams from all users
def dreamList @user = User.find_by_id(session[:remember_token]) @dreamlist = Dream.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dreamList\n @user = User.find_by_id(session[:remember_token]) \n @dreamlist = Dream.all\n @likeList = Like.all\n end", "def show\n @user = current_user\n @user_sweets = @user.sweets\n end", "def index\n\t\t@dreams = Dream.all\n\tend", "def index\n @user_foods = UserFood.all\n end", ...
[ "0.7367169", "0.7090417", "0.7088444", "0.6994299", "0.6911653", "0.6886348", "0.68574387", "0.68274546", "0.6813685", "0.68130445", "0.6805955", "0.6796692", "0.6794152", "0.6783545", "0.6775793", "0.6764854", "0.6759439", "0.6725563", "0.67197764", "0.66994226", "0.66888666...
0.7432237
0
handles the logic when a user clicks on the like button.
def like @dream = Dream.find(params[:id]) @user = User.find_by_id(session[:remember_token]) @likee = @dream.user_id @dream.rank +=1 #record the like to 1. update the like btn to unlike btn, & 2. prevent repeated votes @like = Like.new(:user_id=>@user.id, :likee_id=>@likee, :dream_id=>params[:id]...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def like\n @eventpostcomment.liked_by current_user\n redirect_to @urltoredirect\n end", "def change_like\n user = User.find(params[:id])\n if current_user.likes?(user)\n msg = \"I <span>like</span> this profile\"\n Like.delay.delete_all([\"user_id = ? and likeable_id = ? and likeable...
[ "0.688443", "0.67873234", "0.67705756", "0.67086023", "0.6664721", "0.6644761", "0.6596455", "0.658502", "0.6576464", "0.6541169", "0.65313756", "0.64923763", "0.6484976", "0.6443325", "0.64036065", "0.63999355", "0.63405013", "0.62890273", "0.6239763", "0.6210029", "0.620943...
0.6428878
14
handles unliking a dream by the user
def unlike @dream = Dream.find(params[:id]) @user = User.find_by_id(session[:remember_token]) @dream.rank -=1 if(@dream.save!) @like = @user.likes.find_by_dream_id(params[:id]) @like.destroy redirect_to :action=>'show' else flash.now[:error] = "illegal input!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verb\n \"unlike\"\n end", "def dislike\n @book.disliked_by current_user\n redirect_to :back\n end", "def unliked_by(user)\n self.send(self.class.like_label.tableize.to_sym).find_by_user_id(user.id).destroy rescue false\n end", "def dislike\n @comic.disliked_by curren...
[ "0.7176833", "0.66845113", "0.66605073", "0.6459938", "0.63674563", "0.635022", "0.63315845", "0.6304691", "0.6261009", "0.61732763", "0.6124151", "0.6092185", "0.5981639", "0.597365", "0.59427786", "0.5929887", "0.5875482", "0.58509034", "0.5825461", "0.5785947", "0.5780067"...
0.6493827
3
updates the dream based on user input
def update @dream = Dream.find(params[:id]) respond_to do |format| if @dream.update_attributes(params[:dream]) format.html { redirect_to @dream, :notice => 'Dream was successfully updated.' } format.json { head :ok } else format.html { render :action => "edit" } form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(input)\n # checks whether updating game or player\n # if game, passes into status.update\n # (drop the first element (which will be the word game) so we are left with just the update (type, value) ,\n # field_width is the amount of columns)\n input[0] == 'game' ? @status.update(input....
[ "0.6164115", "0.5997674", "0.5939344", "0.5913492", "0.58313066", "0.5797451", "0.57605785", "0.57307005", "0.57307005", "0.5707091", "0.5687008", "0.56801546", "0.56255025", "0.55913717", "0.557738", "0.5575615", "0.55661404", "0.5560442", "0.5547146", "0.5537267", "0.553660...
0.60352975
1
deletes a dream (recursively deletes its likes and comments first)
def destroy @dream = Dream.find(params[:id]) likes = @dream.likes.all likes.each do |l| l.destroy end comments = @dream.comments.all comments.each do |c| c.destroy end @dream.destroy redirect_to(:back) #redirects to the previous page end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @like = Like.find(params[:id]) \n @dog = Dog.find(@like.dog_id)\n @like.destroy\n\n respond_to do |format|\n format.html { redirect_to @dog } \n end\n end", "def destroy\n id = @comment.micropost_id\n likes = Like.find_by_sql(['SELECT \"likes\".* FROM \"likes\" WHERE \"l...
[ "0.63838905", "0.6362137", "0.62332046", "0.6176677", "0.5994448", "0.5988986", "0.5934253", "0.5898033", "0.58823925", "0.5820309", "0.5817117", "0.58033127", "0.5772802", "0.57652724", "0.57433206", "0.57387257", "0.5737401", "0.5737286", "0.5735158", "0.5735158", "0.573515...
0.74287003
0
Return a usable object from an AXAPI pointer Given an arbitrary return value from an AXAPI function this method is called to delegate the work of actually wrapping the returned value in the correct way.
def to_ruby self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ptr(x)\r\n ret = Ragweed::Ptr.new(x)\r\n ret.p = self\r\n return ret\r\n end", "def proxy(return_type); end", "def to_axvalue\n klass = self.class\n ptr = Pointer.new klass.type\n ptr.assign self\n AXValueCreate(klass.ax_value, ptr)\n end", "def wrap(object); end", "def process_b...
[ "0.52443445", "0.5232881", "0.5226373", "0.5155934", "0.51266617", "0.5119139", "0.50720215", "0.50268346", "0.49890786", "0.4952949", "0.49090138", "0.48821074", "0.48472267", "0.4832366", "0.47658145", "0.47439846", "0.47132927", "0.4696445", "0.46824002", "0.46614152", "0....
0.0
-1
Create an `AXValueRef` from the `Boxed` instance. This will only work if for the most common boxed types, you will need to check the AXAPI documentation for an up to date list.
def to_ax klass = self.class ptr = Pointer.new klass.type ptr.assign self AXValueCreate(klass.ax_value, ptr) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ruby\n type = AXValueGetType(self)\n return self if type.zero?\n\n ptr = Pointer.new BOX_TYPES[type]\n AXValueGetValue(self, type, ptr)\n ptr.value.to_ruby\n end", "def to_axvalue\n klass = self.class\n ptr = Pointer.new klass.type\n ptr.assign self\n AXValueCreate(klass.ax_val...
[ "0.607163", "0.576539", "0.5735615", "0.5040852", "0.50407857", "0.48711273", "0.4866127", "0.48351017", "0.4785168", "0.4785168", "0.47479725", "0.46733934", "0.4515181", "0.4386385", "0.4386385", "0.43635827", "0.43456766", "0.43424025", "0.43175846", "0.42957172", "0.42932...
0.49619865
5
Unwrap an `AXValueRef` into the `Boxed` instance that it is supposed to be. This will only work for the most common boxed types, you will need to check the AXAPI documentation for an up to date list.
def to_ruby type = AXValueGetType(self) return self if type.zero? ptr = Pointer.new BOX_TYPES[type] AXValueGetValue(self, type, ptr) ptr.value.to_ruby end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_box value\n box_type = AXValueGetType(value)\n ptr = Pointer.new BOX_TYPES[box_type]\n AXValueGetValue(value, box_type, ptr)\n ptr[0]\n end", "def unwrap(value)\n if value.instance_of?(Array) && !value.instance_of?(Hash)\n value.first\n else\n value...
[ "0.61210316", "0.5279863", "0.5222793", "0.49386892", "0.49174997", "0.48736262", "0.4843569", "0.4843569", "0.4690674", "0.46143794", "0.46053454", "0.45905563", "0.45434204", "0.45333445", "0.45297617", "0.45046583", "0.44925994", "0.44580293", "0.44492263", "0.44446367", "...
0.55481136
1
Explanation You will be building a calculator. A calculator can perform multiple arithmetic operations. Your function should allow the user to choose which operation is expected, enter in the values to perform the operation on, and ultimately view the result. Specification: A user should be given a menu of operations A...
def prompt(message) print message gets.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n unt...
[ "0.8161232", "0.77470136", "0.7687745", "0.7648548", "0.7638239", "0.7630298", "0.76165986", "0.751362", "0.75132", "0.74790823", "0.74285716", "0.74274886", "0.74120414", "0.74100155", "0.74088466", "0.7402888", "0.73926157", "0.73907876", "0.73587877", "0.7315292", "0.73121...
0.0
-1
validates :title, presence: true validates :start_date, presence: true validate :end_date_after_start_date
def end_date_after_start_date if end_date < start_date errors.add :end_date, "Must be after Start Date" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end", "def validate_start_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{start} after #{last}\"\n errors.add(:star...
[ "0.80709106", "0.80186266", "0.79241586", "0.7901448", "0.78693247", "0.78693247", "0.7842199", "0.7832533", "0.783174", "0.7751625", "0.7750143", "0.7738352", "0.767574", "0.7636965", "0.7619172", "0.7619172", "0.7592841", "0.7591228", "0.7564399", "0.7498171", "0.747849", ...
0.7509444
19
GET /facts or /facts.json
def index @facts = Fact.all.order(updated_at: :desc) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def get_facts(name, environment:)\n headers = add_puppet_headers('Accept' => get_mime_types(Puppet::Node::Facts).join(', '))\n\n response = @cl...
[ "0.679851", "0.67612815", "0.67307", "0.62688816", "0.62688816", "0.6129958", "0.6036055", "0.5911314", "0.5878131", "0.58773047", "0.586547", "0.584659", "0.5845003", "0.58362794", "0.58351076", "0.5823621", "0.58193284", "0.5802124", "0.5776807", "0.5774843", "0.57592005", ...
0.0
-1
GET /facts/1 or /facts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_request\n url = URI.parse(\"https://catfact.ninja/fact\")\n response = Net::HTTP.get_response(url)\n JSON.parse(response.body)[\"fact\"]\n end", "def index\n @facts = fact_type.all\n @title = fact_type\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { ...
[ "0.6754895", "0.6652065", "0.6633976", "0.61937636", "0.6077631", "0.59509254", "0.59509254", "0.5887089", "0.58541596", "0.5796358", "0.5776042", "0.5770813", "0.57673764", "0.5753223", "0.5749365", "0.573926", "0.5681505", "0.5667203", "0.5654646", "0.565189", "0.56388295",...
0.0
-1
POST /facts or /facts.json
def create results = fact_params.to_h results["tags"] = Tag.where(id: [results["tags"].split(",")]) @fact = Fact.new(results) respond_to do |format| if @fact.save format.html { redirect_to [:admin, :facts], notice: "Fact was successfully created." } format.json { render :show, st...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @fact = @cat.facts.create!({ fact: api_request })\n if @fact.save\n render json: @fact\n else\n render error: { message: \"Não foi possível criar esse fato para este gatinho! :(\" }, status: 400\n end\n end", "def put_facts(name, environment:, facts:)\n formatter = Puppet::...
[ "0.7091522", "0.6512569", "0.65123093", "0.6400304", "0.6400304", "0.637808", "0.624616", "0.6187805", "0.6111011", "0.5941708", "0.58735484", "0.5834305", "0.5762044", "0.5755849", "0.5701679", "0.56229085", "0.5587443", "0.5539566", "0.5529862", "0.5506642", "0.549307", "...
0.64858
3
PATCH/PUT /facts/1 or /facts/1.json
def update results = fact_params.to_h results["tags"] = Tag.where(id: [results["tags"].split(",")]) respond_to do |format| if @fact.update(results) format.html { redirect_to [:admin, :facts], notice: "Fact was successfully updated." } format.json { render :show, status: :ok, location:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @fact.update(fact_params)\n format.html { redirect_to @fact, notice: 'Fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fact.errors, stat...
[ "0.6939784", "0.6854679", "0.6825015", "0.6784763", "0.66241336", "0.6605713", "0.6451208", "0.6252654", "0.62524694", "0.61575246", "0.6118653", "0.6074953", "0.60113573", "0.6004684", "0.60038334", "0.59518045", "0.5941959", "0.5913331", "0.58921665", "0.58849573", "0.58822...
0.63157535
7
DELETE /facts/1 or /facts/1.json
def destroy @fact.destroy respond_to do |format| format.html { redirect_to admin_facts_url, notice: "Fact was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @fact.destroy\n respond_to do |format|\n format.html { redirect_to facts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fact = Fact.find(fact_params)\n @fact.destroy\n\n respond_to do |format|\n format.html { redirect_to facts_url }\n f...
[ "0.71176517", "0.7072482", "0.6839519", "0.6830639", "0.6830639", "0.6731041", "0.6691228", "0.66530305", "0.65762866", "0.65670043", "0.65478706", "0.6545879", "0.6463825", "0.6463825", "0.6461998", "0.6451262", "0.6432478", "0.63383", "0.63377655", "0.630666", "0.6293596", ...
0.68169004
5
Use callbacks to share common setup or constraints between actions.
def set_fact @fact = Fact.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Only allow a list of trusted parameters through.
def fact_params params.require(:fact).permit(:published, :links, :headline, :summary, :tags) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6949874", "0.68134874", "0.6803973", "0.6796339", "0.6746466", "0.67413056", "0.6527813", "0.6520603", "0.64913523", "0.64299726", "0.64299726", "0.64299726", "0.6399997", "0.63564914", "0.63551056", "0.6347068", "0.6344981", "0.63384986", "0.6325687", "0.6325687", "0.6325...
0.0
-1
Definir nome da Classe
def class_name return Scan_Enemy_Class[@enemy_id] if Scan_Enemy_Class.include?(@enemy_id) return '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @class_name\n end", "def class_name\n Heroics.camel_case(name)\n end", "def full_name\n klass.name\n end", "def name\n raise \"No name defined for #{self.class}\"\n end", "def name\n self.class.simple_name\n end", "def display_name\n class_nam...
[ "0.74648005", "0.72606045", "0.72437596", "0.7241709", "0.7192157", "0.7105655", "0.70554256", "0.7043647", "0.7023409", "0.69901186", "0.69549453", "0.6951007", "0.69493467", "0.69469064", "0.69469064", "0.6929749", "0.6894253", "0.6873501", "0.6873501", "0.6864182", "0.6843...
0.0
-1
Object Initialization battler : battler
def initialize(battler) x,y = Scan_Window_Settings[0], Scan_Window_Settings[1] w,h = Scan_Window_Settings[2], Scan_Window_Settings[3] super(x,y,w,h) self.contents = Bitmap.new(width - 32, height - 32) self.z = 4950 if Scan_Window_Bg != nil @background_image = Sprite.new @background_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(battler)\n @battler = battler\n clear\n end", "def battler=(val)\n @battler = val\n @pokemon = @battler.displayPokemon\n @trainer = @battle.opponent ? @battle.opponent[0] : nil\n self.refresh\n end", "def initialize\n @name_boy = default_male_name\n @name_girl = def...
[ "0.7640369", "0.6983076", "0.68978244", "0.6839295", "0.6758222", "0.6748075", "0.665151", "0.66157436", "0.6594717", "0.6578842", "0.6538523", "0.65255165", "0.64952666", "0.64849764", "0.6475319", "0.647503", "0.6419752", "0.64188224", "0.6416907", "0.6405758", "0.6388218",...
0.6447239
16
Window visibility n : opacity
def visible=(n) super @background_image.visible = n if @background_image != nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_fadeIn_Opacity\n w = Window_Base.new(400, 50, 100, 50)\n @windows.push(w)\n w.opacity = 128\n w.visible = false\n w.fadeIn()\n return true\n end", "def appear\n refresh\n self.visible = true\n self.opacity = 255\n end", "def test_fadeInOut_Opacity\n @w_fadeToggleOpacity...
[ "0.713439", "0.712964", "0.6871721", "0.6814074", "0.6421011", "0.6392767", "0.63164353", "0.63164353", "0.6316198", "0.6220904", "0.6216432", "0.6181008", "0.6149604", "0.61453176", "0.6101792", "0.60815525", "0.6081167", "0.600948", "0.59995735", "0.59443235", "0.59300435",...
0.60842323
15
Draw Name actor : actor x : draw spot xcoordinate y : draw spot ycoordinate
def draw_actor_name(actor, x, y) self.contents.font.size = Scan_Window_Font_Size self.contents.font.color = normal_color self.contents.draw_text(x, y, 120, 32, actor.name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_basic_info(actor, x, y, width)\n draw_actor_name(actor, x, y, width)\n draw_actor_class(actor, x, y + line_height, width)\n draw_actor_level(actor, x, y + line_height * 2)\n draw_actor_state(actor, x, y + line_height * 3)\n end", "def draw_actor_simple_status(actor, x, y)\n draw_actor_hp...
[ "0.7051371", "0.67047364", "0.6673306", "0.66675705", "0.6606256", "0.6575821", "0.6522004", "0.64477557", "0.64418256", "0.6382694", "0.6372685", "0.63369197", "0.6323769", "0.6258517", "0.62566245", "0.6217715", "0.6202461", "0.62001973", "0.61621416", "0.6144138", "0.61418...
0.67678833
1
Draw Class actor : actor x : draw spot xcoordinate y : draw spot ycoordinate
def draw_actor_class(actor, x, y) self.contents.font.size = Scan_Window_Font_Size self.contents.font.color = normal_color self.contents.draw_text(x, y, 236, 32, actor.class_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(x_position, y_position)\n $app.fill(rgb(255,255,255))\n\t$app.title(@number)\n #$app.oval(x_position * Game::PIECE_SIZE + Game::PIECE_SIZE, y_position * Game::PIECE_SIZE + Game::PIECE_SIZE, \n # Game::PIECE_SIZE * Game::PIECE_SCALE_FACTOR)\n #update the coordinates of the piece\n @x = x_po...
[ "0.6715654", "0.66295266", "0.6571277", "0.6463376", "0.64124465", "0.63714314", "0.6350992", "0.63506204", "0.6348869", "0.6345568", "0.6311166", "0.63034713", "0.6270263", "0.6264086", "0.6248851", "0.6244953", "0.62397563", "0.6238513", "0.6230217", "0.6217911", "0.6212056...
0.5939505
79
Draw Level actor : actor x : draw spot xcoordinate y : draw spot ycoordinate
def draw_actor_level(actor, x, y, fake = false) self.contents.font.size = Scan_Window_Font_Size self.contents.font.color = system_color name = 'Nv' size = contents.text_size(name).width self.contents.draw_text(x, y, size + 4, 32, name) self.contents.font.color = normal_color level = fake ? '...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_enemy_position(x, y)\n map = Cache.picture(BestiaryConfig::MAPNAME)\n contents.blt(x, y, map, map.rect)\n if enemy.map_position.size == 0 && get_area_array.size == 0\n change_color(power_down_color)\n draw_text(x, y, map.rect.width, map.rect.height, BestiaryConfig::NOPOSITION, 1)\n ...
[ "0.6839444", "0.65661305", "0.6447499", "0.64200306", "0.64157015", "0.6394162", "0.6340495", "0.6339089", "0.6322919", "0.62393385", "0.61929494", "0.6185287", "0.61763334", "0.6176023", "0.61677176", "0.613459", "0.6119174", "0.6112187", "0.60426384", "0.60389423", "0.60389...
0.6759919
1
Draw Parameter actor : actor x : draw spot xcoordinate y : draw spot ycoordinate type : parameter type w : width fake : hide parameter
def draw_actor_parameter(actor, x, y, type, w = 132, fake = false) case type when 'atk' parameter_name = $data_system.words.atk parameter_value = actor.atk when 'pdef' parameter_name = $data_system.words.pdef parameter_value = actor.pdef when 'mdef' parameter_name = $data_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_actor_parameter(actor, x, y, width)\n w = width / 2\n 6.times do |i|\n draw_actor_param(actor, i % 2 * w + x, i % 2 + y, i)\n end\n end", "def draw_actor_parameter(actor, x, y, type)\n case type\n when 0\n parameter_name = $data_system.words.atk\n parameter_value = actor.a...
[ "0.7488451", "0.71650034", "0.71586066", "0.6790228", "0.65900266", "0.6555707", "0.63952786", "0.6290311", "0.62901825", "0.6259087", "0.61950827", "0.61666536", "0.61644137", "0.6126864", "0.6126864", "0.611894", "0.611894", "0.611894", "0.611894", "0.6105537", "0.60874486"...
0.74210596
1
Draw HP actor : actor x : draw spot xcoordinate y : draw spot ycoordinate width : draw spot width fake : hide parameter
def draw_actor_hp(actor, x, y, width = 144, fake = false) self.contents.font.size = Scan_Window_Font_Size self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.hp) self.contents.font.color = actor.hp == 0 ? knockout_color : actor.hp <= actor.maxhp / 4 ? c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_actor_hp(actor, x, y, width = 120)\n if actor.hide_info?\n draw_actor_hp_gauge(actor, x, y, width)\n self.contents.font.color = system_color\n self.contents.draw_text(x, y, 30, WLH, Vocab::hp_a)\n self.contents.font.color = hp_color(actor)\n last_font_size = self.contents.font....
[ "0.75088686", "0.7361486", "0.7224229", "0.70255923", "0.6972868", "0.69317305", "0.687598", "0.6737892", "0.673045", "0.6551296", "0.6505852", "0.6459839", "0.6442729", "0.63994384", "0.6396263", "0.6315688", "0.6306327", "0.6305476", "0.6280544", "0.62629575", "0.6242281", ...
0.7461187
1
Draw SP actor : actor x : draw spot xcoordinate y : draw spot ycoordinate width : draw spot width fake : hide parameter
def draw_actor_sp(actor, x, y, width = 144, fake = false) self.contents.font.size = Scan_Window_Font_Size self.contents.font.color = system_color self.contents.draw_text(x, y, 32, 32, $data_system.words.sp) self.contents.font.color = actor.sp == 0 ? knockout_color : actor.sp <= actor.maxsp / 4 ? c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_actor_sp_hud(actor, x, y, w = 148)\n # calculate fill rate\n rate = (actor.maxsp > 0 ? actor.sp.to_f / actor.maxsp : 0)\n # create color depending on fill rate\n if rate > 0.4\n color1 = Color.new(180 - 200 * (rate-0.4), 60, 240, 192) \n elsif rate <= 0.4\n color1 = Color.new(60 +...
[ "0.7156839", "0.6767245", "0.64736557", "0.6446914", "0.6398819", "0.63470846", "0.6342768", "0.63146096", "0.6264853", "0.6246918", "0.6236491", "0.6229712", "0.6219276", "0.6175208", "0.61715525", "0.61544824", "0.6129973", "0.6111919", "0.6109072", "0.60589415", "0.6058941...
0.75579953
0
Draw elemental resistance battler : actor x : draw spot xcoordinate y : draw spot ycoordinate
def draw_element_resist(battler, x, y) self.contents.font.size = Scan_Window_Font_Size max_elment = [Scan_Max_Elements_Shown, 8].min y = y + (200 - (max_elment * 25)) / 2 if battler.actor? and not $atoa_script['Atoa New Resistances'] elements = $data_classes[battler.class_id].element_ranks els...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw(x_position, y_position)\n $app.fill(rgb(255,255,255))\n\t$app.title(@number)\n #$app.oval(x_position * Game::PIECE_SIZE + Game::PIECE_SIZE, y_position * Game::PIECE_SIZE + Game::PIECE_SIZE, \n # Game::PIECE_SIZE * Game::PIECE_SCALE_FACTOR)\n #update the coordinates of the piece\n @x = x_po...
[ "0.6599446", "0.6588064", "0.65605587", "0.65296805", "0.6472033", "0.64598364", "0.6443686", "0.64205235", "0.63706154", "0.6368621", "0.63533545", "0.635249", "0.632585", "0.6321237", "0.6297464", "0.62633795", "0.6245041", "0.623266", "0.6200748", "0.6197005", "0.6188633",...
0.6980771
0
Turn a version string like "1.2.34" into an array of integers [1,2,3,4]
def to_array(version) version.split(/[.-]/).map do |x| if x =~ /\A.*([0-9]+).*\Z/ $1.to_i else 0 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /^\\d+$/) ? n.to_i : n }\n if array.last =~ /(\\d+)([\\-\\+])/\n array[array.length-1] = $1.to_i\n array << $2\n end\n array\n end", "def to_array(version)\n array = version.split(\".\").map {|n| (n =~ /...
[ "0.80867887", "0.80867887", "0.77319515", "0.75893396", "0.7381602", "0.73090535", "0.6769929", "0.67642313", "0.6609258", "0.65874344", "0.651525", "0.62992543", "0.62126815", "0.62117547", "0.619159", "0.6145931", "0.6125489", "0.6024002", "0.5913502", "0.59089375", "0.5879...
0.8405854
0
Time complexity: O(n) where n is the number of base10 place values Space complexity: O(1)
def is_palindrome(number) return false if !number || number < 0 length = 1 until number / (10 ** length) == 0 length += 1 end (length / 2).times do |i| return false if (number / (10 ** (length - i - 1))) % 10 != (number % (10 ** (i + 1))) / (10 ** i) end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radix_sort(array, base = 10)\n # passes count equals to the number of digits in the longest number\n passes = (Math.log(array.minmax.map(&:abs).max) / Math.log(base)).floor + 1\n passes.times do |i|\n buckets = Array.new(2 * base) { [] }\n base_i = base**i\n\n # elements are added to buckets\n #...
[ "0.68587744", "0.67359746", "0.66654277", "0.6610082", "0.65680027", "0.6528765", "0.6478669", "0.6379814", "0.62526965", "0.61628085", "0.6142431", "0.61357445", "0.6133826", "0.6120942", "0.6103994", "0.609062", "0.6086287", "0.6076269", "0.6072636", "0.60666907", "0.606255...
0.0
-1
Returns users and their attributes Optional: filter, fields
def index users = get_collection(User) || return respond_to do |format| format.xml { render xml: users.to_xml(only: DEFAULT_FIELDS, root: 'users', skip_types: 'true') } format.json { render json: users.to_json(only: DEFAULT_FIELDS) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fields\n Iterable.request(conf, '/users/getFields').get\n end", "def get_users(filter: {}, includes: nil, limit: nil, sort: nil)\n params = users_request_client.build_params(filter: filter, includes: includes, limit: limit, sort: sort)\n users_request_client.get(\"users\", params)\n...
[ "0.7016345", "0.68872595", "0.68271273", "0.6814705", "0.67519397", "0.6750368", "0.6740111", "0.67067736", "0.67007023", "0.6672344", "0.6665858", "0.66351116", "0.65872335", "0.65813106", "0.6567486", "0.6565599", "0.65570134", "0.64925903", "0.64878386", "0.64814043", "0.6...
0.0
-1
Creates a new user Requires: user_name, type, first_name, last_name Optional: section_name, grace_credits
def create if has_missing_params?([:user_name, :type, :first_name, :last_name]) # incomplete/invalid HTTP params render 'shared/http_status', locals: {code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422 return end # Check if that user_n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if has_missing_params?([:user_name, :type, :first_name, :last_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: { code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422'] }, status: :unprocessable_entity\n return\n en...
[ "0.7364896", "0.73646307", "0.7356952", "0.7337711", "0.732711", "0.72800964", "0.72784", "0.72719026", "0.7242799", "0.7240022", "0.72279036", "0.72242874", "0.72053754", "0.72013795", "0.7194197", "0.7186285", "0.7178811", "0.71787244", "0.7175508", "0.71746147", "0.7172846...
0.74289304
0
Returns a user and its attributes Requires: id Optional: filter, fields
def show user = User.find_by_id(params[:id]) if user.nil? # No user with that id render 'shared/http_status', locals: {code: '404', message: 'No user exists with that id'}, status: 404 else respond_to do |format| format.xml { render xml: user.to_xml(only: DE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:get, \"users/#{id}\", params)\n end", "def get_user_by_id(id)\n $r.hgetall(\"user:#{id}\")\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end",...
[ "0.6934199", "0.6893967", "0.67755085", "0.6760595", "0.67520607", "0.6653321", "0.6637692", "0.653343", "0.6522028", "0.649891", "0.6420168", "0.6408182", "0.6401911", "0.63927436", "0.6348264", "0.6343302", "0.6324224", "0.631312", "0.6297026", "0.62787265", "0.6271104", ...
0.0
-1
Requires nothing, does nothing
def destroy # Admins should not be deleting users, so pretend this URL doesn't exist render 'shared/http_status', locals: {code: '404', message: HttpStatusHelper::ERROR_CODE['message']['404'] }, status: 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nothing; end", "def missing; end", "def nothing\nend", "def nothing(_)\n end", "def do_nothing\nend", "def do_nothing\nend", "def required; end", "def required; end", "def required; end", "def missing?; end", "def ignores; end", "def test_nothing; end", "def awaken!\n\t\traise 'Not imp...
[ "0.7337037", "0.6983716", "0.6803599", "0.67810416", "0.6765609", "0.6765609", "0.67379093", "0.67379093", "0.67379093", "0.67344683", "0.66984254", "0.66144973", "0.65867126", "0.65394247", "0.6517747", "0.64611334", "0.64611334", "0.64611334", "0.6447887", "0.64466375", "0....
0.0
-1
Requires: id Optional: first_name, last_name, user_name, section_name, grace_credits
def update # If no user is found, render an error. user = User.find_by_id(params[:id]) if user.nil? render 'shared/http_status', locals: {code: '404', message: 'User was not found'}, status: 404 return end # Create a hash to hold fields/values to be updated for t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name_with_id\n id.to_s + \": \" + first_name + \" \" + last_name\n end", "def full_name_with_id\n id.to_s + \": \" + user.first_name + \" \" + user.last_name\n end", "def initialize(id, first_name, last_name, options = {})\n @id = id\n @first_name = first_name\n @last_name = las...
[ "0.5909455", "0.5904062", "0.5692235", "0.55020034", "0.54865533", "0.54809207", "0.5477029", "0.54685724", "0.5459578", "0.5454556", "0.5423992", "0.5421671", "0.5421671", "0.5413896", "0.5413289", "0.540779", "0.54051816", "0.54051816", "0.54051816", "0.5405035", "0.5363833...
0.0
-1
Update a user's attributes based on their user_name as opposed to their id (use the regular update method instead) Requires: user_name
def update_by_username if has_missing_params?([:user_name]) # incomplete/invalid HTTP params render 'shared/http_status', locals: { code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422'] }, status: 422 return end # Check if that user_name is taken ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n user = User.find(params[:id])\n\n user.attributes = {\n name: params[:name]\n }\n\n user_save user\n end", "def update\n # If no user is found, render an error.\n user = User.find_by_id(params[:id])\n if user.nil?\n render 'shared/http_status', locals: {code: ...
[ "0.8482398", "0.8065436", "0.77993184", "0.77993184", "0.7793642", "0.77580297", "0.7601391", "0.7552527", "0.7428284", "0.73598725", "0.73428047", "0.73378545", "0.7331101", "0.73281014", "0.73237526", "0.7321439", "0.7313518", "0.7280962", "0.7245516", "0.72274524", "0.7206...
0.77839136
5
Creates a new user or unhides a user if they already exist Requires: user_name, type, first_name, last_name Optional: section_name, grace_credits
def create_or_unhide if has_missing_params?([:user_name]) # incomplete/invalid HTTP params render 'shared/http_status', locals: { code: '422', message: HttpStatusHelper::ERROR_CODE['message']['422'] }, status: 422 return end # Check if that user_name is taken u...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if has_missing_params?([:user_name, :type, :first_name, :last_name])\n # incomplete/invalid HTTP params\n render 'shared/http_status', locals: {code: '422', message:\n HttpStatusHelper::ERROR_CODE['message']['422']}, status: 422\n return\n end\n\n # Check i...
[ "0.69734097", "0.6823994", "0.6759615", "0.6717155", "0.6702808", "0.6686463", "0.66666216", "0.6605979", "0.65856165", "0.65732163", "0.65654105", "0.6556596", "0.6548567", "0.6544435", "0.65435123", "0.65365416", "0.65325886", "0.65294605", "0.65274477", "0.6524081", "0.652...
0.6747998
3
Process the parameters passed for user creation and update
def process_attributes(params, attributes) # Get the id of the section corresponding to :section_name unless params[:section_name].blank? section = Section.find_by_name(params[:section_name]) unless section.blank? attributes[:section_id] = section.id end end pa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_create_user_fields\n user_id = AuditModule.get_current_user.uid\n self.created_by = user_id\n self.updated_by = user_id\n end", "def creator_info\n redirect_to root_path and return if @user != current_user\n if request.put?\n @user.update_attributes(params[:user])\n @use...
[ "0.64754933", "0.64257306", "0.6392138", "0.6388536", "0.6373205", "0.6343762", "0.6300742", "0.6232679", "0.6228621", "0.61963964", "0.6195669", "0.61906", "0.6176431", "0.61737", "0.6161147", "0.6142518", "0.6125216", "0.6111", "0.61076725", "0.60868573", "0.6079074", "0....
0.0
-1
configure how to compute class names for events.
def compute_event_class_name(event) # User::EventStore => User::CreatedEvent self.class.name.gsub(/::EventStore/, "::#{event.to_s.camelize}Event") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_name(event)\n \"#{self.class.name.underscore}_#{event}\"\n end", "def set_resource_class_name\n @resource_class_name = 'Event'\n end", "def identifiers_for_klass(event_klass, _event = nil)\n lookup_klass_to_identifier_mapping(event_klass) ||\n (create_mapping_f...
[ "0.6488249", "0.61467", "0.608222", "0.59494543", "0.5801602", "0.57367975", "0.5707541", "0.5657215", "0.5629178", "0.5607625", "0.5603688", "0.5504485", "0.54647404", "0.54484916", "0.54061276", "0.5399958", "0.5399958", "0.53944016", "0.53936756", "0.53852373", "0.53852373...
0.715607
0
Aooly the event to the aggregate and save!
def apply_event_and_save aggregate.lock! if aggregate.persisted? # Apply! event = event_class.new(aggregate, data) event.apply # record the metadata if event.respond_to?(:metadata) self.metadata.merge!(event.metadata || {}) end # Set created_at self.creat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n MoxiworksPlatform::Event.update(self.to_hash)\n end", "def record!\n find_or_build_event_group\n update_event_group_attributes\n send_notifications_for_event_group\n \n @event_group.archived = false\n @event_group.save\n @event_group.events.create(event_params)\n @event...
[ "0.71106803", "0.6942862", "0.6925195", "0.68519795", "0.6516015", "0.63996834", "0.63437", "0.6343361", "0.6267847", "0.62521535", "0.62290573", "0.62278306", "0.6203283", "0.61452454", "0.6056104", "0.6055276", "0.6048937", "0.6013767", "0.6013508", "0.5994938", "0.5993129"...
0.7079673
1
Link to kata: Description: Oh no! Santa's little elves are sick this year. He has to distribute the presents on his own. But he has only 24 hours left. Can he do it? Your job is to determine if Santa can distribute all the presents in 24 hours. Your Task: You will get an array as input with time durations as string in ...
def determineTime(durations) h = [] m = [] s = [] if durations.empty? return true else durations.each do |time| split_time = time.split(":").map(&:to_i) h << split_time[0] m << split_time[1] s << split_time[2] end hours_seconds = h.inject(:+) * 3600 minutes_seconds ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_in_time_range?(string,array,filename)\n\t \n\tend_of_file=string.sub(/\\s/,\".\").split(\".\")\n\tend_of_file_time=Time.mktime(end_of_file[2],end_of_file[1],end_of_file[0],end_of_file[3],end_of_file[4],end_of_file[5])\n\tnumber_of_seconds=get_video_duration(filename)\n\tarray_start_time_s=array[0].sub(...
[ "0.6162536", "0.61328053", "0.61128616", "0.6040653", "0.60277003", "0.60103387", "0.5968262", "0.58680457", "0.58246183", "0.58106136", "0.57717323", "0.57288533", "0.5689032", "0.5668561", "0.5657348", "0.56562954", "0.56247514", "0.55948263", "0.5581668", "0.5572999", "0.5...
0.77391064
0
NOTE: If you delete user from Firebase DB manually, and if user signup again later (create new user in FB DB) his UID will change (obviously). This exotic situation may be handled, but will require additional mess with payload['firebase'] and DB record's meta analysis if you want new FB user bind to existing in DB.
def find_user(firebase_user_uid) logger.info("Looking for User by firebase_user_uid", firebase_user_uid: firebase_user_uid) logger.debug("Firebase payload: #{jwt_payload}") User.find_by(firebase_user_uid: firebase_user_uid) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_firebase\n @user_firebase = UserFirebase.find(params[:id])\n end", "def delete_user(uid)\n @client.post(with_path(\"accounts:delete\"), {localId: validate_uid(uid, required: true)})\n end", "def delete_old_user(user_id = nil)\n unless user_id.nil?\n ...
[ "0.6342637", "0.6198282", "0.602278", "0.60210776", "0.5830334", "0.5805406", "0.57524186", "0.5695694", "0.56621987", "0.56498265", "0.56498265", "0.56301284", "0.56206036", "0.5562316", "0.5562316", "0.5562316", "0.5562316", "0.5562278", "0.5558095", "0.5556923", "0.5545270...
0.59436214
4
Left side open aisle
def left_open aisle, aislevalue BayHelper.output_aisle += aisle_header aisle, aislevalue BayHelper.output_bay += drive_path BayHelper.output_aisle += aisle_placeholder aislevalue["row"]["L"].to_a.each do |bay,bayvalue| BayHelper.output_bay += (bay_det...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@generic} opens.\"\n end", "def left\n @ole.Left\n end", "def left\n @ole.Left\n end", "def left; end", "def left; end", "def left; end", "def left\n check_placed\n @facing =...
[ "0.68887764", "0.67860043", "0.67860043", "0.6748937", "0.6748937", "0.6748937", "0.66934633", "0.6668133", "0.6586636", "0.6437155", "0.64218074", "0.64218074", "0.6418334", "0.6336168", "0.6200225", "0.61867756", "0.61482394", "0.61413187", "0.6037577", "0.60256946", "0.602...
0.54466957
82
Right side open aisle
def right_open aisle, aislevalue output = '' BayHelper.output_aisle += aisle_divider_placeholder #Aisle Divider BayHelper.output_bay += aisle_divider BayHelper.output_aisle += aisle_placeholder #Aisle details ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def other_side_opened\n room = $manager.find @container\n @open = true\n room.output \"The #{@generic} opens.\"\n end", "def right\n check_placed\n @facing = next_facing(+1)\n end", "def other_side_closed\n room = $manager.find @container\n @open = false\n room.output \"The #{@g...
[ "0.71383643", "0.65427345", "0.6446562", "0.6111041", "0.6111041", "0.61109984", "0.61109984", "0.60771847", "0.6059463", "0.6059463", "0.5992522", "0.59644794", "0.59058756", "0.5868819", "0.5854397", "0.58283097", "0.5776552", "0.5771617", "0.5746506", "0.57451826", "0.5732...
0.5856277
14
This is for convenience in the tests.
def initialize(input_arr=[]) @internal_arr = [] # Pass each element in input_arr to 'add' method (if it isn't empty) input_arr.each { | ele | add(ele) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def self_test; end", "def self_test; end", "def used?; end", "def __dummy_test__\n end", "def setup; end", "def setup; end", "def setup; end", "def setup;...
[ "0.74269015", "0.6684581", "0.6684581", "0.66285247", "0.66285247", "0.66285247", "0.66285247", "0.6297594", "0.6297594", "0.6161903", "0.6098783", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0.60178673", "0...
0.0
-1
gives access to all helpers defined within `application_helper`.
def confirmation_instructions(record, token, opts={}) headers["bcc"] = "hello@girlsguild.com" super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_application_helpers; end", "def all_application_helpers\n all_helpers_from_path(helpers_path)\n end", "def helpers\n ApplicationController.helpers\n end", "def helpers\n ApplicationController.helpers\n end", "def helpers\n ActionController::Base.helpers\n end", "de...
[ "0.8302599", "0.82924795", "0.81080973", "0.81080973", "0.8076153", "0.79235524", "0.7890582", "0.7890582", "0.7883021", "0.78411794", "0.7778073", "0.774671", "0.774671", "0.774671", "0.774671", "0.77255684", "0.7707157", "0.76971024", "0.7608534", "0.75120014", "0.74907887"...
0.0
-1
Since the categories/terms are presented in the same order in the grades CSV as in the original terms CSV, this method can recreate the ids that were assigned in migration 112.
def term_id(category, term, select) s = term_str(category, term, select) i = $terms.index s unless i $terms << s i = $terms.size - 1 end i += 3001 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_ids\n @to_ids ||= [ reference.id ] + to_similarity_ids\n end", "def to_similarity_ids\n @to_similarity_ids ||= similarities.map(&:id)\n end", "def add_data_ids(id_old, id_new)\n return id_old.map{|id| id.sort} if id_new.nil?\n id_old = Hash.new if id_old.nil?\n id_new.each do |k, val|...
[ "0.55385983", "0.5437787", "0.5410609", "0.5391051", "0.5347802", "0.5325226", "0.5265144", "0.525713", "0.5252521", "0.523888", "0.52325", "0.52174747", "0.5198595", "0.51784796", "0.51765805", "0.5154005", "0.51232094", "0.5112184", "0.5112184", "0.5107727", "0.50644594", ...
0.47436202
70
Methods cannot take more than one block Yield can be used multiple times
def print_twice yield yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiple_pass\n puts \"Inside the method\"\n yield\n puts \"Back inside the method\"\n yield\nend", "def method_with_yield_1\n some_code\n yield\n some_code\n end", "def multiple_pass\n puts \"Inside the method\"\n yield if block_given? # Invoke block only it is given \n puts...
[ "0.7397374", "0.73840666", "0.7308652", "0.72407037", "0.71488506", "0.7148328", "0.7112224", "0.70776707", "0.7052871", "0.70143914", "0.700601", "0.6959824", "0.6926629", "0.6902194", "0.6886225", "0.6886225", "0.686959", "0.6868467", "0.6836732", "0.68237865", "0.6822721",...
0.6427213
83
If you try to yield without passing a block, you will get a 'no block given' error. You can avoid this by using the 'block_given?' method.
def burger puts "top bun" yield if block_given? puts "bottom bun" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gimme\n if block_given?\n yield\n else\n puts \"I'm blockless!\"\n end\nend", "def if_block_given\n p \"hoge\"\n yield if block_given?\n p \"end\"\nend", "def try\n if block_given?\n yield\n else\n puts \"no block\"\n end\nend", "def try\n if block_given?\n yield\n else\n put...
[ "0.79307896", "0.7816622", "0.7778659", "0.7775835", "0.7763934", "0.77199227", "0.770299", "0.76645386", "0.76294863", "0.76058483", "0.754827", "0.75358653", "0.75349134", "0.74713165", "0.74645495", "0.7419553", "0.74040216", "0.7394544", "0.73639756", "0.7357458", "0.7326...
0.0
-1
Ensure rdfs label and pref label and the same.
def add_label self.rdfs_label = preflabel if preflabel.present? self.preflabel = rdfs_label if rdfs_label.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_preflabel\n self.preflabel = rdfs_label if rdfs_label.present?\n end", "def add_preflabel\n self.preflabel = rdfs_label\n end", "def add_preflabel\n self.preflabel = rdfs_label\n end", "def label_present?\n preferred_label != rdf_subject.to_s\n end", "def add_lab...
[ "0.6676701", "0.6451825", "0.6451825", "0.64185226", "0.6311049", "0.6224467", "0.6135133", "0.600716", "0.60055083", "0.5880959", "0.5866239", "0.5797254", "0.5728063", "0.5643868", "0.56256664", "0.5558645", "0.5474317", "0.5458055", "0.543362", "0.5418916", "0.5388599", ...
0.69743687
0