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 |
|---|---|---|---|---|---|---|
Concats sequences from the emitter and yields the contained ORFs for every resulting frame (3..1, 1..3 ). Note that for the reverse frame, the resulting sequence is complemented! Translate these sequences in a forward frame only. First :head, then :mid parts get emitted, closed by the :tail part. | def emit_seq
@em.emit_seq do | part, index, tag, seq |
# p [part, seq]
# case part do
# when :head
# when :mid
# when :tail
# end
emit_forward(part, index, tag, seq) { |*x| yield(*x) }
emit_reverse(part, index, tag, seq) { |*x| yield(*x) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mix\n (0..@length-1).to_a.map { |index| mix_frame(index) }\n end",
"def mixblocks2seq!\n # Recurse on the behaviors.\n self.each_behavior { |beh| beh.mixblocs2seq! }\n end",
"def concat other_frames\n raise TypeError unless other_frames.kind_of?(Frames)\n ... | [
"0.55786127",
"0.55237335",
"0.5514554",
"0.5489264",
"0.5185701",
"0.51747787",
"0.5120849",
"0.5050066",
"0.5002008",
"0.49842793",
"0.49427727",
"0.49096182",
"0.48974484",
"0.48387903",
"0.47656763",
"0.47531092",
"0.4722176",
"0.47030795",
"0.46691358",
"0.46670598",
"0.... | 0.6173581 | 0 |
1 2 3 4 4 5 6 5 7 8 9 6 i cannot be less than 0 j cannot be less than 0 el= 1 if i = 0, j=0 , valid diags: [[1,1], [1, 1]] el= 2 if i =0, j= 1, valid diags: [[1, 2], [1, 0]] el = 3 if i=0, j=2, valid diags: [[1,3], [1, 1], [2, 0]] | def diagAve(arr, i, j) # (arr= input, i=0 , j = 0)
nums = [arr[i][j]]
# we iterate through matrix as long as we are inbound
while (i+1 > 0 && j-1 >= 0)
if (i+1 < arr.length && j-1 < arr[0].length)
i+=1
j-=1
nums.push(arr[i][j])
else
break
end
end
length = nums.length
(nums.reduce(:+))/length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sudoku_clauses\n res = []\n\n #ensure each cell contains a digit\n (1..9).each do |i|\n (1..9).each do |j|\n #must contains at least one of 9 digits\n res << (1..9).map {|d| variable(i, j, d) }\n\n (1..9).each do |d|\n ((d+1)..9).each do |dp|\n #can not co... | [
"0.60880697",
"0.6075233",
"0.5994307",
"0.59864086",
"0.59284073",
"0.5913023",
"0.5889624",
"0.5882002",
"0.58327675",
"0.57243747",
"0.570714",
"0.5705268",
"0.5631455",
"0.5624177",
"0.5617142",
"0.55928403",
"0.5592152",
"0.55841285",
"0.55807835",
"0.55367464",
"0.55215... | 0.5610886 | 15 |
End of Devise methods | def new
@cat = Cat.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def devise_controller?; end",
"def devise_modules_hook!; end",
"def user_authentication\n end",
"def after_custom_authentication; end",
"def clean_up_passwords; end",
"def after_ip_authentication\n end",
"def after_token_authentication\n end",
"def after_token_authentication\n end",
... | [
"0.72960836",
"0.675834",
"0.6632999",
"0.6603611",
"0.65627617",
"0.6540016",
"0.6530084",
"0.6530084",
"0.651165",
"0.651165",
"0.65039164",
"0.64916915",
"0.6445266",
"0.6417515",
"0.6395933",
"0.63913167",
"0.6382089",
"0.63530684",
"0.6330368",
"0.62395906",
"0.6239504",... | 0.0 | -1 |
This method transforms an incoming line (Hash) of data. Each of the klass masked mappings are applied to the hash values, which are reordered by the mappng definition, yielding the klass and fields for each mapped klass. | def transform_line(line, index)
return enum_for(:transform_line, line, index) unless block_given?
raise 'NdrImport::PdfForm::Table expects a Hash!' unless line.is_a? Hash
validate_column_mappings(line)
masked_mappings.each do |klass, klass_mappings|
ordered_line = order_values_by_mappings(line, klass_mappings)
fields = mapped_line(ordered_line, klass_mappings)
next if fields[:skip].to_s == 'true'.freeze
yield(klass, fields, index)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transform_line(line, index)\n return enum_for(:transform_line, line, index) unless block_given?\n\n identifier = case @row_identifier.to_s\n when 'index'\n index\n when 'uuid'\n SecureRandom.uuid\n end\n\n ... | [
"0.63029784",
"0.5505414",
"0.5502506",
"0.54044",
"0.53038436",
"0.5275538",
"0.5246323",
"0.52140754",
"0.517291",
"0.5109988",
"0.50749296",
"0.50705767",
"0.5053703",
"0.5040693",
"0.49770197",
"0.4957514",
"0.49220508",
"0.49132803",
"0.4892163",
"0.48846743",
"0.4866537... | 0.68083143 | 0 |
Ensure every key has a column mapping | def validate_column_mappings(line)
unmapped = []
line.each_key do |key|
next if column_names.include? key
unmapped << key
end
raise NdrImport::UnmappedDataError, unmapped if unmapped.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ensure_complete_key(hash)\n keys_as_strings = hash.keys.map(&:to_s)\n missing = value_column_names - keys_as_strings\n extra = keys_as_strings - value_column_names\n\n missing = missing.select do |missing_column_name|\n column = @low_card_model.columns.detect { |c| c.name.t... | [
"0.7006647",
"0.6529447",
"0.6290558",
"0.6249446",
"0.62335354",
"0.61609274",
"0.61510026",
"0.6072055",
"0.60656965",
"0.6064076",
"0.60543984",
"0.603254",
"0.59626573",
"0.59626573",
"0.5944907",
"0.5937606",
"0.5933706",
"0.59186053",
"0.59083956",
"0.5905001",
"0.58994... | 0.6604078 | 1 |
Return an Array of the `hash` values in the order the columns are defined in the mapping, allowing mapped_line to work as normal | def order_values_by_mappings(hash, column_mappings)
column_mappings.map { |column_mapping| hash[column_name_from(column_mapping)].to_s }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cols_array\n arr = Array.new\n @columns_hash.each{|k,v| arr << k}\n return arr\n end",
"def columns; @columns_hash.values; end",
"def hash\n rows.hash\n end",
"def to_2d_array(tile_hash)\n min_x = tile_hash.min_by{|v|v[:x]}[:x]\n min_y = tile_hash.min_by{|v|v[:y]}[:y]\n map =... | [
"0.66474134",
"0.6356778",
"0.6129696",
"0.60634154",
"0.60352635",
"0.60185146",
"0.59802306",
"0.59547",
"0.5949071",
"0.587855",
"0.5877615",
"0.58046275",
"0.5803588",
"0.577758",
"0.5770499",
"0.5770416",
"0.57633996",
"0.57332563",
"0.573114",
"0.5725849",
"0.57097554",... | 0.5705415 | 21 |
Returns the text for the most suitable locale provided. | def suitable_locale_text(texts)
english = texts.select { |t| english_locales.include? t["locale"] }
(english + texts).first["text"]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def text(locale = I18n.locale)\n output = send(:\"text_#{locale}\")\n output = output.blank? ? text_en : output\n output.blank? ? text_de : output\n end",
"def locale\n return nil if errors\n\n locale = YAML.safe_load(@text).keys.first\n locale.to_sym\n end",
"def default_locale\n FastGe... | [
"0.7414449",
"0.73241514",
"0.7167041",
"0.6786333",
"0.6746928",
"0.66649854",
"0.66258925",
"0.64781535",
"0.6461694",
"0.6461694",
"0.6461694",
"0.6461694",
"0.6461694",
"0.6461694",
"0.6461694",
"0.6461344",
"0.6439663",
"0.638591",
"0.63617367",
"0.62789994",
"0.6277722"... | 0.7295444 | 2 |
This isn't really part of KeyMap nor HotkeyFile... it is a very unique routine specific for detecting conflicts. So, for now, I'm just going to leave it defined in the global space. | def process_map(map, keymap, path)
map.all_attributes.each do |attr|
next if KeyMap::NO_CONFLICTS.include?(attr.name)
if u = $user_attributes[attr.name]
u.value.all.each do |key|
keymap.add(key, u, path: path, default: false)
end
elsif DefaultKeymaps.instance.has_alts?(attr.name)
attr.value.all.each do |key|
keymap.add(key, attr, path: path, default: true)
end
else
keymap.add(attr.value.pri, attr, path: path, default: true) if attr.value.pri
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def treat_reserved_as_conflict; end",
"def treat_reserved_as_conflict=(_arg0); end",
"def if_needs_rekey?; end",
"def needs_rekey?; end",
"def message\n \"#{base} already defines #{conflicts}, also defined on #{owner}\"\n end",
"def shared_keyboard_and_mouse_event_init_keys\n shared_keyboa... | [
"0.6656321",
"0.6267235",
"0.6137481",
"0.59569526",
"0.59454536",
"0.59100956",
"0.581545",
"0.5722955",
"0.5722955",
"0.5701576",
"0.56724006",
"0.5560017",
"0.5552768",
"0.5528456",
"0.54792887",
"0.5445249",
"0.5445249",
"0.5414225",
"0.5395847",
"0.53220344",
"0.5292858"... | 0.0 | -1 |
FIXME: this is a Hash, whereas member_json returns a string. Given json, these should probably return the same datatype; so I'm betting we're not doing this right | def failure_json
{ errors: 'Sorry you are not eligible for WellMatch' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def json_data\n members = self.members.map do |member|\n member.group_json_data(self.id)\n end\n { group: self, members: members, member_split: self.member_split.round(2), total_spend: self.expenses_total.round(2)}\n end",
"def hash\n members.hash\n end",
"def member_to_hash(member)\... | [
"0.6231882",
"0.61340785",
"0.5943855",
"0.59309256",
"0.5885714",
"0.58704954",
"0.58562696",
"0.58170664",
"0.5812353",
"0.5727779",
"0.5680383",
"0.5658426",
"0.5610169",
"0.5598211",
"0.5563802",
"0.5462433",
"0.54433686",
"0.54297924",
"0.54235786",
"0.53837883",
"0.5367... | 0.0 | -1 |
GET /userinfos/1 GET /userinfos/1.xml | def show
@userinfo = Userinfo.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @userinfo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users_get_info_response_xml\n <<-XML\n <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <users_getInfo_response xmlns=\"\" xmlns:xsi=\"\" xsi:schemaLocation=\"\" list=\"true\">\n\t<user>\n\t <uid>kangtk</uid>\n\t <nickname>康泰克</nickname>\n\t <facebig>http://userface3.51.com/ce/25/kangtk_130.gif?v=2... | [
"0.7011156",
"0.68958706",
"0.6836286",
"0.68173355",
"0.67957693",
"0.6785852",
"0.66955936",
"0.66265553",
"0.66068935",
"0.65898204",
"0.658483",
"0.6583918",
"0.6582853",
"0.65776205",
"0.65661854",
"0.6561844",
"0.6560396",
"0.6560124",
"0.6552189",
"0.6552189",
"0.65482... | 0.72638065 | 0 |
GET /userinfos/new GET /userinfos/new.xml | def new
@userinfo = Userinfo.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @userinfo }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end",
"def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end"... | [
"0.7399565",
"0.7383971",
"0.7353943",
"0.7320244",
"0.7307075",
"0.7248093",
"0.7205856",
"0.7205856",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.71816397",
"0.7... | 0.774022 | 0 |
POST /userinfos POST /userinfos.xml | def create
@userinfo = Userinfo.new(params[:userinfo])
respond_to do |format|
if @userinfo.save
flash[:notice] = 'Userinfo was successfully created.'
format.html { redirect_to(@userinfo) }
format.xml { render :xml => @userinfo, :status => :created, :location => @userinfo }
else
format.html { render :action => "new" }
format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_user_info(username, xml); end",
"def append_user_info(username, xml)\n end",
"def create\n @user_info = UserInfo.new(user_info_params)\n\n respond_to do |format|\n if @user_info.save\n format.html { redirect_to @user_info, notice: 'User info was successfully created.' }\n ... | [
"0.6786364",
"0.65938085",
"0.63673097",
"0.6219625",
"0.6070042",
"0.5999379",
"0.5972065",
"0.5970282",
"0.5936594",
"0.59037507",
"0.58908343",
"0.58631206",
"0.5832076",
"0.58149314",
"0.5634006",
"0.5628109",
"0.56202567",
"0.5580599",
"0.5568617",
"0.5554242",
"0.555118... | 0.6702249 | 1 |
PUT /userinfos/1 PUT /userinfos/1.xml | def update
@userinfo = Userinfo.find(params[:id])
respond_to do |format|
if @userinfo.update_attributes(params[:userinfo])
flash[:notice] = 'Userinfo was successfully updated.'
format.html { redirect_to(@userinfo) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @userinfo.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def append_user_info(username, xml); end",
"def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end",
"def append... | [
"0.62927645",
"0.62615234",
"0.6223693",
"0.62155145",
"0.6183314",
"0.6155302",
"0.61155343",
"0.6097311",
"0.59757406",
"0.59750223",
"0.5964583",
"0.5946108",
"0.5910489",
"0.5902028",
"0.590074",
"0.58936524",
"0.5877312",
"0.58746475",
"0.5872516",
"0.5870541",
"0.586794... | 0.67879987 | 0 |
DELETE /userinfos/1 DELETE /userinfos/1.xml | def destroy
@userinfo = Userinfo.find(params[:id])
@userinfo.destroy
respond_to do |format|
format.html { redirect_to(userinfos_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @user = User.find_by_urlname(params[:id])\n @user.destroy\n \n r... | [
"0.6818971",
"0.67526174",
"0.6606075",
"0.6606075",
"0.66028523",
"0.6593021",
"0.6589902",
"0.6580657",
"0.65690243",
"0.6556147",
"0.65520084",
"0.6534515",
"0.6530311",
"0.6527603",
"0.65053916",
"0.65053916",
"0.65053916",
"0.65053916",
"0.65053916",
"0.65053916",
"0.650... | 0.73564196 | 0 |
Add `ontop: true` as an additional option here in order to prevent it from actually daemonizing. It helps a ton with debugging. | def build_daemon
base = {
app_name: name,
dir_mode: :normal,
dir: dir
}.merge(daemon)
base.tap do |hash|
base[:ontop] = true if ServiceLayer.config.debug
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_top\n get_value :ontop\n end",
"def daemonopts()\n {\n :ontop => false,\n :backtrace => false,\n :dir_mode => :normal,\n :app_name => 'graphiteme',\n :dir => '/var/run/graphiteme/',\n :log_output => true,\n :log_dir => '/var/log/graphiteme/',\n }\nend",
... | [
"0.5627171",
"0.5598656",
"0.54221094",
"0.53796285",
"0.53509796",
"0.521135",
"0.50964594",
"0.5079381",
"0.50769544",
"0.49649146",
"0.49249712",
"0.49225807",
"0.49084163",
"0.48479152",
"0.4844704",
"0.48378855",
"0.48269588",
"0.48089743",
"0.48047203",
"0.48029384",
"0... | 0.48134065 | 17 |
GET /gtfs_agencies/1 GET /gtfs_agencies/1.xml | def show
@gtfs_agency = GtfsAgency.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @gtfs_agency }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tafs(params={})\n perform_get('/tafs.xml', params)\n end",
"def show\n @agencies = Agency.find(params[:id])\n\n if @agencies \n respond_to do |format|\n format.json { render :json => @agencies }\n format.xml { render :xml => @agencies }\n ... | [
"0.58717054",
"0.58518404",
"0.5811786",
"0.5714095",
"0.5660901",
"0.5581845",
"0.55206776",
"0.55132425",
"0.54419893",
"0.5418334",
"0.53592414",
"0.5325008",
"0.53200316",
"0.53065544",
"0.5303332",
"0.5287367",
"0.5250927",
"0.51807016",
"0.51742536",
"0.5090325",
"0.508... | 0.61627245 | 0 |
GET /gtfs_agencies/new GET /gtfs_agencies/new.xml | def new
@gtfs_agency = GtfsAgency.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @gtfs_agency }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => ... | [
"0.67938685",
"0.6025093",
"0.59955025",
"0.57807696",
"0.57473403",
"0.5719189",
"0.5705475",
"0.56247216",
"0.56038046",
"0.55940866",
"0.55797917",
"0.5557403",
"0.5554469",
"0.55422163",
"0.55147487",
"0.5513282",
"0.55113035",
"0.54881865",
"0.5485803",
"0.5472135",
"0.5... | 0.69585145 | 0 |
POST /gtfs_agencies POST /gtfs_agencies.xml | def create
@gtfs_agency = GtfsAgency.new(params[:gtfs_agency])
respond_to do |format|
if @gtfs_agency.save
format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }
format.xml { render :xml => @gtfs_agency, :status => :created, :location => @gtfs_agency }
else
format.html { render :action => "new" }
format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tafs(params={})\n perform_get('/tafs.xml', params)\n end",
"def new\n @gtfs_agency = GtfsAgency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @gtfs_agency }\n end\n end",
"def index\n @agencies = Agency.all\n end",
"def destroy\... | [
"0.5092229",
"0.5078417",
"0.5059218",
"0.49429503",
"0.48785475",
"0.48385835",
"0.48376653",
"0.47317272",
"0.4723608",
"0.46779332",
"0.46573249",
"0.46541524",
"0.46472257",
"0.46465603",
"0.46414372",
"0.463291",
"0.46328992",
"0.46259022",
"0.46251053",
"0.46196553",
"0... | 0.6088978 | 0 |
PUT /gtfs_agencies/1 PUT /gtfs_agencies/1.xml | def update
@gtfs_agency = GtfsAgency.find(params[:id])
respond_to do |format|
if @gtfs_agency.update_attributes(params[:gtfs_agency])
format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @gtfs_agency.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @gtfs_agency = GtfsAgency.new(params[:gtfs_agency])\n\n respond_to do |format|\n if @gtfs_agency.save\n format.html { redirect_to(@gtfs_agency, :notice => 'Gtfs agency was successfully created.') }\n format.xml { render :xml => @gtfs_agency, :status => :created, :location => ... | [
"0.5668073",
"0.5418147",
"0.50160056",
"0.49147582",
"0.48893866",
"0.48783252",
"0.48439917",
"0.48429257",
"0.48283055",
"0.48032257",
"0.47987753",
"0.4734048",
"0.47269425",
"0.46899068",
"0.4686061",
"0.4659577",
"0.46583828",
"0.46485117",
"0.46348712",
"0.46254843",
"... | 0.62252223 | 0 |
DELETE /gtfs_agencies/1 DELETE /gtfs_agencies/1.xml | def destroy
@gtfs_agency = GtfsAgency.find(params[:id])
@gtfs_agency.destroy
respond_to do |format|
format.html { redirect_to(gtfs_agencies_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end",
"def deleteEntityAdvertiser( entity_id, ge... | [
"0.6112878",
"0.5997687",
"0.59097254",
"0.5873835",
"0.5868019",
"0.57327247",
"0.5721108",
"0.5714357",
"0.5694244",
"0.5650237",
"0.5639041",
"0.5635341",
"0.5630738",
"0.5623372",
"0.56099933",
"0.5598466",
"0.5577469",
"0.5575416",
"0.55738604",
"0.5562374",
"0.5547541",... | 0.71470106 | 0 |
GET /users GET /users.json | def index
@users = User.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def users(args = {})\n get(\"/users.json\",args)\n end",
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def GetUsers params = {}\n\n para... | [
"0.8210063",
"0.78731877",
"0.78600395",
"0.78103924",
"0.78053653",
"0.76777875",
"0.76582843",
"0.7632195",
"0.75826395",
"0.7529077",
"0.7487757",
"0.7448671",
"0.7439283",
"0.7437491",
"0.74267244",
"0.739832",
"0.739832",
"0.739832",
"0.739832",
"0.73765147",
"0.73729014... | 0.0 | -1 |
GET /users/1 GET /users/1.json | def show
@user = User.find(params[:id])
@self = current_user.try(:id) == @user.id
respond_to do |format|
format.html
format.json { render json: @user.as_json(only: [:type, :name, :email, :dob, :community, :nationality, :address, :number], include: [branches: {only:[:id, :name] } ] ) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.81046426",
"0.7703556",
"0.77011716",
"0.76262826",
"0.7582106",
"0.74818",
"0.7461394",
"0.7446168",
"0.730656",
"0.7300699",
"0.72902125",
"0.72781444",
"0.72358584",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.72335744",
"0.722... | 0.0 | -1 |
POST /users POST /users.json PATCH/PUT /users/1 PATCH/PUT /users/1.json | def update
respond_to do |format|
if @user.update(user_params)
format.html { redirect_to @user, notice: 'User was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @user.errors.full_messages }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n if user.update(user_params)\n render json: user\n else\n ... | [
"0.6738925",
"0.6675159",
"0.6655539",
"0.66540796",
"0.65905225",
"0.65167177",
"0.6503634",
"0.64781594",
"0.6477745",
"0.6390173",
"0.63605255",
"0.6355535",
"0.634593",
"0.63340324",
"0.6327199",
"0.63032496",
"0.6296734",
"0.6283449",
"0.62784576",
"0.62697935",
"0.62697... | 0.0 | -1 |
DELETE /users/1 DELETE /users/1.json | def destroy
@user = User.find(params[:id])
@user.destroy
respond_to do |format|
format.html { redirect_to users_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n render json: Users.delete(params[\"id\... | [
"0.7873292",
"0.7750298",
"0.7712461",
"0.7608525",
"0.74697524",
"0.7405238",
"0.7405238",
"0.7367449",
"0.7343722",
"0.7337858",
"0.73261935",
"0.7307456",
"0.73072684",
"0.73045266",
"0.7295572",
"0.7288997",
"0.72888744",
"0.7287881",
"0.72815514",
"0.72480947",
"0.724809... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_user
@user = User.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.6165422",
"0.60457647",
"0.5946384",
"0.5916027",
"0.58905005",
"0.583495",
"0.5777223",
"0.56995213",
"0.56995213",
"0.56532377",
"0.5621348",
"0.5422839",
"0.54118705",
"0.54118705",
"0.54118705",
"0.53935355",
"0.5379617",
"0.53577393",
"0.53407264",
"0.53398263",
"0.53... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def user_params
params.require(:user).permit(:type, :name, :email, :dob, :community, :nationality, :address, :number)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
(3:003:30) question 1 30 mins | def str_index_of(str1, str2)
if str_include(str1, str2)
get_index(str1, str2)
else
return -1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_notification\n \"You have #{@time_to_answer / 60} min #{@time_to_answer % 60} sec left\"\n end",
"def ask_time\n # twelve\n end",
"def time_to_solve\n 1.hour\n end",
"def reading_time(index)\n words_per_second = 270 / 60\n total_words = description(index).scan(/\\s+/).count\n ar... | [
"0.6235086",
"0.6084603",
"0.6000901",
"0.59780073",
"0.59548825",
"0.59336287",
"0.5926185",
"0.58832926",
"0.57773465",
"0.5746759",
"0.56516075",
"0.5644546",
"0.56351864",
"0.56276083",
"0.5623318",
"0.5617937",
"0.56091696",
"0.56091696",
"0.56091696",
"0.56091696",
"0.5... | 0.0 | -1 |
Title: Playing with digits v2 | def dig_pow(n, p)
sum = n.digits.reverse.each_with_index.sum { |d, index| d**(p + index) }
(sum % n).zero? ? sum.div(n) : -1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def say_digits(digits, escapeDigits=ALL_SPECIAL_DIGITS) \r\n\t\tmsg=\"SAY DIGITS #{digits} #{escape_digit_string(escapeDigits)}\"\r\n\t\tsend(msg)\r\n\t\treturn get_int_result()\r\n\tend",
"def digit; end",
"def initialize(digits)\n @digits = digits\n end",
"def digit!\n # -> uncomment the next line... | [
"0.6195371",
"0.60537344",
"0.5969719",
"0.5903429",
"0.5686479",
"0.56535673",
"0.56495404",
"0.5647547",
"0.5623916",
"0.5594184",
"0.55928594",
"0.55687016",
"0.5528463",
"0.55276966",
"0.5491444",
"0.5449811",
"0.5446632",
"0.5433583",
"0.5433583",
"0.5428844",
"0.5391142... | 0.0 | -1 |
The return value should be a string that begins with the century number, and ends with st, nd, rd, or th as appropriate for that number. New centuries begin in years that end with 01. So, the years 19012000 comprise the 20th century. =begin Input: Integer Output: String Rules: take in a year as an Integer return a string that gives century with appropriate suffix centuries begin in year 01 Algorithm: calculate the appropriate century date use a case statement to attach the right suffix 11 = th 12 = th 13 = th end in 1 = st end in 2 = nd end in 3 = rd else = th =end | def century(year)
century, check = year.divmod(100)
check == 0 ? century : century += 1
suffix = century % 100
if suffix == 11 || suffix == 12 || suffix == 13
century.to_s + 'th'
elsif suffix % 10 == 1
century.to_s + 'st'
elsif suffix % 10 == 2
century.to_s + 'nd'
elsif suffix % 10 == 3
century.to_s + 'rd'
else
century.to_s + 'th'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def century(year)\n # create century_str--------------\n if year.to_s.end_with?('00')\n century_str = year / 100\n else\n century_str = year / 100 + 1\n end\n century_str = century_str.to_s\n # --------------------------------\n\n # create suffix-------------------\n suffix = nil\n\n if century_str.... | [
"0.870891",
"0.84951717",
"0.8441888",
"0.8409901",
"0.8393028",
"0.8372144",
"0.83571666",
"0.83431906",
"0.83330226",
"0.8295295",
"0.82802355",
"0.82577956",
"0.82452583",
"0.82100415",
"0.8201105",
"0.81640667",
"0.8163631",
"0.81413585",
"0.8135555",
"0.8129648",
"0.8099... | 0.81146216 | 20 |
tests for condition block | def test_conditional_true
act = acl {
respond(200) { true }
}.call({})
assert_equal([200, {}, []], act)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def condition; end",
"def condition\n expect :if\n self[1]\n end",
"def cond; end",
"def cond; end",
"def cond; end",
"def run_cond; end",
"def if_condition; end",
"def complex_condition?(condition); end",
"def condition &block\n return unless block\n\n case @deferred_status\n ... | [
"0.7705128",
"0.74539584",
"0.7257162",
"0.7257162",
"0.7257162",
"0.7232347",
"0.7037876",
"0.7018443",
"0.6787561",
"0.67472076",
"0.67472076",
"0.66986597",
"0.66069186",
"0.6600873",
"0.6590601",
"0.6569773",
"0.65691495",
"0.65093297",
"0.65093297",
"0.64882267",
"0.6436... | 0.0 | -1 |
tests for acl block | def test_empty
act = acl {
}.call({})[0]
assert_equal(399, act)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_set3_16_check()\n prin_name = 'Klubicko'\n acc_type = 'allow'\n priv_name = 'SELECT'\n res_ob_type = 'doc'\n res_ob_adrs='/db/temp'\n test_set2_05_create_ace(prin_name, acc_type, priv_name, res_ob_type, res_ob_adrs)\n acc_type = 'deny' \n test_set2_05_create_ace(prin_name, acc_t... | [
"0.6512224",
"0.64589405",
"0.63460326",
"0.63172895",
"0.6222977",
"0.61907774",
"0.6190758",
"0.6156618",
"0.61100674",
"0.608572",
"0.6078659",
"0.6019188",
"0.5984663",
"0.5975176",
"0.57724375",
"0.5719806",
"0.57072496",
"0.5686343",
"0.5662822",
"0.5639642",
"0.563046"... | 0.6054309 | 11 |
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength | def draw
puts " | |"
puts " #{@squares[1]} | #{@squares[2]} | #{@squares[3]}"
puts " | |"
puts "-----+-----+-----"
puts " | |"
puts " #{@squares[4]} | #{@squares[5]} | #{@squares[6]}"
puts " | |"
puts "-----+-----+-----"
puts " | |"
puts " #{@squares[7]} | #{@squares[8]} | #{@squares[9]}"
puts " | |"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def strategy; end",
"def used?; end",
"def offences_by; end",
"def custo... | [
"0.7688308",
"0.63501185",
"0.63158923",
"0.63158923",
"0.62753135",
"0.62092173",
"0.62092173",
"0.62092173",
"0.62092173",
"0.6173984",
"0.6030169",
"0.5963718",
"0.5913621",
"0.5882073",
"0.5882073",
"0.58618",
"0.5853187",
"0.5853187",
"0.58392256",
"0.579109",
"0.5769591... | 0.0 | -1 |
rubocop:enable Metrics/AbcSize rubocop:enable Metrics/MethodLength | def reset
(1..9).each { |key| @squares[key] = Square.new }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def schubert; end",
"def used?; end",
"def strategy; end",
"def suivre; end",
"def custom; en... | [
"0.7739466",
"0.6475757",
"0.6350966",
"0.6350966",
"0.62901074",
"0.6278411",
"0.6278411",
"0.6278411",
"0.6278411",
"0.62739927",
"0.60279757",
"0.5989889",
"0.59686774",
"0.5967138",
"0.5967138",
"0.5941473",
"0.5891728",
"0.5891728",
"0.5874962",
"0.58383375",
"0.58337486... | 0.0 | -1 |
the cache initializer, which uses this info). | def determine_revision
# Note the revision number we're running, and a
# more-informative string containing it.
number = `git log -1`.split(' ')[1][0...8] rescue '???'
details = "#{Rails.env} #{number} #{`hostname -f`.strip}"
return number, details
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @cache = {}\n end",
"def _init_cache\n @cache_parent = {}\n end",
"def initialize(cache)\n self.cache = cache\n end",
"def initialize(cache = Global.cache)\n @cache = cache.new\n end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_... | [
"0.7975239",
"0.7903088",
"0.78209746",
"0.77808446",
"0.7602022",
"0.7602022",
"0.7602022",
"0.7602022",
"0.748774",
"0.748774",
"0.748774",
"0.748774",
"0.748774",
"0.748774",
"0.748774",
"0.7441652",
"0.73994964",
"0.725463",
"0.72540873",
"0.72540873",
"0.72341764",
"0.... | 0.0 | -1 |
used with Rails, takes an exception, controller, request and parameters creates an ExceptionData object | def handle(exception, controller, request, params, current_user = nil)
Exceptional.log! "Handling #{exception.message}", 'info'
begin
e = parse(exception)
# Additional data for Rails Exceptions
e.framework = "rails"
e.controller_name = controller.controller_name
e.action_name = controller.action_name
e.application_root = Exceptional.application_root?
e.occurred_at = Time.now.strftime("%Y%m%d %H:%M:%S %Z")
e.environment = request.env.to_hash
e.url = "#{request.protocol}#{request.host}#{request.request_uri}"
e.environment = safe_environment(request)
e.session = safe_session(request.session)
e.parameters = sanitize_hash(params.to_hash)
# Add info about current user if configured to do so
add_user_data(e, current_user) if(Exceptional.send_user_data? && !current_user.nil?)
post(e)
rescue Exception => exception
Exceptional.log! "Error preparing exception data."
Exceptional.log! exception.message
Exceptional.log! exception.backtrace.join("\n"), 'debug'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle(exception, controller, request, params)\n log! \"Handling #{exception.message}\", 'info'\n e = parse(exception)\n # Additional data for Rails Exceptions\n e.framework = \"rails\"\n e.controller_name = controller.controller_name\n e.action_name = controller.action_name\n ... | [
"0.7119154",
"0.65862703",
"0.65387523",
"0.63619196",
"0.62228584",
"0.6163275",
"0.6152219",
"0.604346",
"0.60348225",
"0.6014422",
"0.590377",
"0.5896904",
"0.58777493",
"0.5850866",
"0.57773083",
"0.57716084",
"0.57681847",
"0.5699557",
"0.56877905",
"0.56654406",
"0.5660... | 0.6885798 | 1 |
rescue any exceptions within the given block, send it to exceptional, then raise | def rescue(&block)
begin
block.call
rescue Exception => e
self.catch(e)
raise(e)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_and_convert_exceptions(&block)\n block.call\n rescue *self.class.expected_errors => e\n raise self.class.horza_error_from_orm_error(e.class).new(e.message)\n end",
"def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n ... | [
"0.7244392",
"0.70046616",
"0.69982564",
"0.69982564",
"0.69982564",
"0.69982564",
"0.6924747",
"0.69211155",
"0.67805254",
"0.6756068",
"0.6744988",
"0.6740115",
"0.6734472",
"0.6724487",
"0.6700559",
"0.6652584",
"0.66431344",
"0.66384596",
"0.6630474",
"0.65376484",
"0.650... | 0.7608781 | 1 |
post the given exception data to getexceptional.com | def post(exception_data)
hash = exception_data.to_hash
if hash[:session]
hash[:session].delete("initialization_options")
hash[:session].delete("request")
end
Exceptional.post_exception(hash.to_json)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(exception_data)\n hash = exception_data.to_hash\n hash[:session].delete(\"initialization_options\")\n hash[:session].delete(\"request\")\n call_remote(:errors, hash.to_json)\n end",
"def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"act... | [
"0.7420021",
"0.70168144",
"0.6793968",
"0.66256076",
"0.65499425",
"0.64644957",
"0.615147",
"0.6138807",
"0.6109887",
"0.60761017",
"0.6075355",
"0.6073567",
"0.60699695",
"0.6021474",
"0.5934792",
"0.584824",
"0.5830682",
"0.5824113",
"0.58181214",
"0.5808992",
"0.5808762"... | 0.7065451 | 1 |
This (ironic) method sanitizes a hash by removing unjsonable objects from the passed in hash. needed as active_support's fails in some cases with a cyclical reference error. | def sanitize_hash(hash)
return {} if hash.nil?
Hash.from_xml(hash.to_xml)['hash']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_hash(hash)\n Hash[hash.collect { |k, v| [k.to_s, v.is_a?(Hash) ? sanitize_hash(v) : v] }]\n end",
"def clean_hash(hash)\n hash.each do |key, value|\n if value == ''\n hash[key] = nil\n elsif value.is_a?(Array)\n value.each do |item|\n clean_has... | [
"0.79140526",
"0.71279997",
"0.7099988",
"0.68443954",
"0.6835184",
"0.6672898",
"0.6653759",
"0.65036935",
"0.64968705",
"0.6486022",
"0.6478653",
"0.6443675",
"0.64241505",
"0.627339",
"0.6265209",
"0.6256599",
"0.6246022",
"0.62126154",
"0.6212128",
"0.620482",
"0.6188663"... | 0.68806356 | 3 |
OBTENIR L'ADRESSE EMAIL DE VAUREAL | def get_the_email_of_a_townhal_from_its_webpage
doc = Nokogiri::HTML(open("http://annuaire-des-mairies.com/95/vaureal.html"))
email = doc.xpath('/html/body/div/main/section[2]/div/table/tbody/tr[4]/td[2]')
puts email
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_mail\n \n end",
"def email; @email; end",
"def enviar\n Email.enviar\n end",
"def email; end",
"def email; end",
"def email; end",
"def email; end",
"def email\n mail.first\n end",
"def email\n mail.first\n end",
"def envio_email\n mail(to: destinatario... | [
"0.6946293",
"0.678043",
"0.6742999",
"0.66691005",
"0.66691005",
"0.66691005",
"0.66691005",
"0.66582733",
"0.66582733",
"0.6616943",
"0.64505464",
"0.64341134",
"0.6428584",
"0.6428584",
"0.63659495",
"0.63554114",
"0.6318685",
"0.63108355",
"0.63108355",
"0.6309078",
"0.62... | 0.0 | -1 |
OBTENIR TOUTES LES URL DE VILLES DU VAL D'OISE | def get_all_the_urls_of_val_doise_townhalls
doc = Nokogiri::HTML(open("http://annuaire-des-mairies.com/val-d-oise.html"))
puts doc.xpath('//a[@class = "lientxt"]/@href')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def url\n end",
"def get_link\n page = Nokogiri::HTML(open(\"http://annuaire-des-mairies.com/val-d-oise.html\"))\n faux_liens_villes =[]\n page.xpath('//*[@class=\"lientxt\"]').each do |lien|\n faux_liens_villes << lien.values[1]\n end\n liens_villes = faux_lien... | [
"0.6703674",
"0.6689681",
"0.6644348",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.664131",
"0.66... | 0.0 | -1 |
Title: Find Maximum and Minimum Values of a List v1 | def min(list)
list.min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def min_max(list)\n list.minmax\nend",
"def min_max(list)\n [list.min, list.max]\nend",
"def min_max(lst)\n p '--- Jan-06-2017 problem ---'\n # you can also do lst.minmax\n [lst.min, lst.max]\nend",
"def min_max(lst)\n return lst.minmax\nend",
"def min_max(lst)\n lst.minmax\nend",
"def min_max(lst... | [
"0.801312",
"0.79702216",
"0.79634297",
"0.78428304",
"0.7840437",
"0.7840437",
"0.7840437",
"0.7840437",
"0.7362018",
"0.73410064",
"0.71319",
"0.7084207",
"0.70274186",
"0.6978622",
"0.69427073",
"0.68854713",
"0.6854826",
"0.67132264",
"0.6705786",
"0.6683675",
"0.66757643... | 0.6654643 | 21 |
Lists all users for a company | def index
@company = Company.find(params[:company_id])
@users = @company.users.where("role > 0").paginate(:page => params[:page], :per_page => 15)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @company_users = CompanyUser.all\n end",
"def index\n @users = User.where(company_id: current_user.company_id)\n end",
"def index\n \n @company = Company.find(params[:company_id])\n if !can?(:manage, @company)\n raise CanCan::AccessDenied.new(\"Usted no puede administrar otra ... | [
"0.82247216",
"0.811345",
"0.7907444",
"0.779224",
"0.75096136",
"0.7375409",
"0.7359756",
"0.72433573",
"0.6918483",
"0.6904895",
"0.6834567",
"0.6797787",
"0.67897624",
"0.67888176",
"0.6784727",
"0.6761954",
"0.67603844",
"0.6714364",
"0.67131984",
"0.6708775",
"0.6696818"... | 0.7502657 | 5 |
Edit an user in a company | def edit
@company = Company.find( params[:company_id] )
@user = @company.users.find( params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @company_user = CompanyUser.find(params[:id])\n\n respond_to do |format|\n if @company_user.update_attributes(params[:company_user])\n format.html { redirect_to(@company_user, :notice => 'Company user was successfully updated.') }\n format.xml { head :ok }\n else\n ... | [
"0.7603888",
"0.75932544",
"0.7527632",
"0.7317906",
"0.73035336",
"0.7278403",
"0.72636235",
"0.71981966",
"0.7087932",
"0.70656914",
"0.706439",
"0.7012036",
"0.7008186",
"0.6981034",
"0.695699",
"0.695428",
"0.6936021",
"0.690873",
"0.69051397",
"0.6896162",
"0.68728524",
... | 0.8547386 | 0 |
Prepares to creates a new user in a company | def new
@company = Company.find( params[:company_id])
@user = @company.users.build
@roles = ROLE
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user = User.new(params[:user])\n @user.company = current_company\n create!\n end",
"def create\n @company = Company.new\n @company.name = params[:new_company][:name]\n @company.slug = @company.name.parameterize\n @company.state = COMPANY_STATE[:unchecked]\n @user = User.new... | [
"0.81098706",
"0.80224335",
"0.746584",
"0.743986",
"0.73469734",
"0.73166806",
"0.7283389",
"0.72600806",
"0.71121275",
"0.7093118",
"0.70498973",
"0.6916142",
"0.68976027",
"0.6865414",
"0.68131405",
"0.67821765",
"0.6724665",
"0.6698569",
"0.66943014",
"0.668133",
"0.66785... | 0.6559135 | 28 |
Creates a new user for a company | def create
@roles = ROLE
@company = Company.find( params[:company_id])
role = params[:user][:role]
params[:user].delete(:role)
@user = @company.users.build( params[:user])
@user.role = Integer role
@user.state = -1
@user.password_digest = 0
if @user.save
UserMailer.verification_email(@user).deliver
redirect_to backoffice_company_user_path @company.id, @user
else
render 'new'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @company = Company.new\n @company.name = params[:new_company][:name]\n @company.slug = @company.name.parameterize\n @company.state = COMPANY_STATE[:unchecked]\n @user = User.new\n if @company.save\n @user = @company.users.build\n @user.email = params[:new_company][:email]\n... | [
"0.8462471",
"0.84425944",
"0.80941796",
"0.77406055",
"0.76298815",
"0.75353724",
"0.7533703",
"0.74848634",
"0.7469614",
"0.7467515",
"0.72764736",
"0.72478795",
"0.7225255",
"0.72136354",
"0.717133",
"0.7121461",
"0.7118365",
"0.7101472",
"0.70867646",
"0.7075002",
"0.7035... | 0.7423909 | 10 |
If the file is less than MAXIMUM_NAME_LENGTH, it doesn't need to be split, and the prefix can be blank. | def split?
file.bytesize > MAXIMUM_NAME_LENGTH
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_filename_length!(filename)\n name = relative_name = filename.to_s.sub(File.expand_path(@options[:spec_directory]), \"\")\n assert false, \"Filename #{name} must no more than #{256 - GEMFILE_PREFIX_LENGTH} characters long\" if name.size > (256 - GEMFILE_PREFIX_LENGTH)\n\n if name.size <= 100 the... | [
"0.62801874",
"0.61738354",
"0.6038905",
"0.59972364",
"0.59335655",
"0.58515567",
"0.5817975",
"0.5807052",
"0.57970977",
"0.5760169",
"0.5739213",
"0.5707985",
"0.57073635",
"0.5681748",
"0.56787884",
"0.5671423",
"0.55563974",
"0.5538413",
"0.55242306",
"0.55077857",
"0.55... | 0.6401034 | 0 |
It gets the scripts used by the module | def page_script(context={})
['/slider/js/jquery.nivo.slider.pack.js']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scripts\n SCRIPTS\n end",
"def scripts\n @scripts\n end",
"def scripts\n Dir.glob(File.join(script_dir, \"*.rb\")).inject([]) do |a, e|\n Kernel.load(e)\n a + [initialize_script(e)]\n end\n end",
"def scripts\n @parts.values.map(&:scri... | [
"0.81957114",
"0.7738012",
"0.7325212",
"0.7304881",
"0.72063977",
"0.7092024",
"0.6963241",
"0.68474567",
"0.67867285",
"0.67793906",
"0.6725386",
"0.66881883",
"0.6634246",
"0.66061234",
"0.6577076",
"0.6534488",
"0.64334214",
"0.63696814",
"0.6358962",
"0.63219583",
"0.629... | 0.0 | -1 |
I worked on this challenge [Jon Chen with Jack Huang ]. Your Solution Below | def leap_year?(year)
return (year % 4 == 0 && year % 100 !=0) || year % 400 == 0 ? true : false
#if (year % 4 == 0 && year % 100 !=0) || year % 400 == 0
# true
#else
# false
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution4(input)\n end",
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1... | [
"0.63289225",
"0.6205202",
"0.61149555",
"0.60662645",
"0.60597146",
"0.599806",
"0.59800804",
"0.5943953",
"0.5919818",
"0.5904032",
"0.5893192",
"0.58537364",
"0.5829291",
"0.58226335",
"0.5813042",
"0.57859313",
"0.5765567",
"0.57462376",
"0.5719892",
"0.57193565",
"0.5703... | 0.0 | -1 |
Shows the version of the Incline library. | def run
STDOUT.puts "Incline v#{Incline::VERSION}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_elf_version\n\t\t\tver_str = \"#{@elf_version}\"\n\t\t\tver_str += \" (current)\" if @elf_version == 1\n\t\t\tputs \" Version: #{ver_str}\"\n\t\tend",
"def version\n \"\\e[36mThis program is currently in version number: #{v_num}\\e[0m\"\n end",
"def show_file_version... | [
"0.728596",
"0.71393687",
"0.69819623",
"0.6916425",
"0.6847606",
"0.68432933",
"0.68432933",
"0.67912877",
"0.6788635",
"0.6624198",
"0.6591315",
"0.6591315",
"0.6589628",
"0.6533484",
"0.65255636",
"0.6522047",
"0.65111256",
"0.65068704",
"0.64834726",
"0.64754045",
"0.6471... | 0.0 | -1 |
Returns a sorted object of genres and the number of albums in each genre. | def genre_ranking
ranked_albums = SortCollection.sort_albums('genre')
render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def movies_genres_count\n @genres = Genre.joins(:movie).\n select('genre.genre_id, genre.name as name, count(*) as count').\n group('genre.genre_id').\n order('count DESC')\n end",
"def genres\n @songs.collect { |song| song.genre }.uniq\... | [
"0.69131875",
"0.68326956",
"0.6804614",
"0.6798646",
"0.67868227",
"0.6784776",
"0.67323387",
"0.6715794",
"0.67088675",
"0.6705654",
"0.6697351",
"0.66789454",
"0.6668431",
"0.6651489",
"0.6648197",
"0.6564751",
"0.65614504",
"0.65325636",
"0.65294313",
"0.6522338",
"0.6519... | 0.697417 | 0 |
Returns a sorted object of the top five years with the most number of albums. | def year_ranking
ranked_albums = SortCollection.sort_albums('year')
render json: ranked_albums.sort_by(&:last).reverse[0...5].to_h, status: 200
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def most_popular_group_per_year\n sql = <<-SQL\n -- SELECT year, category FROM guests GROUP BY year, category ORDER BY count(category), year DESC\n SELECT DISTINCT year, category, count(category) FROM guests GROUP BY year, category ORDER BY count(category) DESC\n SQL\n DB[:conn].execute(sql)\nend",
"def... | [
"0.67089105",
"0.661556",
"0.64398545",
"0.64351267",
"0.6414816",
"0.6402951",
"0.635556",
"0.63263845",
"0.6281088",
"0.6226375",
"0.6107117",
"0.60529023",
"0.6019344",
"0.59689695",
"0.5922062",
"0.5911997",
"0.58832455",
"0.5883013",
"0.5873894",
"0.5871405",
"0.58676356... | 0.69608057 | 0 |
before_filter :api_graph, only: [:select_friend, :publishing_post] | def start
destroy_session_customer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def before_filter; end",
"def run_filters\n set_user\n authorize\n end",
"def friend_request\n\nend",
"def facebook\n\n end",
"def facebook\n end",
"def index\n # byebug\n if params[:requester] == \"sent\"\n @friend_requests = current_user.friend_requests_as_requester\n else\n ... | [
"0.6621977",
"0.6478562",
"0.6444629",
"0.61583775",
"0.60956776",
"0.6083649",
"0.5988819",
"0.59180707",
"0.59009945",
"0.5853174",
"0.5853174",
"0.58523977",
"0.58179545",
"0.5807644",
"0.5803052",
"0.58006835",
"0.5798421",
"0.57695115",
"0.5751335",
"0.5750977",
"0.57150... | 0.0 | -1 |
options[:private] defaults to false if private is true, then the time remaining for the internal time limit is returned otherwise the time remaining for the public time limit is returned | def time_remaining(options = {})
options[:private] ||= false
if options[:private]
[duration - seconds_since_started, 0].max
else
[PUBLIC_TIME_LIMIT - seconds_since_started, 0].max
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_time_remaining\n\n end",
"def time_remaining\n\n end",
"def time_remaining\n end",
"def timeout_in\n if self.admin?\n 10.minutes\n else\n 15.minutes\n end\n end",
"def wait_time\n if rate_limit_remaining < 50\n [rate_limit_reset - Time.zone.now, 0.001].sort.last\n ... | [
"0.665115",
"0.63891006",
"0.6376292",
"0.62636495",
"0.60847634",
"0.6076463",
"0.5918858",
"0.5918858",
"0.5918858",
"0.58558226",
"0.576455",
"0.5757509",
"0.5723271",
"0.56893677",
"0.56843686",
"0.5651579",
"0.56058913",
"0.5568223",
"0.5559217",
"0.5508746",
"0.55055106... | 0.8575459 | 0 |
answers are valued as 0 if they are left blank def answer_value if has_answer? answer.value else 0 end end answers should not take the beta timer into account, since we didn't plan it this way, will have to resort to calculating the user's answer from their question_stats (this method is super convoluted) | def answer_choice
most_recent_answer = question_stats.selections.order('question_stats.created_at DESC').limit(1).first
# unanswered question, default to 0
return false if most_recent_answer.blank?
# chose combo, so choose the combo
if most_recent_answer.combo?
return 'Combo' if most_recent_answer.selected?
return false # the person did not select anything so return 0
end
# choose good, so must find the bundle the user selected
if most_recent_answer.good?
last_time_chose_combo = question_stats.combo.order('question_stats.created_at DESC').limit(1).first
# only look at goods chosen after the last time a combo was chosen
candidates = if last_time_chose_combo.blank?
question_stats.good.order('question_stats.created_at DESC')
else
question_stats.good.created_after(last_time_chose_combo.created_at).order('question_stats.created_at DESC')
end
# find value of the last time each good was selected (but not necessarily true)
selected_goods = {}
candidates.each do |candidate|
selected_good = candidate.good_number
if selected_goods[selected_good].blank?
selected_goods[selected_good] = candidate
end
end
# the actual goods that were selected and whose values are true
chosen_good_numbers = []
selected_goods.each do |k,v|
chosen_good_numbers.push(k) if v.selected?
end
return false if chosen_good_numbers.empty?
return chosen_good_numbers.sort
end
# should never be reached, sanity check
raise Exception.new('Something went wrong with this method, fix it')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def evaluation\n responses = self.user_survey_responses\n correct_answers = 0.0\n responses.each do |response|\n answer = Answer.find(response.answer_id)\n correct_answers += 1 if answer.correct\n end\n if self.grade.nil?\n self.grade = Grade.create score: 0, gradable: self, user_id: ... | [
"0.60921997",
"0.5995304",
"0.5922094",
"0.5890159",
"0.58310676",
"0.5801553",
"0.5778569",
"0.5728722",
"0.5722945",
"0.5717269",
"0.5703468",
"0.56971025",
"0.56855345",
"0.567465",
"0.5656992",
"0.56567484",
"0.5651316",
"0.5649905",
"0.5641304",
"0.5634704",
"0.5615481",... | 0.51271373 | 96 |
optimal_answer should not take into account the beta timer | def optimal_answer?
answer_value == optimal_value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def best_option\n ab_test_options.reject { |opt| opt.value_times_rate.nan? }.max_by(&:value_times_rate)\n end",
"def reward\n -queue.sum.to_f if feasible?\n end",
"def who_is_beta\n fairness = fairness_level_comparison\n if fairness < 0\n -1\n elsif fairness > 0\n 1\n else\n ... | [
"0.67106336",
"0.59986466",
"0.59981275",
"0.59810185",
"0.5925924",
"0.58681947",
"0.58633465",
"0.5813265",
"0.57892674",
"0.5729053",
"0.5719254",
"0.5698671",
"0.56877",
"0.5663744",
"0.5661667",
"0.56558716",
"0.5614015",
"0.56001854",
"0.5563458",
"0.5551056",
"0.554348... | 0.7185474 | 0 |
is the combo an optimal solution? | def combo_optimal?
optimal_value == combo_witheffect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def valid_combinations\n\t\treturn @@valid_combinations\n\tend",
"def affordable_combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v <= to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"You can't afford anything...\" end\n end",
"def combo_match(comb... | [
"0.6434189",
"0.6362694",
"0.6347652",
"0.62968034",
"0.6276907",
"0.6273075",
"0.6244529",
"0.6214982",
"0.617353",
"0.6166048",
"0.61658174",
"0.61523706",
"0.61380625",
"0.61331844",
"0.61323303",
"0.61092186",
"0.60968673",
"0.6094347",
"0.6080268",
"0.6071504",
"0.606713... | 0.7086058 | 0 |
======= Methods for stats ========= | def beta_question?
!display_timer?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stats; end",
"def stats; end",
"def stats\n end",
"def stats\n end",
"def stats\n \n end",
"def stats\n ## TODO:\n end",
"def statistics; end",
"def quick_stats\n\tend",
"def statistics\n super\n end",
"def statistics\n super\n end",
"def statistics\n super\n ... | [
"0.90841573",
"0.90841573",
"0.88460314",
"0.88460314",
"0.86697096",
"0.8660321",
"0.86130625",
"0.78728575",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",
"0.78513896",... | 0.0 | -1 |
either good or combo (or blank) | def initial_selection
first_good = question_stats.ascending.good_selected.first
first_combo = question_stats.ascending.combo_selected.first
if first_good || first_combo
[first_good, first_combo].find_all{ |selection| !selection.nil? }
.sort_by(&:created_at).first
.stat_type
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chosen_baptized_at_home_parish?\n show_empty_radio == 1 || show_empty_radio == 2\n end",
"def chosen_baptized_catholic?\n show_empty_radio == 2\n end",
"def combo_optimal?\n optimal_value == combo_witheffect\n end",
"def combo_validation(combo)\n combo.each do |word|\n next if %w[... | [
"0.61969805",
"0.60381025",
"0.59591585",
"0.5902734",
"0.58157474",
"0.58157474",
"0.57889754",
"0.57162756",
"0.5617194",
"0.55109763",
"0.5507626",
"0.547436",
"0.54667026",
"0.54625577",
"0.5448462",
"0.5435374",
"0.5435374",
"0.543265",
"0.54262674",
"0.53957635",
"0.537... | 0.5690404 | 8 |
options: precision: :default to not round the overall time | def overall_time(options = {})
options[:precision] ||= 2
if answer && time_started
if options[:precision] != :default
(answer.created_at - time_started).round(options[:precision])
else
(answer.created_at - time_started)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_formatting_time_according_to_precision_coerced\n skip unless @connection # Avoids arunit2 suite run errors.\n @connection.create_table(:foos, force: true) do |t|\n t.time :start, precision: 0\n t.time :finish, precision: 4\n end\n time = ::Time.utc(2000, 1, 1, 12, 30, 0, 999999)\n ... | [
"0.73093843",
"0.7188099",
"0.6860276",
"0.66314644",
"0.6630745",
"0.6592399",
"0.6592399",
"0.6496576",
"0.6496576",
"0.64288455",
"0.6381482",
"0.6341246",
"0.6273279",
"0.62551934",
"0.62445325",
"0.6232454",
"0.622318",
"0.6183247",
"0.6175657",
"0.6126549",
"0.6117811",... | 0.7505495 | 0 |
duplicated logic from optimal_value, didn't want to change implementation of optimal_value because didn't write tests :(:( | def optimal_value_from_bundles_shown(bundles = bundles_shown)
max = -99999 # really small number
# go through single goods
goods.keys.each do |k|
if max < bundle([k])
max = bundle([k])
end
end
# go through bundles
bundles.each do |b|
if max < bundle(b)
max = bundle(b)
end
end
# go through combo
if combo_seen?(bundles) && max < combo_witheffect
max = combo_witheffect
end
max
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optimal_answer?\n \tanswer_value == optimal_value\n end",
"def optimize\n operand\n end",
"def optimize\n operand\n end",
"def optimize(weight)\r\n return 0 if weight <= 0\r\n\r\n best = nil\r\n $items.each do |item|\r\n c = optimize(weight - item.weigh... | [
"0.6443526",
"0.6361533",
"0.6303989",
"0.6282974",
"0.623631",
"0.6221207",
"0.6215177",
"0.6184556",
"0.6129297",
"0.6116088",
"0.6112406",
"0.61082226",
"0.61048883",
"0.6087058",
"0.6086935",
"0.6037444",
"0.6037444",
"0.60132796",
"0.5939835",
"0.5935104",
"0.5932229",
... | 0.0 | -1 |
this method belongs in QuestionStat | def extract_bundles(statements)
statements.map { |s| s.delete QuestionStat::STATEMENT_SHOWN_PREFIX }.uniq
.map { |bundle_string| bundle_string.split(",").map(&:to_i).sort }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def question\n self.question\n end",
"def question\n answer.question\n end",
"def similar_questions\n\n end",
"def questions\n \n end",
"def info() quiz_question.info end",
"def skier_quest; end",
"def view_completed_question\n nil\n end",
"def view_completed_question\n nil\n end... | [
"0.6662839",
"0.63939214",
"0.6391877",
"0.63903666",
"0.63773966",
"0.61284184",
"0.60931486",
"0.60931486",
"0.60635823",
"0.60184765",
"0.59457606",
"0.5907556",
"0.58966506",
"0.588058",
"0.5865642",
"0.58524114",
"0.5822362",
"0.58152485",
"0.5787463",
"0.5782533",
"0.57... | 0.0 | -1 |
Sets adapter const will append _adapter if needed | def adapter=(adapter_name)
adapter_name = adapter_name.to_s
adapter_name << '_adapter' unless adapter_name =~ /_adapter$/
adapter_const = adapter_name.pascalize
@adapter = AutomationObject::Driver.const_get(adapter_const.to_s)::Driver
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adapter=(adapter)\n Adapter.use = adapter\n end",
"def default_adapter=(adapter); end",
"def default_adapter=(adapter); end",
"def default_adapter=(adapter); end",
"def set_adapter(adapter)\n @instance = adapter\n end",
"def set_adapter\n @adapter = Adapter.find(params[:id])\... | [
"0.8613022",
"0.8281996",
"0.8281996",
"0.8281996",
"0.8104187",
"0.7916334",
"0.7856411",
"0.78472745",
"0.78142387",
"0.7805477",
"0.7603482",
"0.76012754",
"0.7584533",
"0.7584533",
"0.7579596",
"0.75100416",
"0.7499074",
"0.7431436",
"0.74038196",
"0.73958945",
"0.7333091... | 0.70868796 | 27 |
Constructs a new instance. | def initialize(config)
super(config, SERVICE_INFO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Constructs a new instance. | def initialize(config)
super(config, SERVICE_INFO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.79921883",
"0.7854048",
"0.7695342",
"0.76886445",
"0.76153916",
"0.754372",
"0.754092... | 0.0 | -1 |
Constructs a new instance. | def initialize(ruby_values = nil, struct_value = nil)
super(self.class.binding_type, ruby_values, struct_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Constructs a new instance. | def initialize(ruby_values = nil, struct_value = nil)
super(self.class.binding_type, ruby_values, struct_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Converts from a string value (perhaps off the wire) to an instance of this enum type. | def from_string(value)
const_get(value)
rescue NameError
TestStatus.send(:new, 'UNKNOWN', value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n ... | [
"0.7495569",
"0.7495569",
"0.74386185",
"0.7192527",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70865124",
"0.7032917",
"0.7008576",
"0.7008576",
"0.6892211",
"0.68670857",
"0.68670857",
"0.6845763",
"0.67862046",
"0.67834616",
"0.6... | 0.67317176 | 21 |
Constructs a new instance. | def initialize(value, unknown = nil)
super(self.class.binding_type, value, unknown)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.79921883",
"0.7854048",
"0.7695342",
"0.76886445",
"0.76153916",
"0.754372",
"0.754092... | 0.0 | -1 |
Converts from a string value (perhaps off the wire) to an instance of this enum type. | def from_string(value)
const_get(value)
rescue NameError
MessageStatus.send(:new, 'UNKNOWN', value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n ... | [
"0.7493947",
"0.7493947",
"0.7436984",
"0.7192308",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7085152",
"0.7032823",
"0.7008514",
"0.7008514",
"0.68929034",
"0.684477",
"0.6785868",
"0.6783008",
"0.67318434",
"0.67318434",
"0.662472",
... | 0.68672293 | 16 |
Constructs a new instance. | def initialize(value, unknown = nil)
super(self.class.binding_type, value, unknown)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Constructs a new instance. | def initialize(config)
super(config, SERVICE_INFO)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Constructs a new instance. | def initialize(ruby_values = nil, struct_value = nil)
super(self.class.binding_type, ruby_values, struct_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.79921883",
"0.7854048",
"0.7695342",
"0.76886445",
"0.76153916",
"0.754372",
"0.754092... | 0.0 | -1 |
Constructs a new instance. | def initialize(ruby_values = nil, struct_value = nil)
super(self.class.binding_type, ruby_values, struct_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Constructs a new instance. | def initialize(ruby_values = nil, struct_value = nil)
super(self.class.binding_type, ruby_values, struct_value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Converts from a string value (perhaps off the wire) to an instance of this enum type. | def from_string(value)
const_get(value)
rescue NameError
DNSServerMode.send(:new, 'UNKNOWN', value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n ... | [
"0.7495569",
"0.7495569",
"0.74386185",
"0.7192527",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70865124",
"0.7032917",
"0.7008576",
"0.7008576",
"0.6892211",
"0.68670857",
"0.68670857",
"0.6845763",
"0.67862046",
"0.67834616",
"0.6... | 0.5926311 | 66 |
Constructs a new instance. | def initialize(value, unknown = nil)
super(self.class.binding_type, value, unknown)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.79921883",
"0.7854048",
"0.7695342",
"0.76886445",
"0.76153916",
"0.754372",
"0.754092... | 0.0 | -1 |
Converts from a string value (perhaps off the wire) to an instance of this enum type. | def from_string(value)
const_get(value)
rescue NameError
TestStatus.send(:new, 'UNKNOWN', value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n ... | [
"0.7493947",
"0.7493947",
"0.7436984",
"0.7192308",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7087891",
"0.7085152",
"0.7032823",
"0.7008514",
"0.7008514",
"0.68929034",
"0.68672293",
"0.68672293",
"0.684477",
"0.6785868",
"0.6783008",
"0.662472",
... | 0.67318434 | 20 |
Constructs a new instance. | def initialize(value, unknown = nil)
super(self.class.binding_type, value, unknown)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.8045547",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.80440617",
"0.7991461",
"0.785467",
"0.7695489",
"0.7688422",
"0.7615257",
"0.754397",
"0.754222... | 0.0 | -1 |
Converts from a string value (perhaps off the wire) to an instance of this enum type. | def from_string(value)
const_get(value)
rescue NameError
MessageStatus.send(:new, 'UNKNOWN', value)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n const_get(value)\n rescue NameError\n Type.send(:new, 'UNKNOWN', value)\n end",
"def from_string(value)\n ... | [
"0.7495569",
"0.7495569",
"0.74386185",
"0.7192527",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70895386",
"0.70865124",
"0.7032917",
"0.7008576",
"0.7008576",
"0.6892211",
"0.6845763",
"0.67862046",
"0.67834616",
"0.67317176",
"0.67317176",
"0.6... | 0.68670857 | 15 |
Constructs a new instance. | def initialize(value, unknown = nil)
super(self.class.binding_type, value, unknown)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new; end",
"def new()\n #This is a... | [
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.80456895",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.8043627",
"0.79921883",
"0.7854048",
"0.7695342",
"0.76886445",
"0.76153916",
"0.754372",
"0.754092... | 0.0 | -1 |
You can create a new url sending json requests like: curl X POST d "original_link= When deployed, replace localhost:3000 with the correct | def create
@url = request.format.json? ? Url.new(original_link: params[:original_link]) : Url.new(url_params)
respond_to do |format|
if @url.save
format.html { redirect_to @url, notice: 'URL was successfully created.' }
format.json { render :show, status: :created, location: @url }
else
format.html { render :new }
format.json { render json: @url.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_links(json) end",
"def shorten_link(url)\n uri = URI.parse(\"http://localhost:3000/shorten\")\n params = {\"url\": url}\n uri.query = URI.encode_www_form(params)\n JSON.parse(Net::HTTP.get(uri))\nend",
"def test_should_create_link_via_API_JSON\r\n get \"/logout\"\r\n post \"/links.json\", ... | [
"0.65737766",
"0.6375937",
"0.6261237",
"0.6152084",
"0.6150196",
"0.6119849",
"0.6116279",
"0.61070454",
"0.6029699",
"0.5989601",
"0.5986795",
"0.5891399",
"0.5886601",
"0.5865979",
"0.58451164",
"0.5762698",
"0.5749765",
"0.57045716",
"0.5693671",
"0.5678255",
"0.5646607",... | 0.53292066 | 66 |
GET /tidbits GET /tidbits.json | def index
@tidbits = Tidbit.all
@tid_ruby = Tidbit.where(subject: "ruby")
@tid_positive = Tidbit.where(subject: "positive")
@tid_ee = Tidbit.where(subject: "ee")
@tid_random = Tidbit.where(subject: "random")
@tid_poker = Tidbit.where(subject: "poker")
@tid_rails = Tidbit.where(subject: "rails")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end",
"def create\n @tidbit = Tidbit.new(tidbit_params)\n\n respond_to do |format|\n if @tidbit.save\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' }\n format.json { render :show, status: :crea... | [
"0.61573625",
"0.5871873",
"0.5687385",
"0.5572308",
"0.5497737",
"0.5352217",
"0.5331107",
"0.53251296",
"0.5304984",
"0.52813184",
"0.5244673",
"0.51920235",
"0.5182054",
"0.51745886",
"0.51743996",
"0.51705015",
"0.51435184",
"0.51237476",
"0.5111508",
"0.5111431",
"0.5109... | 0.6080764 | 1 |
GET /tidbits/1 GET /tidbits/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end",
"def create\n @tidbit = Tidbit.new(tidbit_params)\n\n respond_to do |format|\n if @tidbit.save\n format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' }\n format.json { render :show, status: :crea... | [
"0.6305381",
"0.59881765",
"0.591504",
"0.57948226",
"0.57537085",
"0.56509244",
"0.5624073",
"0.55232847",
"0.5493613",
"0.54709756",
"0.54389286",
"0.53930604",
"0.5369768",
"0.53646183",
"0.53584266",
"0.5316135",
"0.5312515",
"0.5312228",
"0.52966183",
"0.52955174",
"0.52... | 0.0 | -1 |
POST /tidbits POST /tidbits.json | def create
@tidbit = Tidbit.new(tidbit_params)
respond_to do |format|
if @tidbit.save
format.html { redirect_to @tidbit, notice: 'Tidbit was successfully created.' }
format.json { render :show, status: :created, location: @tidbit }
else
format.html { render :new }
format.json { render json: @tidbit.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tidbit_params\n params.require(:tidbit).permit(:body)\n end",
"def set_tidbit\n @tidbit = Tidbit.find(params[:id])\n end",
"def create_twit(twit)\n RestClient.post configuration.base_url + '/twits',\n { twit: twit }.to_json,\n content_type: :js... | [
"0.67257637",
"0.6064634",
"0.5403469",
"0.5387822",
"0.53811026",
"0.529706",
"0.5264566",
"0.52413356",
"0.52254593",
"0.51839864",
"0.51720685",
"0.5170495",
"0.51580316",
"0.5088447",
"0.50763184",
"0.50667524",
"0.50548977",
"0.50353134",
"0.5028679",
"0.5028118",
"0.502... | 0.71434623 | 0 |
PATCH/PUT /tidbits/1 PATCH/PUT /tidbits/1.json | def update
respond_to do |format|
if @tidbit.update(tidbit_params)
format.html { redirect_to @tidbit, notice: 'Tidbit was successfully updated.' }
format.json { render :show, status: :ok, location: @tidbit }
else
format.html { render :edit }
format.json { render json: @tidbit.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def update_tenant_circle(args... | [
"0.6324299",
"0.6308433",
"0.61281043",
"0.5956387",
"0.59438103",
"0.5908949",
"0.5774309",
"0.5774309",
"0.57697207",
"0.5757143",
"0.57471025",
"0.5738746",
"0.5734689",
"0.5717169",
"0.5701462",
"0.5694921",
"0.5692678",
"0.5688012",
"0.56864333",
"0.56824577",
"0.5675939... | 0.6553318 | 0 |
DELETE /tidbits/1 DELETE /tidbits/1.json | def destroy
@tidbit.destroy
respond_to do |format|
format.html { redirect_to tidbits_url, notice: 'Tidbit was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
... | [
"0.7187074",
"0.7007323",
"0.6776838",
"0.67191",
"0.6694537",
"0.6683867",
"0.66341543",
"0.6589798",
"0.6554202",
"0.65271866",
"0.6526255",
"0.6442809",
"0.63999116",
"0.63999116",
"0.63999116",
"0.63999116",
"0.639556",
"0.63699317",
"0.6365324",
"0.63343275",
"0.63343275... | 0.7125573 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_tidbit
@tidbit = Tidbit.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163821",
"0.6045432",
"0.5945441",
"0.5916224",
"0.58894575",
"0.5834073",
"0.57764685",
"0.5702474",
"0.5702474",
"0.5653258",
"0.56211996",
"0.54235053",
"0.5410683",
"0.5410683",
"0.5410683",
"0.53948104",
"0.5378064",
"0.5356684",
"0.53400385",
"0.53399503",
"0.533122... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def tidbit_params
params.require(:tidbit).permit(:body)
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.69802505",
"0.6781974",
"0.67470175",
"0.67430073",
"0.67350477",
"0.6593221",
"0.6504263",
"0.64988977",
"0.6481794",
"0.64800006",
"0.64568025",
"0.64411247",
"0.6379476",
"0.63765615",
"0.6368045",
"0.6320141",
"0.6300363",
"0.6300057",
"0.62952244",
"0.6294712",
"0.629... | 0.0 | -1 |
Setup the database migrations | def copy_migrations
rake 'hyrax:install:migrations'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n run_migrations pending_migrations, :up\n end",
"def run\n load_migrations\n @migrations.each do |mig_class, version|\n mig_class.up\n # Add it to the schema_migrations table as well\n # This will fail if auto-migrations is only and always used,\n # as t... | [
"0.74758285",
"0.7456984",
"0.74459994",
"0.7405735",
"0.7358846",
"0.7246884",
"0.7202893",
"0.7149887",
"0.7090692",
"0.7038769",
"0.70298225",
"0.6974153",
"0.6974153",
"0.6860222",
"0.6855415",
"0.68009853",
"0.6789679",
"0.6785831",
"0.6687629",
"0.6627187",
"0.65969884"... | 0.61382854 | 60 |
Add behaviors to the user model | def inject_user_behavior
file_path = "app/models/#{model_name.underscore}.rb"
if File.exist?(file_path)
inject_into_file file_path, after: /include Hydra\:\:User.*$/ do
"\n # Connects this user object to Hyrax behaviors." \
"\n include Hyrax::User" \
"\n include Hyrax::UserUsageStats\n"
end
else
puts " \e[31mFailure\e[0m Hyrax requires a user object. This " \
"generator assumes that the model is defined in the file " \
"#{file_path}, which does not exist. If you used a different " \
"name, please re-run the generator and provide that name as an " \
"argument. Such as \b rails -g hyrax:models client"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def person_extra_methods\n include Domainify::InstanceMethods\n #confirm account id is correct on create of user\n after_create :update_user_account_id\n end",
"def attribute_change_for_model_by_user(action, ownable, trackable, user, notes=nil)\n Attributable::Activity.create!({ action: ac... | [
"0.5595829",
"0.53345513",
"0.53054124",
"0.5245441",
"0.52158254",
"0.5152075",
"0.51172626",
"0.5111411",
"0.5107016",
"0.50877917",
"0.5066574",
"0.5065238",
"0.5052048",
"0.498654",
"0.49776256",
"0.49758825",
"0.4968686",
"0.49598297",
"0.4959245",
"0.49569952",
"0.49556... | 0.59222883 | 0 |
GET /ajaxes GET /ajaxes.json | def index
@ajaxes = Ajax.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @requests = Request.all\n\n render json: @requests\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n ... | [
"0.6412622",
"0.6380785",
"0.6371203",
"0.6301283",
"0.6256182",
"0.6256182",
"0.6250867",
"0.6239266",
"0.6238073",
"0.6238073",
"0.6231606",
"0.6153148",
"0.6152899",
"0.6141373",
"0.6139688",
"0.61334676",
"0.61307216",
"0.6124237",
"0.61040074",
"0.609613",
"0.6091262",
... | 0.6882418 | 0 |
GET /ajaxes/1 GET /ajaxes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @ajaxes = Ajax.all\n end",
"def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @... | [
"0.65611947",
"0.6251226",
"0.61182296",
"0.61097974",
"0.6085957",
"0.6059036",
"0.60453117",
"0.60371166",
"0.60371166",
"0.60125023",
"0.59928226",
"0.59915906",
"0.5984348",
"0.59730905",
"0.5937941",
"0.593581",
"0.58609205",
"0.58459353",
"0.5835623",
"0.5821474",
"0.58... | 0.0 | -1 |
POST /ajaxes POST /ajaxes.json | def create
@ajax = Ajax.new(ajax_params)
respond_to do |format|
if @ajax.save
format.html { redirect_to @ajax, notice: 'Ajax was successfully created.' }
format.json { render action: 'show', status: :created, location: @ajax }
else
format.html { render action: 'new' }
format.json { render json: @ajax.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def POST; end",
"def index\n @ajaxes = Ajax.all\n end",
"def post(*args)\n request :post, *args\n end",
"def xhr_post *args, params_or_action\n Presto::Browser.new(@controller, env, 'POST', true).body *args, params_or_action\n end",
"def post(target, data, &block)\n xhr = XMLHttpRe... | [
"0.58743423",
"0.5765101",
"0.5680591",
"0.56796104",
"0.5574302",
"0.5567166",
"0.5554237",
"0.55435354",
"0.55262554",
"0.54625326",
"0.54467887",
"0.5423682",
"0.5418343",
"0.5415121",
"0.5409295",
"0.54090935",
"0.5404913",
"0.5400739",
"0.5399805",
"0.53854465",
"0.53492... | 0.5573877 | 5 |
PATCH/PUT /ajaxes/1 PATCH/PUT /ajaxes/1.json | def update
respond_to do |format|
if @ajax.update(ajax_params)
format.html { redirect_to @ajax, notice: 'Ajax was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @ajax.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch!\n request! :patch\n end",
"def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end",
"def api_patch(path, data = {}... | [
"0.6707051",
"0.66654325",
"0.6388448",
"0.62132215",
"0.61397624",
"0.61332035",
"0.61332035",
"0.6101988",
"0.6101988",
"0.6051678",
"0.6050862",
"0.60144687",
"0.60122615",
"0.5931832",
"0.589355",
"0.58600754",
"0.58600754",
"0.5836773",
"0.5833708",
"0.57784426",
"0.5775... | 0.65871906 | 2 |
DELETE /ajaxes/1 DELETE /ajaxes/1.json | def destroy
@ajax.destroy
respond_to do |format|
format.html { redirect_to ajaxes_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete\n render json: Post.delete(params[\"id\"])\n end",
"def delete!\n request! :delete\n end",
"def delete\n request(:delete)\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def delete\n supprimer... | [
"0.7015308",
"0.6910816",
"0.686385",
"0.6863849",
"0.6848045",
"0.6825333",
"0.6776032",
"0.6770547",
"0.6770547",
"0.6770547",
"0.6770547",
"0.67358655",
"0.67358655",
"0.67151934",
"0.66826683",
"0.66701657",
"0.6666092",
"0.6639765",
"0.6622433",
"0.66132575",
"0.65961075... | 0.7324153 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_ajax
@ajax = Ajax.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.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def ajax_params
# params[:ajax]
params.require(:ajax).permit(topic_attributes:[:name,:description])
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.69795185",
"0.6782116",
"0.6745877",
"0.6742722",
"0.67368543",
"0.65932566",
"0.65048057",
"0.6497429",
"0.6481512",
"0.6478456",
"0.6455591",
"0.64391",
"0.6379068",
"0.6376498",
"0.636542",
"0.632084",
"0.630046",
"0.62998945",
"0.62943697",
"0.6293775",
"0.629097",
"... | 0.0 | -1 |
map will change the return type according to the operation and each won't functions or methods | def cheap_discounts
# puts 'kanjus makkhi chus dont come again'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def map; end",
"def map\n raise NotImplementedError\n end",
"def map!\n end",
"def map(*args, &blk) values.map(*args, &blk) ; end",
"def fmap(*)\n raise NotImplementedError\n end",
"def map\n end",
"def map\n end",
"def map(value, method)\n value.map do |item|\n ... | [
"0.7113912",
"0.7075217",
"0.69523174",
"0.68413",
"0.6831794",
"0.67653304",
"0.67653304",
"0.6755617",
"0.67222744",
"0.66383195",
"0.663169",
"0.6607694",
"0.66030395",
"0.65635604",
"0.6562311",
"0.6562311",
"0.6553749",
"0.6553749",
"0.6551459",
"0.65028536",
"0.6480778"... | 0.0 | -1 |
Default method, subclasses must override this | def run
super
res = []
entity_name = _get_entity_name
entity_type = _get_entity_type_string
# skip cdns
if !get_cdn_domains.select{ |x| entity_name =~ /#{x}/}.empty? ||
!get_internal_domains.select{ |x| entity_name =~ /#{x}/}.empty?
_log "This domain resolves to a known cdn or internal host, skipping"
return
end
# check that it resolves
resolves_to = resolve_names entity_name
unless resolves_to.first
_log "No resolution for this record, unable to check"
return
end
# We use their DNS servers to query
nameservers= ['185.228.168.168', '185.228.168.169']
_log "Querying #{nameservers}"
dns_obj = Resolv::DNS.new(nameserver: nameservers)
# Try twice, just in case (avoid FP's)
res = dns_obj.getaddresses(entity_name)
res.concat(dns_obj.getresources(entity_name, Resolv::DNS::Resource::IN::CNAME)).flatten
# Detected only if there's no resolution
if res.any?
_log "Resolves to #{res.map{|x| "#{x.to_s}" }}. Seems we're good!"
else
source = "CleanBrowsing"
description = "The Cleanbrowsing DNS security filter focuses on restricting access " +
"to malicious activity. It blocks phishing, spam and known malicious domains."
_create_linked_issue("blocked_by_dns", {
status: "confirmed",
additional_description: description,
source: source,
proof: "Resolved to the following address(es) outside of #{source} (#{nameservers}): #{resolves_to.join(", ")}",
to_reproduce: "dig #{entity_name} @#{nameservers.first}",
references: [{ type: "remediation", uri: "https://cleanbrowsing.org/" }]
})
# Also store it on the entity
blocked_list = @entity.get_detail("suspicious_activity_detected") || []
@entity.set_detail("suspicious_activity_detected", blocked_list.concat([{source: source}]))
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def overrides; end",
"def custom; end",
"def custom; end",
"def default; end",
"def default; end",
"def private; end",
"def special\n override\n end",
"def defaults\n super\n end",
"def implementation; end",
"def implementation; end",
"def default\n end",
"def defaults; end",
... | [
"0.7415348",
"0.73554313",
"0.73554313",
"0.6991004",
"0.6991004",
"0.69613177",
"0.69572926",
"0.6824949",
"0.6801543",
"0.6801543",
"0.67361915",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0.66934764",
"0... | 0.0 | -1 |
Purges a queue (removes all messages from it) | def purge
@channel.queue_purge(@name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def purge\n @queue.purge\n end",
"def purge\n @queue.purge\n end",
"def purge\n @queue.purge\n end",
"def purge\n t = Time.now\n expired = []\n @queue.each do |identity,worker|\n expired << identity if t > worker.expiry\n end\n expired.each do |identity|\n @qu... | [
"0.823347",
"0.823347",
"0.823347",
"0.7661655",
"0.7607196",
"0.74705327",
"0.73918253",
"0.7191478",
"0.7097893",
"0.70909727",
"0.7077912",
"0.7024354",
"0.7024354",
"0.701208",
"0.7006324",
"0.70051193",
"0.6931408",
"0.68439126",
"0.68298584",
"0.6818685",
"0.680437",
... | 0.7851776 | 3 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.