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 |
|---|---|---|---|---|---|---|
Return a string representation of this element | def to_s
@location
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string\n element().to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def inspect\n \"<#{self.class.to_s} \" +\n ... | [
"0.8632077",
"0.7785022",
"0.7684095",
"0.7684095",
"0.7684095",
"0.7684095",
"0.7640589",
"0.76188034",
"0.756505",
"0.75623024",
"0.7539377",
"0.7539377",
"0.7539377",
"0.7539377",
"0.75355273",
"0.75067985",
"0.749463",
"0.749463",
"0.7483942",
"0.74585253",
"0.7452343",
... | 0.0 | -1 |
Return a string representation of this element | def to_s
''
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def string\n element().to_s\n end",
"def to_s\n self.inspect\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def to_s\n @string\n end",
"def inspect\n \"<#{self.class.to_s} \" +\n ... | [
"0.8632077",
"0.7785022",
"0.7684095",
"0.7684095",
"0.7684095",
"0.7684095",
"0.7640589",
"0.76188034",
"0.756505",
"0.75623024",
"0.7539377",
"0.7539377",
"0.7539377",
"0.7539377",
"0.75355273",
"0.75067985",
"0.749463",
"0.749463",
"0.7483942",
"0.74585253",
"0.7452343",
... | 0.0 | -1 |
GET /moto_town_type_sections/1 GET /moto_town_type_sections/1.xml | def show
@moto_town_type_section = MotoTownTypeSection.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @moto_town_type_section }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @moto_town_type = MotoTownType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_town_type }\n end\n end",
"def new\n @moto_town_type_section = MotoTownTypeSection.new\n\n respond_to do |format|\n format.html ... | [
"0.6410657",
"0.6121201",
"0.61110586",
"0.58910537",
"0.58890164",
"0.5766897",
"0.56101555",
"0.5578026",
"0.55432886",
"0.55404",
"0.5511077",
"0.54580426",
"0.5436334",
"0.5423143",
"0.5412325",
"0.5394979",
"0.53932494",
"0.5386214",
"0.538327",
"0.53808194",
"0.5376658"... | 0.70528156 | 0 |
GET /moto_town_type_sections/new GET /moto_town_type_sections/new.xml | def new
@moto_town_type_section = MotoTownTypeSection.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @moto_town_type_section }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @town_type = TownType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @town_type }\n end\n end",
"def new\n @sections = Section.find(:all) # TODO: refactor so I don't have to repeat this all over the place\n @section = Section.new\n\... | [
"0.70705503",
"0.7017883",
"0.69957775",
"0.69438875",
"0.6862741",
"0.6684419",
"0.6673244",
"0.6642682",
"0.66388464",
"0.66088635",
"0.66041636",
"0.6602552",
"0.660221",
"0.6582961",
"0.6555955",
"0.6547054",
"0.6514139",
"0.65032774",
"0.649748",
"0.645417",
"0.6448629",... | 0.7550682 | 0 |
POST /moto_town_type_sections POST /moto_town_type_sections.xml | def create
@moto_town_type_section = MotoTownTypeSection.new(params[:moto_town_type_section])
respond_to do |format|
if @moto_town_type_section.save
format.html { redirect_to(@moto_town_type_section, :notice => 'Moto town type section was successfully created.') }
format.xml { render :xm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @moto_town_type_section = MotoTownTypeSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_town_type_section }\n end\n end",
"def create\n section_type_ids = params[:site_type].delete(\"section_type_ids\")\n @site_type = Site... | [
"0.586236",
"0.5784784",
"0.5782611",
"0.5682724",
"0.56745535",
"0.5421284",
"0.5376451",
"0.53489655",
"0.5342933",
"0.5312522",
"0.52237123",
"0.5209022",
"0.520739",
"0.5142827",
"0.51299083",
"0.51162195",
"0.502259",
"0.49948132",
"0.49891782",
"0.49881166",
"0.49651694... | 0.6812383 | 0 |
PUT /moto_town_type_sections/1 PUT /moto_town_type_sections/1.xml | def update
@moto_town_type_section = MotoTownTypeSection.find(params[:id])
respond_to do |format|
if @moto_town_type_section.update_attributes(params[:moto_town_type_section])
format.html { redirect_to(@moto_town_type_section, :notice => 'Moto town type section was successfully updated.') }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @moto_town_type = MotoTownType.find(params[:id])\n\n respond_to do |format|\n if @moto_town_type.update_attributes(params[:moto_town_type])\n format.html { redirect_to(@moto_town_type, :notice => 'Moto town type was successfully updated.') }\n format.xml { head :ok }\n e... | [
"0.6236476",
"0.5965204",
"0.59246635",
"0.5835738",
"0.5642118",
"0.56226903",
"0.55969197",
"0.553209",
"0.5526",
"0.5497202",
"0.54889804",
"0.54175436",
"0.53864574",
"0.5331104",
"0.530926",
"0.52695817",
"0.52688193",
"0.5252944",
"0.52405804",
"0.52400905",
"0.5229012"... | 0.69448864 | 0 |
DELETE /moto_town_type_sections/1 DELETE /moto_town_type_sections/1.xml | def destroy
@moto_town_type_section = MotoTownTypeSection.find(params[:id])
@moto_town_type_section.destroy
respond_to do |format|
format.html { redirect_to(moto_town_type_sections_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def destroy\n @domicile_type_section = DomicileTypeSection.find(params[:id])\n @domicile_type_section.destroy\n\n respond_to do |format|\n format.html { redirect_to(domicile_type_sections_url) }\n fo... | [
"0.6800028",
"0.6654538",
"0.6541884",
"0.62746954",
"0.6248408",
"0.6243292",
"0.6207895",
"0.6147249",
"0.6121185",
"0.61195153",
"0.61138713",
"0.6092469",
"0.6078969",
"0.60786504",
"0.6051839",
"0.6051602",
"0.6046867",
"0.60440165",
"0.6036831",
"0.60341156",
"0.6033011... | 0.70586926 | 0 |
Public: Constructor type the type of the difference aws the aws resource that's different (defaults to nil) local the local resource that's difference (defaults to nil) changes an object to describe what changed in a MODIFIED diff (defaults to nil) | def initialize(type, aws = nil, local = nil, changes = nil)
@aws = aws
@local = local
@type = type
@changes = changes
@info_only = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sync_difference(name, diffs)\n aws = Hash[aws_resources.map { |aws| [aws.name, aws] }]\n if diffs.size > 0\n StatusCodes::set_status(StatusCodes::SYNC_DIFFS)\n\n if diffs[0].type == Common::DiffChange::UNMANAGED\n puts diffs[0]\n elsif diffs[0].type == Common... | [
"0.6098897",
"0.6023987",
"0.5947249",
"0.59305453",
"0.57185185",
"0.57029676",
"0.56396174",
"0.5621978",
"0.56114894",
"0.5610009",
"0.55773187",
"0.55632967",
"0.5475869",
"0.54633486",
"0.54534644",
"0.5425305",
"0.5393937",
"0.5389176",
"0.5350846",
"0.53502965",
"0.532... | 0.69121945 | 0 |
Public: A method that produces the string that describes what will be done with new assets. This can be overridden for the case that the ADD case doesn't create the asset. Returns the string describing the action that will be taken. | def add_string
"will be created."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n [\n \"def new\",\n Frontier::RubyRenderer.new(action_contents.join(\"\\n\")).render(1),\n \"end\"\n ].join(\"\\n\")\n end",
"def name\n 'Asset Allocation Reporter'\nend",
"def to_s\n return super.to_s + \", #{@reference_action_def.to_s}\"\n end",
"def to_s\n [\n ... | [
"0.621069",
"0.5758093",
"0.5578523",
"0.55729914",
"0.5512362",
"0.5460891",
"0.5409753",
"0.53220654",
"0.5259352",
"0.52368814",
"0.52326727",
"0.51815176",
"0.51502866",
"0.510962",
"0.51014364",
"0.50924724",
"0.50924724",
"0.50924724",
"0.5089753",
"0.50793034",
"0.5073... | 0.5556815 | 4 |
Public: A method that produces the string that describes what will be done with unmanaged assets. This can be overriden for the case that the UNMANAGED case does not ignore the asset. Returns the string describing the action that will be taken | def unmanaged_string
"is not managed by Cumulus."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_name\n 'unused'\n end",
"def act_smart\n\t\treturn \"DIFF SMART\"\n\tend",
"def source_name\n 'Archives & Manuscripts'\n end",
"def unidentified_command_message\n return \"Hmmm. I can't figure out what that meant. Try */ttt help* for available commands.\"\n end",
"def unused_pr... | [
"0.5154867",
"0.51445025",
"0.5043608",
"0.5021419",
"0.49948102",
"0.49619237",
"0.49117813",
"0.4888666",
"0.4888666",
"0.48791826",
"0.48785725",
"0.4870675",
"0.48639286",
"0.48385644",
"0.48317766",
"0.48278248",
"0.47911265",
"0.4765736",
"0.47593215",
"0.47516915",
"0.... | 0.6442852 | 0 |
return: [ Net::HTTP, Net::HTTP::Get ] | def httpGetRequest( uriStr, headerHash, errorMessage )
uri = URI.parse( uriStr )
begin
https = Net::HTTP.new(uri.host, uri.port)
if ( Net::HTTP.https_default_port == uri.port ) or ( "https" == uri.scheme )
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get url\n net_http_response = self.connection.get url\n [net_http_response.body, net_http_response.code.to_i, net_http_response.message]\n end",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def read_http(url)\n uri = URI(url)\n Net::HTTP.get_response(uri)\nend",
"def ... | [
"0.74638075",
"0.64954025",
"0.64954025",
"0.6301384",
"0.6262205",
"0.6254839",
"0.61910635",
"0.6186759",
"0.6183711",
"0.61768883",
"0.61635554",
"0.6155443",
"0.6097042",
"0.6069148",
"0.60561806",
"0.60522324",
"0.60410756",
"0.6037234",
"0.6022305",
"0.60209644",
"0.598... | 0.6222349 | 6 |
Sets the body and headers for a 404 response. Does not modify the body if already set. | def not_found
self.status = 404
return unless body.empty?
self.body = "Not found: #{request.path}"
headers['Content-Type'] = 'text/plain'
headers['X-Cascade'] = 'pass'
headers['Cache-Control'] = 'nocache'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def not_found\n\t\tself.status = 404\n\t\tself.headers = {}\n\t\tself.content = [\"Nothing Found\"]\n\t\tself\n\tend",
"def custom_404_body\n filename = File.join(root, \"404.html\")\n\n File.exist?(filename) ? File.binread(filename) : nil\n end",
"def not_found(body = nil)\n error(404, b... | [
"0.6796199",
"0.66375124",
"0.6550994",
"0.64739704",
"0.61205274",
"0.6110669",
"0.6070675",
"0.6052638",
"0.6021205",
"0.6012376",
"0.6005887",
"0.6003645",
"0.5989808",
"0.5989323",
"0.5977975",
"0.5968601",
"0.59672993",
"0.5966939",
"0.596244",
"0.596244",
"0.59554714",
... | 0.7161122 | 0 |
Sets the headers and status code for a redirection to a given URL | def redirect(url)
headers['Location'] = url
self.status = 302
raise FinishRequest
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_to(url)\n prepare_response do\n res['location'] = url\n res.status = 302\n end\n end",
"def give_301(response, url)\n\theaders = response.headers\n\tresponse.status = 301\n\tresponse.headers[\"Location\"] =url\n end",
"def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP... | [
"0.75335836",
"0.7454845",
"0.74492705",
"0.7292654",
"0.72904956",
"0.72302026",
"0.71660477",
"0.7057154",
"0.6858331",
"0.6843109",
"0.68392885",
"0.6802431",
"0.6791874",
"0.6683707",
"0.66815764",
"0.66751736",
"0.66620564",
"0.66562957",
"0.6656202",
"0.6590055",
"0.656... | 0.76086587 | 0 |
Add a conservative cache control policy to reduce load on requests served with "?1234567890" style timestamp query strings. | def add_cache_control
return if request.query_string.to_i == 0
headers['Cache-Control'] ||= 'public, max-age=300'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cache_control; end",
"def _cache_control; end",
"def set_cache_control\n expires_in(1.hour, :public => true)\n end",
"def cache_control(opts)\n return if !App.production?\n etag(opts[:etag]) if opts[:etag]\n last_modified(opts[:last_modified]) if opts[:last_modified]\n if opts... | [
"0.64643335",
"0.6134025",
"0.60310304",
"0.57936525",
"0.5646732",
"0.56416833",
"0.5597701",
"0.55790496",
"0.5555045",
"0.55462354",
"0.5539519",
"0.5528564",
"0.5528564",
"0.55220866",
"0.54930776",
"0.5487328",
"0.5435769",
"0.54256475",
"0.54142684",
"0.54061127",
"0.53... | 0.6870275 | 0 |
The "natural" order of properties is that 'ensure' comes before anything else, then alphabetically sorted by the property name. | def <=>(that)
[self.property == 'ensure' ? 0 : 1, self.property] <=>
[that.property == 'ensure' ? 0 : 1, that.property]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order_properties(properties)\n properties.select(&:required).sort_by(&:name) +\n properties.reject(&:required).reject(&:output).sort_by(&:name) +\n properties.select(&:output).sort_by(&:name)\n end",
"def sorted_properties\n properties.sort {|a,b| \n case\n ... | [
"0.71609133",
"0.6505339",
"0.63960755",
"0.6347916",
"0.6094283",
"0.5989457",
"0.59874225",
"0.58801395",
"0.5662207",
"0.55675507",
"0.5526729",
"0.552253",
"0.5500205",
"0.54916126",
"0.54532063",
"0.54532063",
"0.5446616",
"0.5446616",
"0.5446616",
"0.54348016",
"0.54007... | 0.5175858 | 33 |
TODO: additional checks has issues enabled deleteBranchOnMerge mergeCommitAllowed (do we want this on or off?) squashMergeAllowed (do we want this on or off?) | def report
{
organization: organization,
name: repo_name,
default_branch: default_branch,
url: repo_url,
status: status,
report: all_checks_result
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_valid_branch_merge\n # trying to merge backwards with a direct ancestor of the current directory.\n # that's crazy.\n if ancestor == remote\n raise abort(\"can't merge with ancestor\")\n elsif ancestor == @local_parent\n # If we're at... | [
"0.63244814",
"0.61820364",
"0.6142423",
"0.60815936",
"0.60264945",
"0.5957613",
"0.5955045",
"0.59414005",
"0.5908702",
"0.58998835",
"0.5869436",
"0.581092",
"0.5756568",
"0.57168806",
"0.5716041",
"0.57148206",
"0.57098365",
"0.56829035",
"0.56822443",
"0.5681316",
"0.564... | 0.0 | -1 |
GET /conversations GET /conversations.json Get the list of conversations for the authenticated user | def index
respond_to do |format|
# GET parameters
@count = params.has_key?(:count) ? ApplicationHelper.checkEmptyValue(params[:count]) : 20
@count = @count.to_i > 200 ? 200 : @count
@since_id = params.has_key?(:since_id) ? ApplicationHelper.checkEmptyValue(params[:since_id]) : 0
@max_i... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @conversations = current_user.conversations\n end",
"def conversation\n @messages = Message.get_conversation(current_user, params[:user_id])\n render json: @messages, each_serializer: MessageConversationSerializer\n end",
"def conversations\n object.conversations.map {|a| Conver... | [
"0.81192344",
"0.7901342",
"0.7748754",
"0.77476454",
"0.77227867",
"0.77136713",
"0.7683399",
"0.76628935",
"0.75821346",
"0.74895835",
"0.7401298",
"0.73312616",
"0.7291986",
"0.7243317",
"0.72406256",
"0.7239554",
"0.71694195",
"0.71463865",
"0.7089719",
"0.7028547",
"0.70... | 0.62076735 | 64 |
GET /conversations/1 GET /conversations/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_conversation(id)\n get(\"conversations/#{id}\")\n end",
"def index\n @conversations = Conversation.all\n\n render json: @conversations\n end",
"def getConversations\n @conversations = Conversation.all.select(\"name\").map(&:name)\n\n respond_to do |format|\n format.json {render :j... | [
"0.7771788",
"0.7663618",
"0.76222694",
"0.75696534",
"0.75553274",
"0.74944204",
"0.7328807",
"0.72793543",
"0.726392",
"0.726392",
"0.72332525",
"0.72017163",
"0.72017163",
"0.7148509",
"0.70810086",
"0.70574474",
"0.7020698",
"0.6990737",
"0.6943125",
"0.6915656",
"0.68988... | 0.0 | -1 |
POST /conversations POST /conversations.json | def create
@conversation = Conversation.new(conversation_params)
respond_to do |format|
if @conversation.save
format.html { redirect_to @conversation, notice: 'Conversation was successfully created.' }
format.json { render action: 'show', status: :created, location: @conversation }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_conversation(data)\n # required_fields = [\"subject\", \"type\", \"mailboxId\", \"status\", \"customer\", \"threads\"]\n\n post(\"conversations\", { body: data })\n\n last_response.headers[\"Resource-ID\"]\n end",
"def create\n @conversation = Conversation.new(conversation_params)\n\n ... | [
"0.71955353",
"0.703103",
"0.69663835",
"0.69564104",
"0.6926141",
"0.679488",
"0.67443806",
"0.67108154",
"0.67108154",
"0.6667241",
"0.6587066",
"0.65821064",
"0.6567818",
"0.6417548",
"0.64116687",
"0.6382436",
"0.6373391",
"0.63626206",
"0.63482416",
"0.6317586",
"0.63079... | 0.66170293 | 10 |
PATCH/PUT /conversations/1 PATCH/PUT /conversations/1.json | def update
respond_to do |format|
if @conversation.update(conversation_params)
format.html { redirect_to @conversation, notice: 'Conversation was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_conversation(id, data)\n put(\"conversations/#{id}\", { body: data })\n end",
"def update_conversation(id, data)\n instructions = []\n\n if data[:subject]\n instructions << {\n op: \"replace\",\n path: \"/subject\",\n value: data[:subject],\n }\n end\n if... | [
"0.70295537",
"0.69650495",
"0.68345374",
"0.68345374",
"0.680446",
"0.6755192",
"0.67442477",
"0.6739878",
"0.67357695",
"0.6591836",
"0.6526926",
"0.6526926",
"0.6526926",
"0.65260077",
"0.6459299",
"0.64082664",
"0.6257751",
"0.62181765",
"0.6205869",
"0.6121303",
"0.61188... | 0.66328156 | 9 |
DELETE /conversations/1 DELETE /conversations/1.json | def destroy
@conversation.destroy
respond_to do |format|
format.html { redirect_to conversations_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @conversation = Conversation.find(params[:id])\n @conversation.destroy\n\n respond_to do |format|\n format.html { redirect_to conversations_url }\n format.json { head :no_content }\n end\n end",
"def delete_conversation(id)\n delete(\"conversations/#{id}\")\n end",
"def... | [
"0.77605957",
"0.7724266",
"0.75998473",
"0.7536397",
"0.7438218",
"0.73939",
"0.73939",
"0.73939",
"0.73939",
"0.7352753",
"0.73413986",
"0.7315615",
"0.72817785",
"0.72817785",
"0.7175789",
"0.7131604",
"0.711136",
"0.70734584",
"0.6947085",
"0.68818146",
"0.6865899",
"0.... | 0.7694006 | 2 |
ask for token access | def restrict_access
if session[:user_id]
if !conversation_params.nil?
conversation_params[:user_id] = session[:user_id]
end
else
authenticate_or_request_with_http_token do |token, options|
@user = User.where(:auth_token => token).first()
if (@user)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate\n # if valid_access_token?\n # fetch_access_token\n # else\n get_new_access_token\n # end\n end",
"def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user ... | [
"0.7644889",
"0.7377761",
"0.7342964",
"0.7298883",
"0.72873414",
"0.71881795",
"0.7045402",
"0.7042433",
"0.70317405",
"0.701334",
"0.69961107",
"0.6982323",
"0.69715065",
"0.69552857",
"0.694648",
"0.69086707",
"0.6906979",
"0.6876264",
"0.68609",
"0.68594724",
"0.68465865"... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_conversation
@conversation = Conversation.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def conversation_params
params[:conversation]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69811666",
"0.6782836",
"0.6747644",
"0.6742015",
"0.6735273",
"0.6593917",
"0.65037674",
"0.6498627",
"0.6482372",
"0.64795715",
"0.64566946",
"0.6439213",
"0.6380714",
"0.6378147",
"0.63657266",
"0.63206697",
"0.6300169",
"0.62992156",
"0.6295538",
"0.62943023",
"0.62915... | 0.0 | -1 |
Cookbook Name:: appsdatabase Recipe:: yaml Copyright 2012, getaroom Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify... | def dasherize(word)
word.gsub(/_/,'-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_database_yml\n return unless File.directory?(\"/app/#{ENV['app_dir']}/config\")\n topic \"Writing config/database.yml to read from DATABASE_URL\"\n File.open(\"/app/#{ENV['app_dir']}/config/database.yml\", \"w\") do |file|\n file.puts <<-DATABASE_YML\n<%\n\nrequire 'cgi'\nrequire 'uri'\n\nbegin\nu... | [
"0.70105296",
"0.6814551",
"0.6814551",
"0.677923",
"0.61972255",
"0.61946595",
"0.6103684",
"0.60051626",
"0.6000189",
"0.59786755",
"0.5974027",
"0.5970249",
"0.58991754",
"0.587714",
"0.5809921",
"0.5787972",
"0.57628757",
"0.5666974",
"0.56412566",
"0.5610987",
"0.5590253... | 0.0 | -1 |
Create an empty new in order to be used in the new setup screen | def new
@postit_task = PostitTask.new()
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\n \n end",
"def new\n \n end",
"def new \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"def new\n \n end",
"d... | [
"0.70782185",
"0.69314694",
"0.6880964",
"0.6880964",
"0.6880964",
"0.6880964",
"0.6880964",
"0.6828466",
"0.68271554",
"0.68271554",
"0.68271554",
"0.68271554",
"0.68271554",
"0.6750794",
"0.67300797",
"0.67300797",
"0.6677604",
"0.6677604",
"0.6662475",
"0.6612327",
"0.6598... | 0.0 | -1 |
Save the Setup to database | def create
params[:postit_task][:sequence] = 1
params[:postit_task][:checked] = "N"
params[:postit_task][:optional] = "N"
@postit_task = PostitTask.new(params[:postit_task])
if @postit_task.save
flash[:notice] = 'Cette tâche a été correctement créée.'.trn
redirect_to :a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save\n end",
"def save\n end",
"def save\n end",
"def save\n SAVE\n end",
"def save!\n end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save; end",
"def save\n end",
"de... | [
"0.6832382",
"0.6832382",
"0.6775942",
"0.6717775",
"0.6698272",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6648633",
"0.6630018",
"0.66282684",
"0.6590251",
"0.65580726",
"0.6504083",
"0.6474824",
"0.6474824",
"0.6437086",
... | 0.0 | -1 |
display the selected Setup | def edit
id = params[:id].presence || 0
@postit_task = PostitTask.find(id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_option_display\n display_value = self.name + \" [v.#{self.snapshot}]\"\n display_value += self.synopsis.present? ? \" (#{self.synopsis})\" : \"\"\n display_value\n end",
"def present_menu\n puts \"-------------------\"\n puts t('select_features')\n puts t('feature_one')\n puts t(... | [
"0.6368162",
"0.6286066",
"0.6158559",
"0.615467",
"0.6129207",
"0.6127401",
"0.60418344",
"0.5975344",
"0.5963046",
"0.59447527",
"0.58930963",
"0.58793133",
"0.5866295",
"0.58419085",
"0.58398795",
"0.58392066",
"0.58104",
"0.58104",
"0.58104",
"0.5802131",
"0.5801852",
"... | 0.0 | -1 |
Update the Setup in the database | def update
@postit_task = PostitTask.find_by_id(params[:id])
if @postit_task.update_attributes(params[:postit_task])
flash[:notice] = 'Cette tâche a été correctement modifiée.'.trn
redirect_to :controller => (@postit_task.postit_list ? 'postit_lists' : 'postit_tasks') ,:action => (@postit_task.posti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @dbman.update\n end",
"def update!(**args)\n @setup_errors = args[:setup_errors] if args.key?(:setup_errors)\n @setup_status = args[:setup_status] if args.key?(:setup_status)\n end",
"def update_db\n ## Sequel\n drop_table\n create_table\n db.transactio... | [
"0.67125124",
"0.66806066",
"0.66274685",
"0.6399447",
"0.6322556",
"0.6221514",
"0.6170538",
"0.61666566",
"0.61446154",
"0.6122422",
"0.6079528",
"0.6022927",
"0.60061616",
"0.6005858",
"0.6005858",
"0.60056686",
"0.595444",
"0.5927382",
"0.5873534",
"0.584885",
"0.5846381"... | 0.0 | -1 |
Delete the Setup from database | def destroy
tmp_element_error = PostitTask.new
tmp = PostitTask.find(params[:id])
if tmp
name = tmp.name
unless tmp.destroy
tmp.errors.full_messages.each do |tmp_error|
tmp_element_error.errors.add(:base, tmp_error)
end
end
end
if tmp_element_error.errors... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_database\n FileUtils.rm_rf(@db_dir)\n end",
"def delete\n @dbman.delete\n @dbprot.clear\n end",
"def destroy\n DATABASE.destroy(self)\n end",
"def delete!\n raise \"A database must be setted\" unless self.database\n response = database.delete self\n ... | [
"0.7548068",
"0.70916003",
"0.6973764",
"0.69421273",
"0.6930271",
"0.6914649",
"0.68973273",
"0.6891784",
"0.68052095",
"0.6777503",
"0.6777503",
"0.67722523",
"0.67648494",
"0.67064744",
"0.67042786",
"0.6696065",
"0.6696065",
"0.6691377",
"0.6680853",
"0.6678272",
"0.66781... | 0.0 | -1 |
setups export to csv | def export_csv
# Find all Setup with the stored restrictions
sorting :default => "name"
collection = PostitTask.find :all, :order => @sort, :conditions => session[:conditions]
# Creation of the file
file_name = "postit_task_export_" + current_user.id.to_s + ".csv"
csv_string = CSV.generate(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def export_csv\n # Find all Setup with the stored restrictions\n sorting :default => 'es_setups.path, es_setups.name'\n setups = EsSetup.find :all, :order => @sort, :conditions => session[:conditions_setup]\n # Creation of the file\n file_name = \"setups_export_\" + current_user.id.to_s + \".csv\"\n... | [
"0.82238036",
"0.8185777",
"0.7855604",
"0.7855604",
"0.74869406",
"0.74433124",
"0.71358114",
"0.7130235",
"0.7107694",
"0.7079673",
"0.70785064",
"0.70609504",
"0.70372957",
"0.70336086",
"0.702135",
"0.6990408",
"0.69852",
"0.69775146",
"0.6945867",
"0.6929899",
"0.6927933... | 0.77174425 | 4 |
Update the delivery options of this producer. | def delivery_options(options=nil)
if options.class == Hash && !block_given?
@j_del.java_method(:deliveryOptions, [Java::IoVertxCoreEventbus::DeliveryOptions.java_class]).call(Java::IoVertxCoreEventbus::DeliveryOptions.new(::Vertx::Util::Utils.to_json_object(options)))
return self
end
r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_delivery\n return unless block_given?\n yield self.delivery_options\n end",
"def set_delivery_option\n @delivery_option = DeliveryOption.find(params[:id])\n end",
"def update!(**args)\n @delivery_requirement = args[:delivery_requirement] if args.key?(:delivery_requireme... | [
"0.676633",
"0.62521595",
"0.61434853",
"0.5958797",
"0.59495103",
"0.5720914",
"0.57147306",
"0.5696135",
"0.5638162",
"0.55926627",
"0.55686843",
"0.55007213",
"0.5447814",
"0.5442394",
"0.5414228",
"0.5413622",
"0.5381847",
"0.537488",
"0.53746974",
"0.536273",
"0.53536314... | 0.57353383 | 6 |
GET /facilities/1 GET /facilities/1.json | def show
@breadcrumbs = [["Home", root_url], [@facility.citizen,"/citizens/#{@facility.citizen.id}?tab=facilities"], [@facility, "/facilities/#{@facility.id}"]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @facilities = Facility.all\n end",
"def index\n @facilities = Facility.all\n respond_with @facilities\n end",
"def get_facilities\n list = organizations.map { |org| org.resource.identifier.last.value }\n facilities_ids = list.join(',')\n\n facilities_request.get(fac... | [
"0.7231287",
"0.7109364",
"0.70793647",
"0.6939646",
"0.68576443",
"0.6796248",
"0.67673665",
"0.6726436",
"0.6641396",
"0.6545672",
"0.6497891",
"0.64686114",
"0.6383986",
"0.63449734",
"0.6336517",
"0.63222444",
"0.63167447",
"0.6300499",
"0.6290218",
"0.6275711",
"0.627326... | 0.0 | -1 |
POST /facilities POST /facilities.json | def create
@facility = Facility.new(facility_params)
@facility.citizen = current_citizen
respond_to do |format|
if @facility.save
format.html { redirect_to @facility, notice: 'Facility was successfully built.' }
format.json { render :show, status: :created, location: @facility }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @faculties = Faculty.create!(faculty_params)\n json_response(@faculties, :created)\n end",
"def create\n @facility = Facility.new(params[:facility])\n\n respond_to do |format|\n if @facility.save\n format.html { redirect_to @facility, notice: 'Facility was successfully creat... | [
"0.669317",
"0.65458864",
"0.65268946",
"0.65028226",
"0.64816755",
"0.6429692",
"0.6314034",
"0.61492693",
"0.60948",
"0.60860586",
"0.6061168",
"0.60245067",
"0.6008566",
"0.60073125",
"0.6004301",
"0.5994032",
"0.5965476",
"0.59471166",
"0.59335846",
"0.59072226",
"0.58965... | 0.61237645 | 8 |
PATCH/PUT /facilities/1 PATCH/PUT /facilities/1.json | def update
respond_to do |format|
if @facility.update(facility_params)
if @facility.levels && @facility.levels.to_i > 0
notice = 'Facility was successfully upgraded.'
else
notice = 'Facility was successfully managed.'
end
format.html { redirect_to @facility,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @facility.update(facility_params)\n format.html { redirect_to facilities_path, notice: 'Facility was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render js... | [
"0.70445484",
"0.6976263",
"0.6944719",
"0.6745053",
"0.673134",
"0.6729656",
"0.67023605",
"0.6653096",
"0.64943254",
"0.6487198",
"0.64783007",
"0.63702255",
"0.6368884",
"0.6368778",
"0.63459724",
"0.6331325",
"0.63235366",
"0.6320527",
"0.63001245",
"0.6282253",
"0.627791... | 0.61319935 | 40 |
DELETE /facilities/1 DELETE /facilities/1.json | def destroy
@facility.destroy
respond_to do |format|
format.html { redirect_to "/citizens/#{@facility.citizen.id}?tab=facilities", notice: 'Facility was successfully sold.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @facility = Facility.find(params[:id])\n @facility.destroy\n\n respond_to do |format|\n format.html { redirect_to facilities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @faafacility = Faafacility.find(params[:id])\n @faafacility.destroy\n\n ... | [
"0.7640228",
"0.735405",
"0.7261485",
"0.72547626",
"0.70639145",
"0.7022162",
"0.6974072",
"0.6940574",
"0.6886111",
"0.68821657",
"0.6872566",
"0.68613386",
"0.6849988",
"0.6828469",
"0.6813978",
"0.6806848",
"0.68012017",
"0.6790105",
"0.67870337",
"0.6770462",
"0.6758085"... | 0.6867906 | 11 |
Use callbacks to share common setup or constraints between actions. | def set_facility
@facility = Facility.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def facility_params
params.require(:facility).permit(:facility_type_id, :producing_trade_good_id, :producing_equipment_type_id, :levels)
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 |
show graph of monthly saldo, expenses, income development | def course
@include_graph_scripts = true
Account.all.each do |account|
Monthreport.find_or_create(account, Time.now)
end
if !@account
@items = Item.without_transfers
@expenses = Monthreport.grouped_by_date.collect{|m| [m.date, Monthreport.for_date(m.date).sum(:expenses)] }
@... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def graph_for_update_monthly_report\n start_date = (params[:start_date]).to_date\n end_date = (params[:end_date]).to_date\n\n expenses = Hash[params.select {|x,y| x.match /ECATEGORY(.)*/ }]\n incomes = Hash[params.select {|x,y| x.match /ICATEGORY(.)*/ }]\n other_expenses = Hash[params.select {|x,y| ... | [
"0.7237169",
"0.68175673",
"0.64612144",
"0.6272929",
"0.6228718",
"0.61645854",
"0.6161597",
"0.6154115",
"0.6118352",
"0.60987765",
"0.6071664",
"0.6013537",
"0.6005842",
"0.59062654",
"0.5891391",
"0.58830804",
"0.5872738",
"0.5868197",
"0.5854201",
"0.58380944",
"0.583500... | 0.54304504 | 64 |
retrieve all accounts, they are needed for the sidebar display | def get_accounts
@accounts = Account.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def accounts\n\t\treturn @accounts\n\tend",
"def get_accounts()\n http_get(accounts_url)\n end",
"def all\n @dealing_platform.gather 'accounts', :accounts, Account\n end",
"def index\n @accounts = current_user.accounts\n end",
"def index\n @accounts = current_user.accounts\n end... | [
"0.7629446",
"0.7617207",
"0.758707",
"0.7518929",
"0.7518929",
"0.74921",
"0.74895805",
"0.7471363",
"0.74367684",
"0.74042",
"0.73879194",
"0.7372068",
"0.73492444",
"0.7347045",
"0.72989047",
"0.7297955",
"0.7285216",
"0.7237887",
"0.72129834",
"0.72031903",
"0.7197814",
... | 0.79508024 | 0 |
sort items according to sort params in url | def sort_items
@items = @items.sort_by(&:created_at) if params[:order] == 'date'
@items = @items.sort_by(&:created_at).reverse if params[:order] == 'date desc'
@items = @items.sort_by(&:payee) if params[:order] == 'payee'
@items = @items.sort_by(&:payee).reverse if params[:order] == 'payee desc'
@it... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort_params; end",
"def sort_params; end",
"def sort(items)\n if params[:sort]\n items.order_by(params[:sort])\n else\n items.reorder(title: :asc)\n end\n end",
"def sort_params\n return [] unless params['sort_by']\n\n orders = (params['sort_order'] ? params['sort_order'].sp... | [
"0.7563414",
"0.7563414",
"0.7398919",
"0.7087462",
"0.70014167",
"0.6989357",
"0.6941837",
"0.6941837",
"0.69313335",
"0.68852925",
"0.68693036",
"0.68450165",
"0.68289953",
"0.68003386",
"0.67832625",
"0.6782011",
"0.6779675",
"0.6778545",
"0.67128634",
"0.66551197",
"0.662... | 0.74197197 | 2 |
Adds all links to the list of links to be spidered. If it finds an Ajax.Updater url, it'll call that too. | def queue_link( tag, source )
return if tag.attributes['class'] && tag.attributes['class']['thickbox'] == 'thickbox'
return if tag.attributes['onclick']
dest = (tag.attributes['onclick'] =~ /^new Ajax.Updater\(['"].*?['"], ['"](.*?)['"]/i) ? $1 : tag.attributes['href']
if !(dest =~ %r{^(mailto:|#|javasc... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_page page_url\n page = SuperCrawler::Scrap.new(page_url) # Scrap the current page\n\n current_page_links = page.get_links # Get current page internal links\n new_links = current_page_links - @links # Select new links\n\n new_links.each { |link| @links_queue.push(link) } # Add new li... | [
"0.6272874",
"0.61977834",
"0.6195653",
"0.6183346",
"0.61627764",
"0.6108786",
"0.60759115",
"0.6014612",
"0.59381306",
"0.59291404",
"0.5859863",
"0.5840936",
"0.5834357",
"0.58159864",
"0.5807662",
"0.5803472",
"0.5802121",
"0.5802121",
"0.5795812",
"0.57753426",
"0.577500... | 0.5609296 | 35 |
All instance variables are delivered as a hash | def attributes
instance_values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def instance_variables_hash\n {}\n end",
"def to_hash\n hash = {}\n self.instance_variables.each do |var| \n hash[var.to_s.delete(\"@\")] = self.instance_variable_get(var) \n end\n hash\n end",
"def instance_variables() end",
"def to_hash\n ... | [
"0.80559176",
"0.7870135",
"0.78228694",
"0.7623874",
"0.76132923",
"0.7442688",
"0.74426484",
"0.7431661",
"0.7420692",
"0.7402456",
"0.73975825",
"0.7382752",
"0.7373863",
"0.7364187",
"0.73630345",
"0.7362693",
"0.73242897",
"0.73172325",
"0.7315385",
"0.73081285",
"0.7304... | 0.0 | -1 |
GET /items GET /items.json | def index
@item = Item.new(expires_at: Time.now.since(1.weeks))
@items = Item.active
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def index\n @items =... | [
"0.7956447",
"0.75458646",
"0.7436882",
"0.7434706",
"0.73979306",
"0.7359301",
"0.7359301",
"0.7359301",
"0.7359301",
"0.7358109",
"0.73140854",
"0.73117816",
"0.73114127",
"0.7306675",
"0.7280181",
"0.7273965",
"0.7263487",
"0.7249038",
"0.7229533",
"0.7176985",
"0.7118821"... | 0.0 | -1 |
GET /items/1 GET /items/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n item = I... | [
"0.7736526",
"0.7547988",
"0.74948645",
"0.73696035",
"0.7328169",
"0.7293223",
"0.7287578",
"0.71326286",
"0.71247333",
"0.71196556",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"0.70882183",
"... | 0.0 | -1 |
POST /items POST /items.json | def create
@item = build_item
respond_to do |format|
if @item.save
format.html { redirect_to items_path, notice: 'アップロードしたでー' }
format.json { render action: 'show', status: :created, location: @item }
else
format.html { render action: 'new' }
format.json { render jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { ... | [
"0.7971939",
"0.7285761",
"0.7231758",
"0.721958",
"0.71792215",
"0.71131957",
"0.7062943",
"0.7053179",
"0.6988855",
"0.69712186",
"0.6903009",
"0.68806237",
"0.6871792",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6839645",
... | 0.6818633 | 23 |
POST /items/1 POST /items/1.json | def destroy
respond_to do |format|
if @item.authenticate(item_params[:password])
@item.destroy
format.html { redirect_to items_url, notice: '削除しましたー' }
format.json { head :no_content }
else
format.html { redirect_to @item, alert: 'パスワード違うでー' }
format.json { head :... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n... | [
"0.7902459",
"0.72600114",
"0.72469366",
"0.7219142",
"0.7193741",
"0.71931636",
"0.7135598",
"0.7109586",
"0.71088797",
"0.7087311",
"0.70565164",
"0.7039298",
"0.6990809",
"0.6990809",
"0.6990809",
"0.6990809",
"0.6990809",
"0.6990809",
"0.6990809",
"0.69902307",
"0.6987084... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_item
@item = Item.active.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def item_params
params.require(:item).permit(:name, :content, :expires_at, :password, :password_confirmation, :message)
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 |
Initialize a new Layout. +base+ is the String path to the +name+ is the String filename of the post file Returns | def initialize(base, name)
@base = base
@name = name
self.data = {}
self.process(name)
self.read_yaml(base, name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(site, path)\n super\n @metadata = [ :layout ]\n \n @name = File.basename(source_path, source_ext)\n end",
"def initialize(site, base, name)\n @site = site\n @base = base\n @name = name\n\n if site.theme && site.theme.layouts_pa... | [
"0.68287456",
"0.68187416",
"0.6809085",
"0.6663833",
"0.64094734",
"0.63928485",
"0.62494016",
"0.62429327",
"0.6208801",
"0.6185502",
"0.61772764",
"0.61384654",
"0.6121431",
"0.6110195",
"0.6095212",
"0.6095212",
"0.6090026",
"0.6066931",
"0.6057327",
"0.60454756",
"0.6042... | 0.597241 | 24 |
Extract information from the layout filename +name+ is the String filename of the layout file Returns nothing | def process(name)
self.ext = File.extname(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout_name(filename)\n\t\tif filename == LAYOUT_FILE_REGEX\n\t\t\treturn filename.split('_')[1].split('.')[0]\n\t\telse\n\t\t\treturn filename\n\t\tend\n\tend",
"def layout_file_name\n layout = \"application\"\n fail unless Content::Aggregator.original_content\n prepare_layout(layout)\n en... | [
"0.68410933",
"0.6671049",
"0.6290417",
"0.6265406",
"0.6233976",
"0.61476517",
"0.5993653",
"0.5936434",
"0.59125966",
"0.5912189",
"0.59106547",
"0.5909998",
"0.58556944",
"0.5853003",
"0.5853003",
"0.5821744",
"0.5788592",
"0.5786057",
"0.5710379",
"0.5701095",
"0.56849945... | 0.0 | -1 |
:nodoc: Public: Get any number; one that doesn't matter options options to control what sort of number comes back: :positive make sure that the number is greater than zero :negative make sure that the number is less than zero | def any_number(*options)
number = (rand(2 * MAX_RAND) - MAX_RAND).to_f/100.0
if options.include? :positive
number + MAX_RAND
elsif options.include? :negative
number - MAX_RAND
else
number
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def at_least(number)\n -number.to_i - 1\n end",
"def negative(number)\n if number > 0\n -number\n else\n return number\n end\nend",
"def _nonnegative_int(value)\n return 1 if value.nil? || !value.is_a?(Integer) || value < 0\n value\n end",
"def any_int(*options)\n any_n... | [
"0.65563625",
"0.652509",
"0.6442797",
"0.64422446",
"0.64257675",
"0.6396435",
"0.6385435",
"0.6374998",
"0.63722265",
"0.6308942",
"0.63038164",
"0.63024604",
"0.6274713",
"0.62696415",
"0.6258822",
"0.6255521",
"0.62536275",
"0.6250933",
"0.62317574",
"0.62317574",
"0.6219... | 0.72526985 | 0 |
Public: Returns an integer. options is the same as for any_number | def any_int(*options)
any_number(*options).to_i
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_count_from_options(options); end",
"def integer(name, options={})\n param(:integer, name, options)\n end",
"def integer(*args, &block)\n args = [{ :using => Option, :kind => Integer }, *args]\n da = option(*args, &block)\n da.instance_eval do\n from String do |... | [
"0.6667954",
"0.6563776",
"0.636853",
"0.620752",
"0.61653346",
"0.6159838",
"0.6149846",
"0.61304575",
"0.61170995",
"0.60755",
"0.6051037",
"0.6048105",
"0.603497",
"0.6023424",
"0.600421",
"0.600077",
"0.5985333",
"0.59405285",
"0.59405285",
"0.5920802",
"0.5916806",
"0.... | 0.7793948 | 0 |
Public: Get an arbitrary string of any potential positive length options options to control the returned string: :max the max size of the string you want, must be positive and greater than :min :min the minimum size we want to come back, must be positive and less than :max Example any_string :max => 255 => ensure it'll... | def any_string(options = {})
if options[:min] && options[:max]
raise ":min must be less than :max" if options[:min] > options[:max]
end
if options[:min]
raise ":min must be positive" if options[:min] < 1
end
min_size = options[:min]
max_size = options... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def limit_size(str, max)\n if str.length > max\n return str[0...max]\n end\n str\n end",
"def safe_len(maxLen, reqLen)\n #handle stings and garbage\n maxLen = (maxLen||reqLen).to_i\n ... | [
"0.6715734",
"0.6715734",
"0.663099",
"0.6539809",
"0.6359927",
"0.63380134",
"0.6283512",
"0.61653775",
"0.61605436",
"0.6102598",
"0.60965765",
"0.60917056",
"0.60778505",
"0.6039807",
"0.6033348",
"0.59673506",
"0.59509605",
"0.59476614",
"0.59267515",
"0.5918188",
"0.5907... | 0.707422 | 0 |
Public: Get an arbitrary symbol, for example to use as a Hash key. The symbol will be between 2 and 20 characters long. If you need superlong symbols for some reason, use any_string.to_sym. | def any_symbol
(any_string :min => 2, :max => 20).to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def symbol(string)\n Types::Symbol.cast(string)\n end",
"def symbolyze_key(key)\n key.to_sym rescue key\n end",
"def symbol\n Util.from_bytes :symbol, value\n end",
"def to_symbol(string)\n string.gsub(/[\\-_]/, '').to_sym\n end",
"def to_symbol from_string\n return fro... | [
"0.7783587",
"0.768915",
"0.7617577",
"0.7424444",
"0.73427176",
"0.72581327",
"0.72581327",
"0.72581327",
"0.7110124",
"0.708834",
"0.69917816",
"0.6947336",
"0.6876408",
"0.6867151",
"0.6864366",
"0.6808391",
"0.6808391",
"0.6808391",
"0.6803932",
"0.67969644",
"0.6796683",... | 0.7420041 | 4 |
Public: Get an arbitrary sentence of arbitrary words of any potential length. Currently, this returns a sentence between 10 and 21 words, though you can control that with options options options to control the returned sentence :max the maximum number of words you want returned :min the minimum number of words you want... | def any_sentence(options = {})
min = 11
max = 21
if options[:max]
min = 1
max = options[:max]
elsif options[:min]
min = options[:min]
max = min + 10
end
Faker::Lorem.words(rand(max - min) + min).join(' ')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spit(options = {})\n if @words_table.words.empty?\n raise StandardError, \"The generator hasn't heard anything yet\"\n end\n\n words = options[:words] && Integer(options[:words])\n max_chars = options[:max_chars] && Integer(options[:max_chars])\n\n sentence = []\n\n if words\n w... | [
"0.71341527",
"0.70622665",
"0.6973728",
"0.6737895",
"0.656547",
"0.65036386",
"0.64715344",
"0.6469743",
"0.6432988",
"0.6374504",
"0.6324202",
"0.631535",
"0.62614",
"0.6211856",
"0.6205857",
"0.6192407",
"0.6179085",
"0.6163448",
"0.6137382",
"0.6137382",
"0.6125962",
"... | 0.76244545 | 0 |
The game starts with step 0 (auto generated) and goes round robin back and forth. So a 2 player game ends when step 2 is complete and step 3 is current | def finished?
current_step > 1 && current_step >= game_length + 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_round\n sleep(1)\n puts \"\\n----- NEW TURN -----\"\n self.players.rotate!\n round_gameplay\n end",
"def start_game\n @player_1_lives = 3\n @player_2_lives = 3\n while @player_1_lives > 0 && @player_2_lives > 0\n new_turn(1)\n break if @player_1_lives == 0\n new_turn(2)\n end\n... | [
"0.7000806",
"0.6835576",
"0.6823484",
"0.6799751",
"0.6716937",
"0.67166317",
"0.6687077",
"0.6596747",
"0.6558144",
"0.6514255",
"0.6499318",
"0.64992285",
"0.6488524",
"0.6486165",
"0.6482987",
"0.645347",
"0.6423757",
"0.6403421",
"0.63869834",
"0.63739824",
"0.6366412",
... | 0.60933614 | 64 |
Last Event for User methods | def sequence_id(user)
Game::LastEvent.new(self, user).event.try!(:sequence)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_event\n history.last\n end",
"def last_event\n history.last\n end",
"def last_event\n if model.last_event.present?\n \"#{model.last_event.class}Decorator\".constantize.new(model.last_event)\n end\n end",
"def last_updates_viewed\n self.user.extend(M... | [
"0.68764853",
"0.68764853",
"0.65949893",
"0.6553402",
"0.6296831",
"0.6296831",
"0.6277105",
"0.62386173",
"0.62200546",
"0.62200546",
"0.62200546",
"0.6179589",
"0.61613476",
"0.61496145",
"0.6123905",
"0.61083126",
"0.60915",
"0.60804534",
"0.6071538",
"0.60540783",
"0.604... | 0.0 | -1 |
=begin another, easier sollution: def start_of_word(s, n) s[0...n] end =end FIRST WORD | def first_word(a)
a = a.split[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_of_word(word, n)\n\treturn word[0..(n - 1)]\nend",
"def start_of_word(str, n = 1)\n str[0, n]\nend",
"def start_of_word(text,n)\n\treturn text[0,n]\nend",
"def start_of_word(word,nb)\n\tword[0...nb]\nend",
"def start_of_word(word, number)\n word[0..number-1]\nend",
"def start_of_word (string,... | [
"0.8830654",
"0.8776737",
"0.85956454",
"0.85768014",
"0.8470049",
"0.8450365",
"0.84076655",
"0.82366884",
"0.8159853",
"0.8142586",
"0.8111043",
"0.799061",
"0.7902417",
"0.7898344",
"0.78837854",
"0.781085",
"0.77155316",
"0.7673289",
"0.74902445",
"0.7486347",
"0.74570674... | 0.0 | -1 |
array1 = [1, 2, 2, 4, 5, 6, 7, 7, 7, 9] array2 = [2, 2, 3, 3, 3, 5, 6] array3 = [2, 3, 3, 4, 4, 4, 4, 4, 4, 5, 6, 6, 6, 6, 7, 7, 8, 9] | def mediana(array)
if array.length % 2 == 1
med = array[array.length.to_f / 2]
else
med = (array[array.length / 2].to_f + array[array.length / 2 - 1]) / 2
end
med
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unite(arr1, arr2, *arr3)\n unique_values = arr1\n\n arr2.select do |number|\n next if (unique_values.include?(number))\n unique_values << number\n end\n\n arr3.select do |number|\n number.select do |value|\n next if (unique_values.include?(value))\n unique_values << value\n end\n end\n unique... | [
"0.6982426",
"0.6969282",
"0.6567614",
"0.63831997",
"0.6348764",
"0.63228804",
"0.6309251",
"0.62965965",
"0.6251936",
"0.62274563",
"0.61965436",
"0.6171739",
"0.61685395",
"0.615744",
"0.6144296",
"0.61432594",
"0.6128473",
"0.6113378",
"0.60994565",
"0.6078343",
"0.607385... | 0.0 | -1 |
Takes Comment object as input and adds to comment list. | def add_comment(comment)
comment_array << comment
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_comment(comment)\n @comments_list << comment\n end",
"def add_comment(comment)\n comments << comment\n end",
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment(comment)\n @comments << comment\n end",
"def add_comment(comment)\n @comments << comment\n end... | [
"0.84447336",
"0.799952",
"0.79640234",
"0.79640234",
"0.7890027",
"0.7814231",
"0.7625963",
"0.73685116",
"0.7346183",
"0.7195494",
"0.71256936",
"0.7022038",
"0.69715476",
"0.69316536",
"0.6914858",
"0.6690849",
"0.66895133",
"0.667431",
"0.6666471",
"0.66049564",
"0.658001... | 0.75413543 | 7 |
Returns the post information. | def show_info
"
Title: #{title}
URL: #{url}
points: #{points}
item ID: #{item_id}
"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def details\n [\"Post title: #{@title}\".colorize(:yellow),\n \"URL: #{@url}\".colorize(:red),\n \"Points: #{@points}\".colorize(:blue),\n \"ID: #{@item_id}\".colorize(:green)]\n end",
"def getPosts()\n\t\tself.post\n\tend",
"def post\n @post ||= Post[post_id]\n end",
"def show\n\... | [
"0.7116089",
"0.6577272",
"0.65497833",
"0.6540129",
"0.650965",
"0.650965",
"0.6482327",
"0.6310271",
"0.62722296",
"0.6220863",
"0.6214082",
"0.61827916",
"0.61818075",
"0.60947967",
"0.6089391",
"0.6073151",
"0.60615164",
"0.60455024",
"0.60359746",
"0.60273385",
"0.602558... | 0.0 | -1 |
return an array of places a Piece can move to | def moves
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] is the y\n side.each do |test_piece|\n # Run move validation tests on eve... | [
"0.78363115",
"0.7686679",
"0.7607257",
"0.75728303",
"0.7485348",
"0.74479556",
"0.7428893",
"0.74221265",
"0.73865277",
"0.73653036",
"0.73426914",
"0.7323848",
"0.73017466",
"0.7286655",
"0.7232324",
"0.7168077",
"0.71426743",
"0.71316653",
"0.71308327",
"0.71169484",
"0.7... | 0.0 | -1 |
regex matches any nonword character except " ' ". | def analyze(phrase)
@words.classify(phrase.split(/[^\w']/)).max_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def only_chars?(text)\n text.match(/^\\w[\\w| ]+$/i)\n end",
"def check_a_string_for_special_characters(string)\n string.scan(/\\W+/).length > 0\nend",
"def check_a_string_for_special_characters(string)\n string =~ /\\W/\nend",
"def strip_non_word_characters!\n @raw.gsub!(/[^\\w\\ \\-.,]/, ' '... | [
"0.7439062",
"0.6970905",
"0.6818748",
"0.6755708",
"0.6668706",
"0.664534",
"0.66091955",
"0.649521",
"0.6486161",
"0.6460523",
"0.6402078",
"0.6401278",
"0.637528",
"0.63230145",
"0.63213503",
"0.631619",
"0.6299269",
"0.62306094",
"0.6222552",
"0.6215689",
"0.61523944",
... | 0.0 | -1 |
reduce 22 omitted reduce 23 omitted | def _reduce_none(val, _values, result)
val[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _reduce_23(val, _values, result); end",
"def _reduce_13(val, _values, result); end",
"def _reduce_21(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
"def _reduce_76(val, _values, result); end",
"def _reduce_312(val, _values, result); end",
"def _reduce_18(val, _values, res... | [
"0.7207884",
"0.7187389",
"0.71199274",
"0.70689523",
"0.70689523",
"0.70681965",
"0.70373863",
"0.70373863",
"0.7028607",
"0.7018847",
"0.7011692",
"0.6982997",
"0.6972415",
"0.6972415",
"0.6969926",
"0.6969926",
"0.69645655",
"0.69615775",
"0.6949843",
"0.69475114",
"0.6944... | 0.0 | -1 |
def restrict_access api_key = ApiKey.find_by_access_token(params[:access_token]) head :unauthorized unless api_key end | def restrict_access
authenticate_or_request_with_http_token do |token, options|
ApiKey.exists?(access_token: token)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def restrict_access\n api_key = ApiKey.find_by_access_token(request.headers[\"token\"])\n head :unauthorized unless api_key \n end",
"def restrict_access\n\t\t# api_key = ApiKey.find_by_access_token(params[:access_token])\n\t\t# head :unauthorized unless api_key\n\n\t\tauthenticate_or_request_with_h... | [
"0.94486266",
"0.9442196",
"0.915251",
"0.901078",
"0.89776236",
"0.8926067",
"0.885173",
"0.86168617",
"0.8549027",
"0.8405279",
"0.83921313",
"0.8356758",
"0.83274066",
"0.81449354",
"0.8141691",
"0.78777146",
"0.7875237",
"0.7750546",
"0.76967686",
"0.7594585",
"0.7579659"... | 0.89732146 | 6 |
check if the call node can use delegate to avoid violating law of demeter. if the receiver of receiver of the call node matchs any in model names, and the message of receiver of the call node matchs any in association names, then it needs delegate. | def need_delegate?(node)
return unless variable(node)
class_name = variable(node).to_s.sub('@', '').classify
association_name = node.receiver.message.to_s
association = model_associations.get_association(class_name, association_name)
attribute_name = node.message.to_s
as... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delegates_allowed?\n @xri.index('*').nil?\n end",
"def should_delegate( &block )\n\t\t@delegate_should_be_called = true\n\t\t@delegate_behavior = block || \n\t\t\tmethod( :default_delegation_behavior ).to_proc\n\tend",
"def should_not_delegate( &block )\n\t\t@delegate_should_be_called = false\n\t\t... | [
"0.63893837",
"0.63733524",
"0.5848186",
"0.57170296",
"0.5688179",
"0.55669194",
"0.5536359",
"0.54230416",
"0.5272447",
"0.5272381",
"0.5263152",
"0.52143997",
"0.5098752",
"0.5088677",
"0.505957",
"0.5051593",
"0.5048541",
"0.5048541",
"0.5048541",
"0.5040835",
"0.5021602"... | 0.70940065 | 0 |
pady = hauteur padx = largeur | def text_field(row, text, width, ispwd=false)
tbut = TkLabel.new(@frame, 'text' => text) {
grid('row' => row, 'column' => 0, 'sticky' => 'nse','padx'=>'0')
}
tvar = TkVariable.new('')
lab = TkEntry.new(@frame) {
textvariable tvar
width width
grid('row' => row, 'column' => 1, 's... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def y_offset; end",
"def GenPad(x1, y1, x2, y2, name, number, flags)\n if x1 > x2\n x1, x2 = x2, x1\n end\n if y1 > y2\n y1, y2 = y2, y1\n end\n if (x2 - x1) > (y2 - y1)\n thickness = (y2 - y1)\n y1 = y2 = (y1 + y2) / 2.0 # same value, no eps\n x1 += thickness / 2.0\n x2 -= thickness / 2.0... | [
"0.62758857",
"0.62353",
"0.6195704",
"0.61556304",
"0.61556304",
"0.611324",
"0.611324",
"0.61036783",
"0.609704",
"0.6084111",
"0.6084111",
"0.6084111",
"0.6084111",
"0.60766524",
"0.6023553",
"0.60097265",
"0.5965248",
"0.5963459",
"0.5949966",
"0.5948292",
"0.5899127",
... | 0.0 | -1 |
Chek if the user is connected | def connect?
if !!@connect
puts "okai"
@frame.destroy()
else
print_error_message
puts "wrong password or login"
return
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def connected?\n authenticated? && !@user.jid.bared?\n end",
"def ready?\n @connected && @logged_in\n end",
"def is_connected\n begin\n if session.key?(:sos_note_email)\n true\n else\n false\n end\n rescue Exception => e \n false\n end\n end",
"def ... | [
"0.7884046",
"0.78778344",
"0.75494313",
"0.75106555",
"0.7488672",
"0.7485709",
"0.7483566",
"0.7477505",
"0.74607867",
"0.74607867",
"0.74607867",
"0.74607867",
"0.74607867",
"0.74607867",
"0.7432728",
"0.74284637",
"0.7418711",
"0.7414712",
"0.74082774",
"0.73997766",
"0.7... | 0.0 | -1 |
Set up image method | def image_bk(name)
image = TkPhotoImage.new
image.file = "./images/#{name}"
label = TkLabel.new(@frame)
label.image = image
label.place('height' => image.height, 'width' => image.width,'x' => 290, 'y' => -15)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_img\n\n end",
"def initialize(image)\n @image_location = image\n @auto_size = false\n super()\n end",
"def image\n end",
"def image\n end",
"def image; end",
"def setup_images\n @default_image = NSImage.imageNamed(\"default.png\")\n @alternate_image = NSImage.imageNam... | [
"0.8419164",
"0.7529995",
"0.72695524",
"0.72695524",
"0.723433",
"0.71852595",
"0.6951315",
"0.69473976",
"0.69473976",
"0.6873856",
"0.6871939",
"0.68255794",
"0.68157923",
"0.68045723",
"0.6786275",
"0.6784251",
"0.67834437",
"0.67516136",
"0.6746213",
"0.6718529",
"0.6703... | 0.0 | -1 |
Human readable version of the temporal expression. | def inspect
"the year is " + humanize_list(@parts)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_s\n @expression.to_s\n end",
"def inspect\n \"#{time.strftime(\"%Y-%m-%d %H:%M:%S\")} #{period.abbreviation}\"\n end",
"def to_temporal_sexp\n Dumper.dump(self)\n end",
"def tir_f\n format_f(self.tir)\n end",
"def to_s\n return @exp\n end",
"def exp_text\n @exp... | [
"0.6363653",
"0.6317932",
"0.63158035",
"0.6248642",
"0.6163406",
"0.6106563",
"0.6092316",
"0.6077233",
"0.59881324",
"0.59780014",
"0.59654355",
"0.5895677",
"0.5880721",
"0.5862208",
"0.58599603",
"0.5847337",
"0.58191925",
"0.5816259",
"0.581397",
"0.5810854",
"0.58007693... | 0.0 | -1 |
takes a list of points and inserts the distances. return DistResultAlreadyValid if distances are already in place, DistResultValid if distances are not already in place but have been calculated and inserted, and DistResultInvalid if only some points have distances and some don't (this points to a state mismatch issue) | def add_distances(points)
points_dist = points.select { |p| p.key? :distance }
return DistResultAlreadyValid.new(points) \
if points_dist.length == points.length
return DistResultInvalid.new('Only some points with distance') \
unless points_dist.empty?
points.each_index do |idx|
if idx.zero?
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unique_distance_to_point?\n # ALL_POINTS.sort_by { |obj| obj.distance_to_main }.first\n @distances = ALL_POINTS.map(&:distance_to_main)\n @sorted_distances = @distances.sort\n @closest = @sorted_distances.first\n @distances.one?(@closest)\nend",
"def compute_point_distances(points)\n if points.size... | [
"0.55015147",
"0.5444897",
"0.536089",
"0.52850014",
"0.52521795",
"0.5107156",
"0.5088129",
"0.5088129",
"0.50877386",
"0.5058246",
"0.5046218",
"0.50223637",
"0.50107116",
"0.49900314",
"0.49306116",
"0.48186052",
"0.48153782",
"0.47983697",
"0.47842142",
"0.47495577",
"0.4... | 0.7974665 | 0 |
GET /tasks or /tasks.json | def get_user_tasks
render json: get_current_user.tasks
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def index\n # GET /tasks\n @tasks = Task.all\n end",
"def tasks_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TasksApi.tasks_get ...'\n ... | [
"0.7532662",
"0.7170146",
"0.70539886",
"0.70490366",
"0.7041225",
"0.6999935",
"0.6963649",
"0.69378513",
"0.692819",
"0.6868948",
"0.6868948",
"0.6868948",
"0.68433535",
"0.6840866",
"0.6837937",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377566",
"0.68377... | 0.6835284 | 29 |
POST /tasks or /tasks.json | def add_user_task
task = Task.create(task_params)
puts "New task: #{task}"
if task
render json: {task: task}
else
render json: task.error.full_messages, status: 402
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render j... | [
"0.7268535",
"0.717493",
"0.71400195",
"0.71334976",
"0.7084802",
"0.7079791",
"0.7057359",
"0.6988835",
"0.69781363",
"0.6913902",
"0.68908507",
"0.6871712",
"0.6863563",
"0.6839375",
"0.68256986",
"0.68256986",
"0.68256986",
"0.68256986",
"0.6822469",
"0.68047833",
"0.68047... | 0.6624633 | 53 |
POST /tasks or /tasks.json | def edit_user_task
task = Task.find(params[:id])
if task.update(task_params)
render json: {task: task, status: 201}
else
render json: {errors: task.errors.full_message , status: 422}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_task(options = {})\n request(:post, \"tasks\", options)\n end",
"def tasks\n uri = URI(BASE_URL + TASKS_ENDPOINT)\n\n make_request(uri)\n end",
"def create\n @task = Task.new(task_params)\n\n if @task.save\n render json: @task, status: :created\n else\n render j... | [
"0.7268287",
"0.71795046",
"0.71401626",
"0.71335083",
"0.7084007",
"0.7079789",
"0.7057791",
"0.6989668",
"0.6980067",
"0.6914673",
"0.68917507",
"0.6872625",
"0.6864289",
"0.68404895",
"0.6826246",
"0.6826246",
"0.6826246",
"0.6826246",
"0.6822789",
"0.6805535",
"0.68055296... | 0.0 | -1 |
GET /tasks/1 or /tasks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end",
"def get_task\n @task = @current_user.tasks.find(params[:id])\n head 404 and return unless @task\n end",
"def show\n @task = Task.find(params[:id])\n\n render json: @task\n end",
"def show\n @task = Task[params[:id]]\n\n ... | [
"0.7340552",
"0.7215065",
"0.7109711",
"0.70882547",
"0.7037538",
"0.7021977",
"0.69818026",
"0.6966337",
"0.6935652",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.69354486",
"0.... | 0.0 | -1 |
DELETE /tasks/1 or /tasks/1.json | def delete_user_task
task = Task.find(params[:id])
if task.destroy
render json: {message: 'Task successfully deleted!'}
else
render json: task.errors.full_messages, status: 402
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_task id\n request :delete, \"tasks/#{id}\"\n nil\n end",
"def delete_task\n @task = Task.find_by(id: params[:id])\n @task.destroy\n render :json => @task.as_json(:only => [:id])\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n respond_to do |f... | [
"0.7763837",
"0.7501929",
"0.7478803",
"0.747828",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.7469844",
"0.742595",
"0.7424186",
"0.74118066",
"0.74118066",
"... | 0.71780556 | 48 |
Use callbacks to share common setup or constraints between actions. | def set_task
@task = Task.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def task_params
params
.require(:task)
.permit(:id, :title, :description, :user_id)
.with_defaults(:user_id => get_current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.6948149",
"0.68135875",
"0.68015283",
"0.67953765",
"0.6745843",
"0.67416775",
"0.652725",
"0.6521263",
"0.649084",
"0.64307743",
"0.64307743",
"0.64307743",
"0.6398334",
"0.63553715",
"0.6355045",
"0.6346211",
"0.63444513",
"0.6338212",
"0.63267356",
"0.63267356",
"0.6326... | 0.0 | -1 |
should be right at the top of the class, not in the method def change_next_id(next_id) | def inititalize
@id = @@next_table_id
@@next_table_id += 1
def self.preview_next_id
@@next_table_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_id=(id)\n self[:next_id] = id\n end",
"def next_id\n @id ||= 0\n @id += 1\n end",
"def _next_id\n @@id -= 1\n @@id\n end",
"def next_id\n next_id = \"sdc:\" + (current_id.to_i + 1).to_s\n next_id\n end",
"def next_id\n (@curr_id +=1).to_s\n end"... | [
"0.79790664",
"0.7744698",
"0.7673934",
"0.7554964",
"0.74798584",
"0.74630326",
"0.7452074",
"0.7381645",
"0.70638806",
"0.70529824",
"0.69876623",
"0.6959364",
"0.6928342",
"0.68735856",
"0.6730214",
"0.6730214",
"0.67134047",
"0.66453826",
"0.66411835",
"0.6639271",
"0.657... | 0.6828658 | 14 |
Super lame, but awesome way to get CSS options CSS selector. | def css
options.fetch :css, CSS_SELECTOR
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getSelector()\n if @meta_data[@platform].key?(:id)\n selector = @meta_data[@platform][:id]\n validator = :id\n elsif @meta_data[@platform].key?(:css)\n selector = @meta_data[@platform][:css]\n validator = :css\n elsif @meta_data[@platform].key?(:xpath)\n... | [
"0.63306123",
"0.6175985",
"0.6097226",
"0.6091115",
"0.60491586",
"0.5970607",
"0.59346336",
"0.5925374",
"0.5906901",
"0.5898399",
"0.5862373",
"0.58605105",
"0.5849351",
"0.58179116",
"0.58159053",
"0.57927364",
"0.57279354",
"0.5697107",
"0.5695308",
"0.56580865",
"0.5648... | 0.6878308 | 0 |
Registers mime types and renderers for all available rdf formats. Add additional formats by adding the gems to the Gemfile. See for a list of available formats. | def register!
self.rdf_content_types = []
RDF::Format.each do |format|
register_renderer(format.file_extension, format.content_type, format.symbols.first)
end
register_renderer(%i[hndjson], ['application/hex+x-ndjson'], :hndjson)
register_renderer(%i[empjson], ['applic... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def register_mime_types\n types = mime_types.map(&:to_s)\n exts = file_extensions.map(&:to_sym)\n type = types.shift\n ext = exts.shift\n __debug_mime(binding) do\n { type: type, ext: ext, types: types, exts: exts }\n end\n return unless type && ext\n Mime::Type.r... | [
"0.612357",
"0.6011864",
"0.588089",
"0.5778325",
"0.5677392",
"0.5629205",
"0.5580421",
"0.5439791",
"0.53450185",
"0.534358",
"0.53373903",
"0.5324326",
"0.51724017",
"0.5141364",
"0.5122297",
"0.5101693",
"0.50908285",
"0.5070216",
"0.50593066",
"0.50582546",
"0.50496125",... | 0.76532173 | 0 |
the cookies page will only render with the 'who' parameter right now, like this: /test/cookies?who=peter | def show_cookies
if request.post? || params[:who] == 'peter'
ls = cookies[LIFESIZE_COOKIE]
if ls
@cookie_value = JSON.pretty_generate(JSON.parse(Crypt.decrypt(ls)))
else
@cookie_value = "lifesize cookie not set"
end
@screen_cookie_value = cookies[SCREEN_COOKIE] ? cookie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cookies\n # renders static page\n end",
"def cookie_path; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def cookies; end",
"def show\n\t@quest = Quest.find(params[:id])\n\tcookies.permanent[:visited]=\"done\"... | [
"0.72562337",
"0.65679264",
"0.65315187",
"0.65315187",
"0.65315187",
"0.65315187",
"0.65315187",
"0.65315187",
"0.65315187",
"0.64675945",
"0.64531314",
"0.6385639",
"0.63691247",
"0.6366814",
"0.63582635",
"0.63437235",
"0.6338519",
"0.6338301",
"0.6283523",
"0.619111",
"0.... | 0.75261587 | 0 |
Add item object to guest cart | def add_item_to_guest_cart(item)
post_wrapper("/V1/guest-carts/#{guest_cart_key}/items", item.to_json, default_headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_cart_item\n current_cart.cart_items.new\n end",
"def add_item_to_cart(item_id)\n cart << item_id\n end",
"def add\n\t\tadd_to_cart(params[:item_obj], params[:qty])\n flash[:notice] = \"Succesfully added to your cart!\"\n\t\tredirect_to :controller => \"items\", :action => \"show\"\n\tend... | [
"0.8176214",
"0.79014796",
"0.78283334",
"0.74844843",
"0.7398601",
"0.7368818",
"0.7335379",
"0.7316005",
"0.7304993",
"0.7285387",
"0.7270739",
"0.7258922",
"0.7232215",
"0.720883",
"0.71703446",
"0.71387297",
"0.7117441",
"0.71054673",
"0.7099813",
"0.70860326",
"0.7081703... | 0.84021324 | 0 |
Update item qty in guest cart | def update_item_in_guest_cart(item_id, item)
put_wrapper("/V1/guest-carts/#{guest_cart_key}/items/#{item_id}", item.to_json, default_headers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_quantity token, cart_id, product_code, qty = 1\n\tend",
"def update_cart\n product = Product.find_by_cs_sku(params[:sku])\n item = ReservedItem.where('user_id = ? and product_id = ? and session_id = ?', current_user.id,\n product.id,\n se... | [
"0.7882465",
"0.7832211",
"0.7752147",
"0.7448885",
"0.7416816",
"0.73889524",
"0.73754793",
"0.72849476",
"0.7253288",
"0.7233242",
"0.719669",
"0.71636355",
"0.71635133",
"0.7161971",
"0.7143511",
"0.7094526",
"0.7092658",
"0.7091255",
"0.70849884",
"0.7083653",
"0.70737547... | 0.68306136 | 40 |
5/6/15 Write a method that will take a string as input, and return a new string with the same letters in reverse order. Don't use String's reverse method; that would be too simple. Difficulty: easy. | def reverse(string)
# string.chars.reverse.join # Option 1 - Break string in array of chars, reverse array, and join them back together
=begin # Option 2 - Break string into chars and prepend them so that the letter
str = '' # after is now before it
string.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letterReverse (str)\n str.split('').reverse.join('')\nend",
"def letterReverse(aString)\n return aString.reverse!.split.reverse.join(\" \")\nend",
"def reverse_string input\n input.reverse\nend",
"def reverse(string)\n #debugger\n arr = string.split(\"\")\n last_letter = arr.pop\n return \"\" if l... | [
"0.84247524",
"0.8386048",
"0.83774763",
"0.8307569",
"0.82883865",
"0.82805604",
"0.8245447",
"0.8237111",
"0.8232921",
"0.823112",
"0.8228218",
"0.8226188",
"0.8220265",
"0.82199633",
"0.8219778",
"0.82009655",
"0.8166531",
"0.8164145",
"0.8162876",
"0.8158959",
"0.8141958"... | 0.8086501 | 32 |
Parses a number by converting it to a Double, formatting it as money, and then converting it back to String Example: $32.50 (String) | def money
to_d.money.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_money(number)\n \"$#{format('%.2f', number)}\"\n end",
"def format_money(money)\n money_with_dots = money.reverse.scan(/.{3}|.+/).join(\".\").reverse\n \"$#{money_with_dots}\" \n end",
"def prettymoney(amount)\n '$%.2f' % cents_to_dollars(amount).to_s\n end",
"def format_money... | [
"0.6923916",
"0.68520486",
"0.6793761",
"0.6758365",
"0.67497456",
"0.670993",
"0.6707092",
"0.66620904",
"0.66560966",
"0.66560966",
"0.66476035",
"0.66045415",
"0.6577687",
"0.65173745",
"0.64833665",
"0.64797497",
"0.6416306",
"0.63989747",
"0.6382233",
"0.6368",
"0.635112... | 0.6506252 | 15 |
Undoes a titleize by addinig underscores and making lowercase returns String. ActionSupport alternative is `.parameterize` Example Nice Title > nice_title (String) | def uglify
self.gsub(' ', '_').downcase
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def titleize!\n replace titleize\n end",
"def titleize\n#\t\thumanize(underscore(self)).gsub(/\\b('?[a-z])/) { $1.capitalize }\n#\t\thumanize(self.underscore).gsub(/\\b('?[a-z])/) { $1.capitalize }\n\t\tself.underscore.humanize.gsub(/\\b('?[a-z])/) { $1.capitalize }\n\tend",
"def titleize\n new_string =... | [
"0.79370195",
"0.7843527",
"0.75816476",
"0.7538795",
"0.75179076",
"0.74826133",
"0.7452258",
"0.74202347",
"0.7400491",
"0.7374487",
"0.73550177",
"0.73437065",
"0.73125887",
"0.73125887",
"0.7311858",
"0.7299126",
"0.72930217",
"0.72573876",
"0.72536224",
"0.72536224",
"0.... | 0.0 | -1 |
Helper function, given a block, it will pause its execution until it is possible to do the request. | def work()
# FIXME : .rel[...].get doesn't update $client.rate_limit...
rate_limit = $client.rate_limit
dbgp "#{rate_limit.remaining} API calls left."
# A little buffer in case we use a feature from octokit
# which doesn't update rate_limit on `$client`.
if rate_limit.remaining < 5 then
reset = rate_l... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop(&block)\n block ||= Proc.new { pending_requests.any? }\n session.loop{Rex::ThreadSafe.sleep(0.5); block.call }\n end",
"def wait(&block)\n fiber = Fiber.current\n\n # Resume the fiber when a response is received\n allow_resume = true\n block.call do |*args|\n ... | [
"0.7094691",
"0.7085347",
"0.68502134",
"0.68368196",
"0.6721456",
"0.6699447",
"0.6590723",
"0.6578999",
"0.6576055",
"0.6484352",
"0.6469201",
"0.6446795",
"0.64400476",
"0.6431964",
"0.6379072",
"0.6371592",
"0.6351473",
"0.63371986",
"0.63338184",
"0.6331414",
"0.6331414"... | 0.0 | -1 |
rubocop: disable MethodLength rubocop: disable AbcSize | def edit_check(exec_action)
t = Chef::Resource::Template.new(tpl_name, run_context)
t.cookbook new_resource.cookbook
t.path tpl_path
t.source 'monit.check.erb'
t.variables monit_check_config
if Chef::VERSION.to_f >= 12
t.verify do |path|
"monit -tc #... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def size\n super\n end",
"def size\n super\n end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def ... | [
"0.72507805",
"0.60201514",
"0.5911545",
"0.5911545",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
"0.5907456",
... | 0.0 | -1 |
rubocop: enable MethodLength rubocop: enable AbcSize | def tpl_name
"monit_check_#{new_resource.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def big_bad; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def s... | [
"0.6839228",
"0.61951536",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
"0.6008121",
... | 0.0 | -1 |
rubocop: disable MethodLength rubocop: disable AbcSize | def monit_check_config
{
:name => new_resource.name, :check_type => new_resource.check_type,
:check_id => new_resource.check_id, :id_type => new_resource.id_type,
:group => new_resource.group, :start_as => new_resource.start_as,
:start_as_group => new_resource.start_as_gr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def private_method\n end",
"def size\n super\n end",
"def size\n super\n end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def size; end",
"def ... | [
"0.7246879",
"0.60164744",
"0.59134924",
"0.59134924",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
"0.5909518",
... | 0.0 | -1 |
== Generate Token Create the nonce for the session | def generate_token
self.token = SecureRandom.hex
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_token(client_nonce)\n generation_time = time_to_block(Time.now.to_i)\n encryptor(client_nonce).encode(generation_time, 0)\n end",
"def gen_nonce\n Time.now.utc.to_i.to_s\n end",
"def generate_nonce\n secret_box = RbNaCl::SecretBox.new(key)\n self.nonce = RbNa... | [
"0.80501753",
"0.7636177",
"0.7534308",
"0.73572576",
"0.7330871",
"0.7317955",
"0.7278305",
"0.7261309",
"0.7248531",
"0.7232363",
"0.7232363",
"0.7223856",
"0.72042954",
"0.71283084",
"0.71038216",
"0.70962787",
"0.70853287",
"0.70610285",
"0.70606047",
"0.70444417",
"0.703... | 0.71171 | 14 |
assert_valid_keys was killing performance. Array.flatten was the culprit, so I rewrote this method, got a 35% performance increase | def fast_assert_valid_keys(valid_keys)
unknown_keys = keys - valid_keys
raise(ArgumentError, "Unknown key(s): #{unknown_keys.join(", ")}") unless unknown_keys.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_has_correct_number_of_keys\n assert_equal( 2, @result.keys.size )\n end",
"def test_it_populates_keys\n expected = %w[A1 B1 C1 D1 A2 B2 C2 D2 A3 B3 C3 D3 A4 B4 C4 D4]\n\n assert_equal expected, @board.board_hash.keys\n end",
"def validate_keys(*valid_keys)\n valid_keys.flatten!\n ... | [
"0.7051017",
"0.64533436",
"0.6303645",
"0.62463117",
"0.6219911",
"0.6211608",
"0.61746025",
"0.60001874",
"0.5995497",
"0.598606",
"0.59834206",
"0.5946602",
"0.59350395",
"0.587689",
"0.5858419",
"0.58548415",
"0.5831976",
"0.5811317",
"0.57604176",
"0.57477814",
"0.570407... | 0.71805257 | 0 |
Convenience method for Classifier::Bayes.new | def classifier(*args, &block)
Classifier::Bayes.new(*args, &block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(*args)\n @initial_categories = []\n options = { language: 'en',\n enable_threshold: false,\n threshold: 0.0,\n enable_stemmer: true,\n backend: BayesMemoryBackend.new\n }\n arg... | [
"0.61320305",
"0.604302",
"0.59702224",
"0.57270557",
"0.552952",
"0.5438401",
"0.5433438",
"0.53802156",
"0.5327198",
"0.5302736",
"0.52328956",
"0.5215688",
"0.5189041",
"0.5150999",
"0.505702",
"0.5045597",
"0.50383455",
"0.50326324",
"0.49666855",
"0.4945096",
"0.49081466... | 0.8484664 | 0 |
Initialize a new Flash instance | def initialize(session, request_id)
@session = session
@request_id = request_id
session[SESSION_KEY] ||= {}
session[SESSION_KEY][request_id] ||= {}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n @session = {}\n @flash = {}\n end",
"def initialize(swf, id, frame_count)\n #initialize/assign defaults\n @swf = swf\n @frame_count = frame_count\n @frame_labels = {}\n @frames = [nil] #frame 0 is empty\n \n #private vars\n @blend_mode = nil\n @cache_as_bitmap =... | [
"0.6640501",
"0.6386705",
"0.63584775",
"0.63445306",
"0.6176856",
"0.61371255",
"0.6085523",
"0.605167",
"0.6028411",
"0.60169953",
"0.5997949",
"0.59770834",
"0.59388065",
"0.587822",
"0.584024",
"0.58292574",
"0.57528794",
"0.57482874",
"0.57202363",
"0.5719088",
"0.569330... | 0.0 | -1 |
Set the given value for the given key | def []=(key, value)
data[key] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(key, value)\n @value[key.to_sym] = value if key\n end",
"def set(key, value)\n end",
"def set(key, value)\n change(:set, key, value)\n end",
"def set(key, value); end",
"def set(key, value); end",
"def set(key, value=nil)\n @data[key.to_s] = value\n end",
"def set(key, value)... | [
"0.8394057",
"0.8279491",
"0.82208925",
"0.8218016",
"0.8218016",
"0.81298965",
"0.8078204",
"0.80502677",
"0.7961406",
"0.793694",
"0.79202676",
"0.7873434",
"0.78397113",
"0.7835952",
"0.78225017",
"0.77961254",
"0.77729267",
"0.7764743",
"0.77628237",
"0.7751005",
"0.77441... | 0.7373092 | 64 |
Get the value associated to the given key, if any | def [](key)
data.fetch(key) do
_values.find {|data| !data[key].nil? }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(key)\n position = find(key)\n if position != nil\n @values[position]\n else\n nil\n end\n end",
"def get_value(key)\n self[key]\n end",
"def getValue(key)\r\n \r\n return @aHash[key]\r\n end",
"def get(key)\n index = key_index(key)\n if( index... | [
"0.82788724",
"0.8155667",
"0.80902964",
"0.79259545",
"0.7902896",
"0.7880111",
"0.7877606",
"0.7850107",
"0.7823244",
"0.77709824",
"0.77461594",
"0.7712749",
"0.7708042",
"0.7662312",
"0.7650498",
"0.762877",
"0.76164323",
"0.75906533",
"0.75678873",
"0.75637674",
"0.75378... | 0.0 | -1 |
Removes entirely the flash from the session if it has stale contents or if empty. | def clear
# FIXME we're just before a release and I can't find a proper way to reproduce
# this bug that I've found via a browser.
#
# It may happen that `#flash` is nil, and those two methods will fail
unless flash.nil?
expire_stale!
remove!
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_flash\n @flash = session[:flash] if session[:flash]\n session[:flash] = nil\n end",
"def clear_flash\n flash.discard \n end",
"def clear_flash\n flash.clear\n end",
"def discard_flash\n flash.discard\n end",
"def keep_flash\n @keep_flash = true\n end",
"def expire_sta... | [
"0.7237592",
"0.70933443",
"0.7069839",
"0.68107975",
"0.6809675",
"0.6620392",
"0.6597707",
"0.6527156",
"0.6483553",
"0.64184105",
"0.64071685",
"0.63239217",
"0.6300063",
"0.62676084",
"0.62533337",
"0.62282443",
"0.6207384",
"0.61318266",
"0.6128992",
"0.600179",
"0.59656... | 0.7751158 | 0 |
Check if there are contents stored in the flash from the current or the previous request. | def empty?
_values.all?(&:empty?)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_flash\n @flash = session[:flash] if session[:flash]\n session[:flash] = nil\n end",
"def empty?\n @flash.empty?\n end",
"def flash_messages?; flash.any?; end",
"def vanila?\n if @init_digest.nil?\n empty? or size == 1 && has_key?('flash.next') && self['flash.next'].em... | [
"0.6744838",
"0.6566251",
"0.6268944",
"0.6189835",
"0.6182708",
"0.6063911",
"0.5927955",
"0.5848444",
"0.578643",
"0.5680153",
"0.5654094",
"0.5646427",
"0.5637096",
"0.56298065",
"0.56029165",
"0.5583926",
"0.55817336",
"0.5572483",
"0.55313337",
"0.5524837",
"0.5499454",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.