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 |
|---|---|---|---|---|---|---|
Clamp a value between from and to | def clamp(value, minimum_inclusive, maximum_inclusive)
if minimum_inclusive > maximum_inclusive
swap = minimum_inclusive
minimum_inclusive = maximum_inclusive
maximum_inclusive = swap
end
value < minimum_inclusive ? minimum_inclusive : value < maximum_inclusive ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clamp(val, min, max)\n\treturn min if val < min\n\treturn max if val > max\n\treturn val\nend",
"def clamp; end",
"def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end",
"def clamp(num, a, b)\r\n\treturn a if num < a\r\n\treturn b if num > b\r\n\tretur... | [
"0.80082524",
"0.7946647",
"0.77430665",
"0.7323833",
"0.70005155",
"0.6985818",
"0.674312",
"0.66691613",
"0.66453075",
"0.6538454",
"0.6485035",
"0.64604056",
"0.643361",
"0.6353804",
"0.63347065",
"0.61676073",
"0.6144327",
"0.61366314",
"0.604638",
"0.594083",
"0.5940719"... | 0.78510576 | 2 |
Clamp a point between from and to | def bbpClamp(point, minimum_inclusive, maximum_inclusive)
bbp(clamp(point.x, minimum_inclusive.x, maximum_inclusive.x),
clamp(point.y, minimum_inclusive.y, maximum_inclusive.y))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clamp; end",
"def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end",
"def clamp(rect)\n self.dup.clamp!(rect)\n end",
"def clamp(val, min, max)\n\treturn min if val < min\n\treturn max if val > max\n\treturn val\nend",
"def clamp(value, minimum_i... | [
"0.7471544",
"0.69083196",
"0.6694613",
"0.6579846",
"0.6347165",
"0.6343104",
"0.62161237",
"0.62033194",
"0.6137307",
"0.6003822",
"0.5976785",
"0.59146714",
"0.5910452",
"0.59088117",
"0.5867298",
"0.5845293",
"0.58035475",
"0.5764698",
"0.57059455",
"0.56819993",
"0.56658... | 0.66073996 | 3 |
CGSize from a CGPoint | def bbpFromSize(size)
bbp(size.width, size.height)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n size_dependencies = [calculated_width, calculated_height]\n if size_dependencies != @size_dependencies\n # avoid repeating calculations\n calculated_width, calculated_height = @size_dependencies = size_dependencies\n @size = org.eclipse.swt.graphics.Poi... | [
"0.6575711",
"0.62193",
"0.61813885",
"0.61813885",
"0.615327",
"0.602492",
"0.5969789",
"0.59315073",
"0.5776799",
"0.57018673",
"0.56968105",
"0.56705415",
"0.5641924",
"0.56393385",
"0.5637912",
"0.5637912",
"0.56241316",
"0.55955595",
"0.55955595",
"0.5452452",
"0.5450985... | 0.0 | -1 |
Run a math operation function on each point component | def bbpCompOp
rise 'Method not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def each_point(&block)\n Merit::POINTS.times(&block)\n end",
"def xxx(x, y)\n sum = 0\n\n x.each_index do |i|\n sum += (x[i] * y[i])\n end\n\n sum\nend",
"def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end",
"def do_calculation\n index = ... | [
"0.5841139",
"0.5778022",
"0.5758805",
"0.5744497",
"0.5718926",
"0.564971",
"0.563767",
"0.5617324",
"0.56171334",
"0.55829835",
"0.55692166",
"0.5550936",
"0.5547049",
"0.5544676",
"0.5532646",
"0.5528335",
"0.5523159",
"0.5487271",
"0.5486873",
"0.54867727",
"0.5463456",
... | 0.0 | -1 |
Linear interpolation between two points | def bbpLerp(first_point, second_point, alpha)
bbpAdd(bbpMult(first_point, 1 - alpha), bbpMult(second_point, alpha))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lerp(x1, y1, x2, y2, x)\n return y1 + (x - x1) * ((y2 - y1) / (x2 - x1))\nend",
"def get_linear_interpolation_with(other, bias = 0.5)\n raise 'Invalid track point' unless other.is_a? TrackPoint\n TrackPoint.new longitude * (1.0 - bias) + other.longitude * bias,\n latitude * (... | [
"0.7275462",
"0.72197473",
"0.7000755",
"0.6667082",
"0.644299",
"0.6409069",
"0.6252871",
"0.613461",
"0.6118703",
"0.6030725",
"0.59863997",
"0.5910752",
"0.58762956",
"0.58531517",
"0.5841448",
"0.583739",
"0.5828691",
"0.58225226",
"0.5696531",
"0.5649724",
"0.5602617",
... | 0.58160156 | 18 |
Determine if two points are equal with some degree of variance | def bbpFuzzyEqual(first_point, second_point, variance)
if first_point.x - variance <= second_point.x and second_point.x <= first_point.x + variance
if first_point.y - variance <= second_point.y and second_point.y <= first_point.y + variance
return true
end
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eql?(other)\n if ! other.is_a?(self.class)\n false\n else\n [@mean, @variance] == [other.mean, other.variance]\n end\n end",
"def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n ... | [
"0.6776845",
"0.6417084",
"0.6343171",
"0.58008915",
"0.57410693",
"0.5729826",
"0.5673462",
"0.56618375",
"0.5639518",
"0.5631125",
"0.56209457",
"0.55441827",
"0.5516703",
"0.55106246",
"0.5506014",
"0.54897404",
"0.54426676",
"0.54279107",
"0.53732026",
"0.53457093",
"0.53... | 0.6507642 | 1 |
Multiples the first and second point | def bbpCompMult(first_point, second_point)
bbp(first_point.x * second_point.x, first_point.y * second_point.y)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mult(x,y)\n\tx * y\nend",
"def multiple(num1,num2)\n\tnum1 * num2\nend",
"def multiply_two_numbers( x, y )\n x * y\nend",
"def we pts1, pts2\n (1 / ( 10 ** ( - (pts1 - pts2) / 400.0) + 1)).round(3)\n end",
"def multiply(first, second)\n first * second\nend",
"def double\n return se... | [
"0.6481852",
"0.62772137",
"0.6252549",
"0.624182",
"0.6235753",
"0.6214382",
"0.6199999",
"0.61428374",
"0.6124073",
"0.6110809",
"0.6095082",
"0.60885966",
"0.60580593",
"0.60568845",
"0.60549814",
"0.60387784",
"0.60384977",
"0.60377175",
"0.603494",
"0.60263485",
"0.60237... | 0.5745167 | 59 |
Signed angle in radians between two vector directions | def bbpAngleSigned(first_point, second_point)
first_point = bbpNormalize(first_point)
second_point = bbpNormalize(second_point)
angle = Math.atan2(first_point.x * second_point.y - first_point.y * second_point.x),
bbpDot(first_point, second_point)
angle = 0.0 if angle.abs < Flo... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_between(vector2)\n end",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n ... | [
"0.81055534",
"0.80382556",
"0.7801375",
"0.7702591",
"0.7689826",
"0.76575166",
"0.76072717",
"0.7586406",
"0.7580598",
"0.75393635",
"0.7453534",
"0.7419655",
"0.7391849",
"0.7306327",
"0.7305199",
"0.7291392",
"0.72645485",
"0.72645485",
"0.7211314",
"0.7210488",
"0.719127... | 0.6203242 | 80 |
Angle in radians between two vector directions | def bbAngle(first_point, second_point)
angle = Math.acos(bbpDot(bbpNormalize(first_point), bbpNormalize(second_point)))
angle = 0.0 if angle.abs < Float::EPSILON
angle
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def angle_between(vector2)\n end",
"def vector_angle(v1,v2)\n vcross = v1.x*v2.y-v1.y*v2.x\n vdot = v1.x*v2.x+v1.y*v2.y\n val = vcross/Math.sqrt(v1.sq_abs*v2.sq_abs)\n if val.abs >1\n val = val/val.abs*1 \n end\n if vdot >= 0\n return Math.asin(val)\n elsif vcross !=0\n ... | [
"0.8126939",
"0.79380625",
"0.7685851",
"0.7664685",
"0.7617983",
"0.75961065",
"0.7593238",
"0.7590905",
"0.7569185",
"0.75284314",
"0.7432653",
"0.7422392",
"0.7407691",
"0.7346465",
"0.72886753",
"0.7285471",
"0.7284536",
"0.7276019",
"0.72624725",
"0.7215825",
"0.7211321"... | 0.5976479 | 93 |
Rotates a point counterclockwise by the angle around the pivot | def bbpRotateByAngle(first_point, pivot_point, angle)
rotation_point = bbpSub(first_point, pivot_point)
cosine = Math.cos(angle)
sine = Math.sin(angle)
rotation_point.x = rotation_point.x * cosine - rotation_point.y * sine + pivot_point.x
rotation_point.y = rotation_point.y * ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rotate_around_point(angle, point)\n Point.new(x - point.x, y - point.y).rotate_around_origin(angle) + point\n end",
"def rotate_around!(degrees, origin=Point.empty)\n result = self.to_point.rotate_around(degrees, origin)\n self.x = result.x\n self.y = result.y\n return result\n end",... | [
"0.7248794",
"0.67271066",
"0.6599568",
"0.65638596",
"0.65050906",
"0.6434806",
"0.63303524",
"0.62884986",
"0.6158123",
"0.6145699",
"0.61132485",
"0.6047556",
"0.6029288",
"0.5985884",
"0.5983372",
"0.5962268",
"0.5916851",
"0.5892418",
"0.5876767",
"0.58615625",
"0.585663... | 0.68556434 | 1 |
Evaluates if two lines intersect | def bbpLineIntersect(point_a, point_b, point_c, point_d, hit_point, second_hit_point)
rise 'Method not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def line_intersect_line?(line_one, line_two)\n x1 = line_one[:x]\n y1 = line_one[:y]\n x2 = line_one[:x2]\n y2 = line_one[:y2]\n\n x3 = line_two[:x]\n y3 = line_two[:y]\n x4 = line_two[:x2]\n y4 = line_two[:y2]\n\n uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2... | [
"0.8247894",
"0.7772005",
"0.7628501",
"0.74305266",
"0.7381992",
"0.71186286",
"0.7068122",
"0.70639986",
"0.70359206",
"0.68649346",
"0.682441",
"0.682441",
"0.682441",
"0.67931545",
"0.67787343",
"0.67739165",
"0.6758678",
"0.67294383",
"0.67094505",
"0.66632444",
"0.66612... | 0.6278195 | 42 |
Evaluates if two segments intersect | def bbpSegmentIntersect(point_a, point_b, point_c, point_d)
rise 'Method not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segments_intersect?(line_one, line_two)\n x1 = line_one[:x]\n y1 = line_one[:y]\n x2 = line_one[:x2]\n y2 = line_one[:y2]\n\n x3 = line_two[:x]\n y3 = line_two[:y]\n x4 = line_two[:x2]\n y4 = line_two[:y2]\n\n uA = ((x4-x3)*(y1-y3) - (y4-y3)*(x1-x3)) / ((y4-y3)*(x2-x1) - (x4-x3)*(y2-... | [
"0.80692124",
"0.77317417",
"0.7475792",
"0.71670705",
"0.71397436",
"0.71308225",
"0.7055296",
"0.7055296",
"0.7055296",
"0.70465744",
"0.7041045",
"0.7039989",
"0.7009764",
"0.6992662",
"0.69529015",
"0.6947749",
"0.6910738",
"0.6888599",
"0.6869334",
"0.685394",
"0.6851916... | 0.65056777 | 58 |
Intersection point between the two lines | def bbpIntersectPoint(point_a, point_b, point_c, point_d)
rise 'Method not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intersection_point(a1, a2, b1, b2)\n ip = nil\n bounds_x = bounds(a1.x, a2.x)\n bounds_y = bounds(a1.y, a2.y)\n # first line is horizontal\n if a1.y == a2.y\n # second line is vertical -> there can be an intersection\n if b2.x == b1.x\n ip = Coord2.new(b1.x, a1.y... | [
"0.7893033",
"0.78868705",
"0.7807138",
"0.7807138",
"0.7807138",
"0.7687287",
"0.7673673",
"0.7571107",
"0.7547628",
"0.752886",
"0.7523019",
"0.73884475",
"0.72077465",
"0.71428514",
"0.7095963",
"0.7085715",
"0.7065024",
"0.69384766",
"0.69384766",
"0.69384766",
"0.6927364... | 0.0 | -1 |
Create a simple calculator that first asks the user what method they would like to use (addition, subtraction, multiplication, division) and then asks the user for two numbers, returning the result of the method with the two numbers. Here is a sample prompt: ``` What calculation would you like to do? (add, sub, mult, d... | def multiply(num1, num2)
product = num1 * num2
puts product
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculator\n #ask user method\n puts \"What calculation would you like to do? (add, sub, mult, div)\"\n calc_type = gets.chomp\n\n #ask for first number\n puts \"What is number 1? where result = num_1 operator num_2\"\n num_1 = gets.chomp\n num_1 = num_1.to_f\n\n #ask for second number\... | [
"0.82320696",
"0.810565",
"0.800514",
"0.79812294",
"0.7980633",
"0.7968294",
"0.79512495",
"0.79336125",
"0.7907316",
"0.7862704",
"0.7850602",
"0.77073884",
"0.7673755",
"0.7651648",
"0.7569274",
"0.7549462",
"0.7530496",
"0.7498322",
"0.74729395",
"0.746625",
"0.7425919",
... | 0.0 | -1 |
The defaults for the params according to GEOS are as found in Geos::Constants::BUFFER_PARAMS_DEFAULTS. Note that when setting the :quad_segs value that you should set it before setting other values like :join and :mitre_limit, as GEOS contains logic concerning how the :quad_segs value affects these parameters and vice ... | def initialize(params = {})
params = Geos::Constants::BUFFER_PARAM_DEFAULTS.merge(params)
ptr = FFIGeos.GEOSBufferParams_create_r(Geos.current_handle_pointer)
@ptr = FFI::AutoPointer.new(
ptr,
self.class.method(:release)
)
@params = {}
VALID_PARAMETE... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setting_params\n params.require(:setting).permit(:bezier_max_curve, :bezier_curvature, :default_height, :default_width, :zoom)\n end",
"def default_params\n @default_params ||= {\n id: nil,\n class: name.gsub(/.*::/, '').downcase,\n width: nil,\n height: nil... | [
"0.515572",
"0.48531833",
"0.462743",
"0.46258438",
"0.46078947",
"0.46067494",
"0.4606167",
"0.45960718",
"0.4581581",
"0.45774236",
"0.45643172",
"0.45610422",
"0.4552181",
"0.45072454",
"0.4498685",
"0.4478453",
"0.4476902",
"0.4475943",
"0.4466533",
"0.44483262",
"0.44471... | 0.5105479 | 1 |
Before filter methods! Wahooooooooo | def signed_in_user
unless signed_in?
store_location
redirect_to signin_url, notice: "Please sign in."
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filter; end",
"def filter; end",
"def filter; end",
"def apply_filter\n end",
"def filters; end",
"def filters; end",
"def filter\n end",
"def filter!; end",
"def global_filter; end",
"def filters\n end",
"def filter\n super\n end",
"def filters=(_arg0); end",
"def filt... | [
"0.8104498",
"0.8104498",
"0.8104498",
"0.80617756",
"0.79952645",
"0.79952645",
"0.7917188",
"0.78179413",
"0.7641611",
"0.7589369",
"0.74890023",
"0.7323565",
"0.7323565",
"0.73092407",
"0.7305704",
"0.7288359",
"0.72125375",
"0.7141407",
"0.7139506",
"0.7139506",
"0.709833... | 0.0 | -1 |
Returns an array of system page settings for a given page, or nil if the page is not a system page. | def system_pages(pageid)
pages = Array.new
if self.site_default_page_id == pageid
pages << "Site default page"
end
if self.not_found_page_id == pageid
pages << "Not found page"
end
if self.permission_denied_page_id == pageid
pages << "Permission denied page"
end
if... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def system_pages(pageid)\n pages = []\n\n pages << 'Site default page' if site_default_page_id == pageid\n pages << 'Not found page' if not_found_page_id == pageid\n pages << 'Permission denied page' if permission_denied_page_id == pageid\n pages << 'Session expired page' if session_expired_page_id ... | [
"0.63217753",
"0.57905066",
"0.561234",
"0.5383338",
"0.5215765",
"0.5204456",
"0.5113689",
"0.5069442",
"0.5020878",
"0.5013927",
"0.49730808",
"0.49660733",
"0.49592885",
"0.49583194",
"0.49580768",
"0.49455833",
"0.4930409",
"0.4902087",
"0.4901235",
"0.4901235",
"0.490115... | 0.6515757 | 0 |
Prime number if we have a remainder from divding by 2 if any number is less than or = to 1 its not a prime retrun false Check all numbers inside on int greater than with no 1 remainder if there are any numbers with a remainder = to 0 returns false. Anything else return true. | def prime?(int)
if int <= 1
return false
else
if (2...int).any? {|n| int % n == 0}
return false
else
return true
end
end
binding.pry
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prime?(int)\n if int < 0 || int == 0 || int == 1 \n return false \n\n else\n (2...int).to_a.all? {|num| int % num != 0}\n\n end\nend",
"def prime?(integer)\n denominators = (2..integer - 1).to_a \n if integer < 2\n false \n else \n !(denominators.any? do |denominator| \n integer % denominat... | [
"0.83813685",
"0.81924623",
"0.8172267",
"0.8169794",
"0.81511885",
"0.81214017",
"0.79877347",
"0.79760754",
"0.79427046",
"0.7936402",
"0.7921487",
"0.7916965",
"0.7890027",
"0.7884787",
"0.78742445",
"0.78583807",
"0.7851414",
"0.7843667",
"0.784133",
"0.7840169",
"0.78391... | 0.0 | -1 |
GET /bet_events GET /bet_events.json | def index
@bet_events = BetEvent.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def past_events\n @events = Event.past\n render json: @events, include: :talks\n end",
"def events\n ... | [
"0.75706184",
"0.72222155",
"0.7174718",
"0.7149552",
"0.6972302",
"0.6961184",
"0.6932244",
"0.6913124",
"0.6913124",
"0.688856",
"0.6853928",
"0.68329096",
"0.68036115",
"0.67919356",
"0.6789172",
"0.6776667",
"0.67610884",
"0.6759066",
"0.6754364",
"0.6744936",
"0.67406684... | 0.74627596 | 1 |
GET /bet_events/1 GET /bet_events/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def index\n @bet_events = BetEvent.all\n end",
"def show\n event_id = params[:id]\n if event_id.prese... | [
"0.723407",
"0.7224591",
"0.68400234",
"0.6839644",
"0.6816163",
"0.67606205",
"0.67606205",
"0.6723486",
"0.67207307",
"0.6700286",
"0.66708946",
"0.6637529",
"0.6623586",
"0.66231763",
"0.6619626",
"0.66138554",
"0.66018945",
"0.6599718",
"0.6598707",
"0.6598473",
"0.659650... | 0.0 | -1 |
POST /bet_events POST /bet_events.json | def create
@bet_event = BetEvent.new(bet_event_params)
respond_to do |format|
if @bet_event.save
format.html { redirect_to @bet_event, notice: 'Bet event was successfully created.' }
format.json { render :show, status: :created, location: @bet_event }
else
format.html { rend... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n megam_rest.post_event(to_hash)\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def create\n @bid_event = BidEvent.new(bid_event_params)\n\n respond_to do |format|\n if @bid_event.save\n format.html { redirect_to :b... | [
"0.7019916",
"0.698915",
"0.68578",
"0.6826691",
"0.6800796",
"0.67466784",
"0.67004657",
"0.65758836",
"0.6567023",
"0.65334815",
"0.6467185",
"0.6444581",
"0.64424175",
"0.6384026",
"0.63432556",
"0.6330662",
"0.63117903",
"0.62887836",
"0.6283721",
"0.62824315",
"0.6258824... | 0.7436185 | 0 |
PATCH/PUT /bet_events/1 PATCH/PUT /bet_events/1.json | def update
respond_to do |format|
if @bet_event.update(bet_event_params)
format.html { redirect_to @bet_event, notice: 'Bet event was successfully updated.' }
format.json { render :show, status: :ok, location: @bet_event }
else
format.html { render :edit }
format.json { r... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j... | [
"0.7076487",
"0.6926341",
"0.68976146",
"0.6865526",
"0.6835411",
"0.6821394",
"0.6795086",
"0.67627156",
"0.6704636",
"0.6699893",
"0.6676711",
"0.66736054",
"0.66615593",
"0.6650696",
"0.6631071",
"0.6631071",
"0.6621161",
"0.6618187",
"0.66080695",
"0.66080695",
"0.6586594... | 0.7362955 | 0 |
DELETE /bet_events/1 DELETE /bet_events/1.json | def destroy
@bet_event.destroy
respond_to do |format|
format.html { redirect_to bet_events_url, notice: 'Bet event was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end",
"def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_updat... | [
"0.7055269",
"0.70502186",
"0.7048779",
"0.7048779",
"0.7048779",
"0.70203084",
"0.70112544",
"0.698227",
"0.6941624",
"0.693605",
"0.69297975",
"0.6914077",
"0.68994254",
"0.68961644",
"0.68787616",
"0.6847989",
"0.68315595",
"0.6820424",
"0.68196297",
"0.68196297",
"0.68196... | 0.7440448 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bet_event
@bet_event = BetEvent.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 bet_event_params
params.require(:bet_event).permit(:name, :description, :end_time, :status, :winning_option)
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 |
Time Complexity: worst case unbalancedO(n), balO(log n) Space Complexity: worst caseO(n), balO(log n) | def add(key, value)
if @root.nil?
@root = TreeNode.new(key, value)
else
self.add_helper(@root, key, value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dp_possible_trees(n)\n array = Array.new(n+2) { Array.new(n+1) { 0 } }\n (0...n+2).to_a.each do |i|\n array[i][0] = 1\n end\n\n sum = 0\n (1...n+1).to_a.each do |i|\n sum = 0\n (1..i).to_a.each do |j|\n array[j][i] = array[n+1][i-j] * array[n+1][j-1]\n sum += array[j][i]\n end\n a... | [
"0.6749766",
"0.6694612",
"0.65521675",
"0.65459865",
"0.65139204",
"0.65107286",
"0.65090346",
"0.65031624",
"0.6502448",
"0.6500158",
"0.6444817",
"0.6404294",
"0.6392507",
"0.6385821",
"0.6349334",
"0.63278955",
"0.63092405",
"0.63079727",
"0.6266411",
"0.6258028",
"0.6249... | 0.0 | -1 |
Time Complexity: unbalO(n), balO(log n) Space Complexity: unbalO(n), balO(log n) | def find(key, node=@root)
return nil if @root.nil?
if key < node.key
find(key, node.left)
elsif key > node.key
find(key, node.right)
else
return node.value
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def largest_subsum(list)\n max = list[0] # O(1)\n current_sum = list[0] # O(1)\n\n (1...list.length).each do |i| # O(n)\n # debugger\n if current_sum < ... | [
"0.6689499",
"0.66252846",
"0.6608882",
"0.6536004",
"0.6472593",
"0.639354",
"0.6358543",
"0.6353082",
"0.6312325",
"0.6282437",
"0.62745625",
"0.61915296",
"0.6188141",
"0.6153912",
"0.615093",
"0.61008793",
"0.60940546",
"0.60786766",
"0.60571593",
"0.60476863",
"0.6028064... | 0.0 | -1 |
Time Complexity: O(n) Space Complexity: O(n) | def inorder
return inorder_helper(@root, [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6914348",
"0.6609048",
"0.6416534",
"0.63194925",
"0.62016535",
"0.61871785",
"0.60697335",
"0.6059072",
"0.6053246",
"0.6047552",
"0.6037029",
"0.5990324",
"0.5985229",
"0.5983502",
"0.59483737",
"0.5907289",
"0.58986485",
"0.5894127",
"0.589302",
"0.5891029",
"0.5862035"... | 0.0 | -1 |
Time Complexity: O(n) Space Complexity: O(n) | def preorder
return preorder_helper(@root, [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6914348",
"0.6609048",
"0.6416534",
"0.63194925",
"0.62016535",
"0.61871785",
"0.60697335",
"0.6059072",
"0.6053246",
"0.6047552",
"0.6037029",
"0.5990324",
"0.5985229",
"0.5983502",
"0.59483737",
"0.5907289",
"0.58986485",
"0.5894127",
"0.589302",
"0.5891029",
"0.5862035"... | 0.0 | -1 |
Time Complexity: O(n) Space Complexity: O(n) | def postorder
return postorder_helper(@root, [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.6914348",
"0.6609048",
"0.6416534",
"0.63194925",
"0.62016535",
"0.61871785",
"0.60697335",
"0.6059072",
"0.6053246",
"0.6047552",
"0.6037029",
"0.5990324",
"0.5985229",
"0.5983502",
"0.59483737",
"0.5907289",
"0.58986485",
"0.5894127",
"0.589302",
"0.5891029",
"0.5862035"... | 0.0 | -1 |
Time Complexity: O(n) Space Complexity: O(1) | def height(node=@root)
node.nil? ? 0 : (1 + [height(node.right), height(node.left)].max)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend",
"def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\... | [
"0.694976",
"0.6588579",
"0.6424199",
"0.6335124",
"0.6161739",
"0.6147929",
"0.6099504",
"0.6064365",
"0.6057384",
"0.60377026",
"0.60375905",
"0.60064393",
"0.6004914",
"0.59991395",
"0.5913556",
"0.59077466",
"0.5884987",
"0.5877909",
"0.5872623",
"0.587165",
"0.58481",
... | 0.0 | -1 |
Optional Method Time Complexity: Space Complexity: | def bfs
raise NotImplementedError
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def optional; end",
"def maybe; end",
"def optional?\n @optional\n end",
"def optional?\n\t\t!required?\n\tend",
"def option(criteria = T.unsafe(nil)); end",
"def optimizable?\n super || !predicate.equal?(operation.predicate)\n end",
"def none?\n !any?\n end",
... | [
"0.5707122",
"0.5485201",
"0.5262127",
"0.51078975",
"0.5073516",
"0.50569075",
"0.504007",
"0.50215054",
"0.50030905",
"0.4978641",
"0.49346524",
"0.49229994",
"0.48666954",
"0.48421654",
"0.48361006",
"0.48277402",
"0.48255092",
"0.48205838",
"0.4816803",
"0.48151508",
"0.4... | 0.0 | -1 |
Produces nicer looking output than the default version of to_yaml(). | def to_yaml(indent_space_count = 0)
yaml = ""
longest_label_mapping_length =
@label_mappings.keys.inject(0) do |max_length, name|
(name.to_s.length > max_length) ? name.to_s.length : max_length
end
if @label_mappings.length > 0
yaml += " " * indent_space_count + "Kit:\n"
lju... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_yaml() end",
"def to_yaml\n # write yaml\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def to_yaml\n as_yaml.to_yaml\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_hash.to_yaml\n end",
"def to_yaml\n to_h.to_yaml\n end",
"def to_yaml\n ... | [
"0.8446178",
"0.803212",
"0.7844912",
"0.7818543",
"0.7773563",
"0.7773563",
"0.77124786",
"0.76795673",
"0.7645482",
"0.76129854",
"0.76129854",
"0.75533724",
"0.75095993",
"0.7488226",
"0.7460977",
"0.7456671",
"0.74064994",
"0.7332123",
"0.7295195",
"0.7294964",
"0.7282812... | 0.71047926 | 38 |
Load all sound files, bailing if any are invalid | def load_raw_sounds(kit_items)
raw_sounds = {}
kit_items.values.flatten.each do |sound_file_name|
begin
wavefile = WaveFile.open(sound_file_name)
rescue Errno::ENOENT
raise SoundFileNotFoundError, "Sound file #{sound_file_name} not found."
rescue StandardError
raise Inv... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def autoload_sounds(map_id, *args)\n table = Table[map_id]\n table&.each { |filename| preload_sound(filename) }\n args.each { |filename| preload_sound(filename) }\n flush_sound\n load\n end",
"def onload_function?\n !@sounds.empty?\n end",
"def initialize_sounds(sound_array,... | [
"0.632168",
"0.61810404",
"0.60749096",
"0.60512805",
"0.60444397",
"0.600298",
"0.6000305",
"0.59410244",
"0.57440823",
"0.56405604",
"0.5633457",
"0.56089115",
"0.5575711",
"0.5541119",
"0.5537759",
"0.552179",
"0.5509646",
"0.5505998",
"0.5498524",
"0.54924",
"0.5483705",
... | 0.6312347 | 1 |
Manipulate from_xml Hash, because xml_simple is not exactly what we want for Active Resource. | def from_xml_data(data)
if data.is_a?(Hash) && data.keys.size == 1
data.values.first
else
data
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _from_xml(xml)\n return XmlSimple.xml_in(xml, {\n 'ForceArray'=>['accessGroup'],\n 'GroupTags'=>{\n 'services'=>'service',\n 'metros'=>'metro',\n 'networkIdentifiers'=>'ni'\n },\n 'KeyAttr'=>['id','name']\n })\n end",
"def to_hash\n strip_content(xml.to_ha... | [
"0.6556407",
"0.65182066",
"0.6516992",
"0.6488448",
"0.6396287",
"0.63739157",
"0.6326933",
"0.63127947",
"0.6222862",
"0.61795354",
"0.6104043",
"0.60197496",
"0.5995353",
"0.5971147",
"0.5899489",
"0.58960176",
"0.58475167",
"0.5832227",
"0.58290184",
"0.5815823",
"0.58052... | 0.58212316 | 20 |
GET /bizowners_reviews GET /bizowners_reviews.json | def index
@bizowners_reviews = BizownersReview.all
@bizowner = Bizowner.find_by(user_id: current_user.id)
@job = Job.where(bizowner_id: @bizowner.id)
@all_my_applications= Application.where(job_id: @job.ids)
@applications = @all_my_applications.where(status: "Approved")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def reviews( params={} )\n reviews = get_connections(\"reviews\", params)\n return map_connections reviews, :to => Facebook::Graph::Review\n end",
... | [
"0.7248041",
"0.7162103",
"0.71511555",
"0.7151134",
"0.7071401",
"0.70493513",
"0.70466256",
"0.7005954",
"0.6984975",
"0.694246",
"0.69333225",
"0.6915938",
"0.6875688",
"0.6856291",
"0.6843426",
"0.6829027",
"0.6812107",
"0.67721426",
"0.6750895",
"0.67148155",
"0.6696975"... | 0.0 | -1 |
GET /bizowners_reviews/1 GET /bizowners_reviews/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def list_reviews(biz_id, index = 1, limit = 10)\n url = \"#{@@request_url}/Biz.listReviews?appid=#{@@appid}&ID=#{biz_id}&begin=#{index}&limit=#{limit}\"... | [
"0.73316205",
"0.7186765",
"0.71598315",
"0.70970446",
"0.69875133",
"0.69509554",
"0.6938352",
"0.6922606",
"0.69204634",
"0.6899729",
"0.68802834",
"0.6842671",
"0.6841928",
"0.6837107",
"0.6835942",
"0.6826453",
"0.6826453",
"0.68073285",
"0.67812777",
"0.6762676",
"0.6729... | 0.0 | -1 |
POST /bizowners_reviews POST /bizowners_reviews.json | def create
@bizowners_review = BizownersReview.new(bizowners_review_params)
@bizowners_review.update(jobseeker_id: current_user.id)
@bizowners_review.update(status: true)
respond_to do |format|
if @bizowners_review.save
format.html { redirect_to @bizowners_review, notice: 'Bizowners revie... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_bizowners_review\n @bizowners_review = BizownersReview.find(params[:id])\n end",
"def create\n @review = current_author.reviews.create(review_params)\n render json: @review, status: 201\n end",
"def create_review(booking, options = {})\n post(\"bookings/#{booking}/reviews\", reviews: ... | [
"0.716348",
"0.7099",
"0.6999252",
"0.68752074",
"0.6841291",
"0.6711891",
"0.66358954",
"0.65957695",
"0.65686494",
"0.65673083",
"0.65673083",
"0.65673083",
"0.6539914",
"0.6535224",
"0.65054387",
"0.649292",
"0.64909023",
"0.64634544",
"0.6442417",
"0.6442119",
"0.6435676"... | 0.71367687 | 1 |
PATCH/PUT /bizowners_reviews/1 PATCH/PUT /bizowners_reviews/1.json | def update
respond_to do |format|
if @bizowners_review.update(bizowners_review_params)
format.html { redirect_to @bizowners_review, notice: 'Bizowners review was successfully updated.' }
format.json { render :show, status: :ok, location: @bizowners_review }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def set_bizowners_review\n @bizowners_review = BizownersReview.find(params[:id])\n end",
"def update\n if @review.update(review_params)\n render json: @review\n else\n ren... | [
"0.7029843",
"0.67638874",
"0.67412204",
"0.66572",
"0.66552705",
"0.6631239",
"0.6615031",
"0.6615031",
"0.6615031",
"0.6598681",
"0.6573793",
"0.6558549",
"0.65508854",
"0.643109",
"0.6410844",
"0.6385509",
"0.6368146",
"0.6365947",
"0.6336368",
"0.63238716",
"0.63088965",
... | 0.7257163 | 0 |
DELETE /bizowners_reviews/1 DELETE /bizowners_reviews/1.json | def destroy
@bizowners_review.destroy
respond_to do |format|
format.html { redirect_to bizowners_reviews_url, notice: 'Bizowners review was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @review = reviewable.reviews.find(params[:id])\n @review.destroy\n\n respond_to do |format|\n format.html { redirect_to reviewable_reviews_url(reviewable) }\n format.json { head :no_content }\n end\n end",
"def _reviews_delete(id)\n delete id.to_s\n _response_status(204... | [
"0.7222543",
"0.71524435",
"0.71307576",
"0.7061688",
"0.70423967",
"0.70389396",
"0.7032896",
"0.7032896",
"0.7032896",
"0.7032896",
"0.7032896",
"0.7014298",
"0.7014298",
"0.7014298",
"0.6998336",
"0.6975926",
"0.6968421",
"0.6964715",
"0.6946135",
"0.6946135",
"0.6946135",... | 0.76944566 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_bizowners_review
@bizowners_review = BizownersReview.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 bizowners_review_params
params.require(:bizowners_review).permit(:bizowner_id, :jobseeker_id, :bizowner_review_star, :business_review_description, :job_end_date, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.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 |
Overwriting the sign_out redirect path method | def after_sign_out_path_for(resource_or_scope)
#new_user_session_path
send("new_#{resource_or_scope}_session_path")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_sign_out_path_for(resource_or_scope)\n '/signed_out'\n end",
"def after_sign_out_path_for(_resource_or_scope)\n '/'\n end",
"def after_sign_out_path_for(resource_or_scope); end",
"def signout_url\n {:controller => 'auth', :action => 'signout'}\n end",
"def after_sign_out_path_for(reso... | [
"0.8101773",
"0.8007423",
"0.7983717",
"0.79319686",
"0.7897884",
"0.7889105",
"0.78745323",
"0.78685343",
"0.78580767",
"0.78434205",
"0.78434205",
"0.78434205",
"0.78434205",
"0.7841263",
"0.78215253",
"0.7788318",
"0.7748518",
"0.77370673",
"0.77312046",
"0.77290326",
"0.7... | 0.0 | -1 |
Overrides setter method to preserve order in a second property. | def creator=(values)
super && self.ordered_creators = values.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_setter(other = nil)\n @inverse_setter ||= \"#{inverses(other).first}=\" unless inverses(other).blank?\n end",
"def attribute_to_set; end",
"def swap_with(other)\n self.class.base_class.transaction do\n old_position = position\n update_attribute(:position, other.... | [
"0.63330585",
"0.5616903",
"0.5567529",
"0.5545411",
"0.5532085",
"0.5528243",
"0.5437405",
"0.542757",
"0.5422451",
"0.5417597",
"0.54082537",
"0.5390351",
"0.53693163",
"0.53656995",
"0.53502274",
"0.5349154",
"0.530391",
"0.5287195",
"0.52777636",
"0.525203",
"0.52515835",... | 0.0 | -1 |
Overrides getter method to return the creators in the correct order. | def creator
return super if ordered_creators.blank?
JSON.parse(ordered_creators)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def creator\n creators = get_list(@xpaths[\"creators\"])\n return creators.map { |creator| { \"name\" => creator } }\n end",
"def creator=(values)\n super && self.ordered_creators = values.to_json\n end",
"def creator\n values = super\n values = MetadataHelper.ordered( ordered_valu... | [
"0.72476166",
"0.680586",
"0.673909",
"0.673909",
"0.65331525",
"0.63075495",
"0.6241273",
"0.6111725",
"0.60976344",
"0.6087208",
"0.6054422",
"0.6044149",
"0.59060365",
"0.5891707",
"0.5712999",
"0.55368185",
"0.55221415",
"0.547033",
"0.5451835",
"0.54227155",
"0.5419491",... | 0.7667489 | 0 |
Overrides setter method to preserve order in a second property. | def description=(values)
super && self.ordered_descriptions = values.to_json
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inverse_setter(other = nil)\n @inverse_setter ||= \"#{inverses(other).first}=\" unless inverses(other).blank?\n end",
"def attribute_to_set; end",
"def swap_with(other)\n self.class.base_class.transaction do\n old_position = position\n update_attribute(:position, other.... | [
"0.63330585",
"0.5616903",
"0.5567529",
"0.5545411",
"0.5532085",
"0.5528243",
"0.5437405",
"0.542757",
"0.5422451",
"0.5417597",
"0.54082537",
"0.5390351",
"0.53693163",
"0.53656995",
"0.53502274",
"0.5349154",
"0.530391",
"0.5287195",
"0.52777636",
"0.525203",
"0.52515835",... | 0.0 | -1 |
Overrides getter method to return the descriptions in the correct order. | def description
return super if ordered_descriptions.blank?
JSON.parse(ordered_descriptions)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values\n end",
"def description\n values = super\n values = MetadataHelper.ordered( ordered_values: self.description_ordered, values: values )\n return values... | [
"0.83918476",
"0.83918476",
"0.8246103",
"0.8174948",
"0.78293824",
"0.78293824",
"0.7518224",
"0.7518224",
"0.74579006",
"0.74172443",
"0.73905724",
"0.7305532",
"0.728809",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.72795415",
"0.... | 0.7655364 | 6 |
Override ActionController::Integration::Runner method_missing to keep RSpec be_ and have_ matchers working. | def method_missing(sym, *args, &block) # :nodoc:
return Spec::Matchers::Be.new(sym, *args) if sym.to_s.starts_with?("be_")
return has(sym, *args) if sym.to_s.starts_with?("have_")
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def integration_test()\n return [\"all\"]\n end",
"def perform_action_with_macro_stubs #:nodoc:\n @spec.send(:run_action!, run_with_expectations?) if @spec.send(:controller)\n end",
"def test_should_only_inject_test_runner_mediator_for_lauching_dtr\n DTR.inject\n assert Test::Unit::UI... | [
"0.5369722",
"0.53546184",
"0.5345501",
"0.53306067",
"0.5316047",
"0.52844465",
"0.5265524",
"0.525484",
"0.525484",
"0.5176735",
"0.5175517",
"0.5175517",
"0.5175517",
"0.51664907",
"0.51389277",
"0.51351213",
"0.51351213",
"0.5061017",
"0.5060949",
"0.5042363",
"0.50131947... | 0.49374482 | 22 |
Obsoleting a mapping means some rpmdiff runs might have become obsolete. This is processed after commit, rather than after save, because the result is affected by whether additional mappings have been added or rpmdiff runs scheduled. Therefore we should not obsolete runs until all modifications for the current transact... | def after_commit(mapping)
if obsoleted?(mapping)
RpmdiffRun.invalidate_obsolete_runs(mapping.errata)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def done_mapping(action)\n @free_tems[[@rindex_tems[action[:with]], action[:with]]] = true\n @reduce_queue[action[:output_id]] = true\n end",
"def map_finished\n @glade['toolbar_move'].sensitive = true\n @glade['toolbar_record_points'].sensitive = true\n @glade['toolbar_generate_map'].active = fa... | [
"0.5973264",
"0.5634405",
"0.5570432",
"0.54431766",
"0.5424279",
"0.5372686",
"0.5367098",
"0.5218875",
"0.5159295",
"0.51274323",
"0.5116516",
"0.5055448",
"0.5043109",
"0.500815",
"0.49866515",
"0.4980493",
"0.49610144",
"0.4958997",
"0.4958873",
"0.49270946",
"0.4919359",... | 0.8321124 | 0 |
TestRail information about user in config file. | def initialize(config=nil)
super()
read_config(config) if !config.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_configuration\n @user_configuration ||=\n begin\n path = File.join(::Rails.root, 'config', 'sunspot.yml')\n if File.exist?(path)\n File.open(path) do |file|\n processed = ERB.new(file.read).result\n YAML.load(processed)[::Rai... | [
"0.6815838",
"0.68140435",
"0.67021185",
"0.66873443",
"0.66300595",
"0.6592775",
"0.6581757",
"0.64400613",
"0.64211804",
"0.6406034",
"0.638561",
"0.63472456",
"0.6314552",
"0.63047105",
"0.6299964",
"0.6291072",
"0.62194216",
"0.6217016",
"0.62151587",
"0.6166857",
"0.6150... | 0.0 | -1 |
find_by_external_id is forced from inheritance | def find_by_external_id(external_id)
case @artifact_type.to_s
when 'testcase'
begin
uri = "get_cases/#{@tr_project['id']}"
artifact_array = @testrail.send_get(uri)
rescue Exception => ex
RallyLogger.warning(self, "EXCEPTION occurred on TestRail API... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(object, parent = @base)\n raise NotImplementedError, \"Subclasses must implement public method find\"\n end",
"def find_record(xero_id)\n raise_must_override\n end",
"def find\n super.first\n end",
"def find(id)\n raise NotImplementedError\n end",
"def find_by_id(id... | [
"0.6990371",
"0.69078726",
"0.68735176",
"0.67421526",
"0.6627048",
"0.6615171",
"0.6553549",
"0.65004605",
"0.65004605",
"0.6387111",
"0.6359464",
"0.6314728",
"0.6292692",
"0.62690395",
"0.6245097",
"0.615858",
"0.6089748",
"0.6057772",
"0.6028378",
"0.6026412",
"0.6012471"... | 0.0 | -1 |
find and populated related data for plans | def find_test_plans()
begin
uri1 = "get_plans/#{@tr_project['id']}"
plan_shells = @testrail.send_get(uri1)
plans = []
plan_shells.each do |plan_shell|
uri2 = "get_plan/#{plan_shell['id']}"
plan = @testrail.send_get(uri2)
runs = []
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_plans\n if current_user.typeofuser == \"admin\" then\n @tenant = current_user.tenant\n @current_plan = @tenant.pricing_plan\n @selected_plan = PricingPlan.find(@tenant.selected_plan_id)\n @pricing_plans = PricingPlan.where(:plan_type => 'public')\n end\n end",
"def plans\n ... | [
"0.67854494",
"0.67136645",
"0.6692716",
"0.6522466",
"0.6518946",
"0.6517832",
"0.6485681",
"0.64851904",
"0.6479769",
"0.6475497",
"0.6392841",
"0.6374766",
"0.6337635",
"0.6333199",
"0.6333199",
"0.6270192",
"0.6261508",
"0.6203419",
"0.617966",
"0.61620694",
"0.6158879",
... | 0.6230956 | 17 |
raise "invalid argument" if (!test_cases.is_a? Integer and test_cases >= 0 and test_cases > 99999) count = 0 cases = [] while counter =0 and n > 40000000000000000) cases << n counter += 1 end | def fib(n)
return n if (0..1).include? n
fib(n-1) + fib(n-2)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def simber_count(n)\n lower_range = 10**(n - 1)\n upper_range = (10**n) - 1\n count = 0\n (lower_range..upper_range).each do |i|\n count += 1 if simber_check(i)\n end\n count\nend",
"def generatePossibleCombinationsCount(low, high)\n count = 0\n for number in (low..high)\n count += 1 if tes... | [
"0.6374789",
"0.63725317",
"0.6301914",
"0.6264777",
"0.6207574",
"0.60935545",
"0.6068085",
"0.603498",
"0.5992179",
"0.59838283",
"0.5919989",
"0.5858347",
"0.58519953",
"0.58472663",
"0.5815369",
"0.58120805",
"0.58097696",
"0.58052784",
"0.57933944",
"0.57888865",
"0.5778... | 0.0 | -1 |
calculate the last possible reservation date based on all current price policies associated with this instrument | def last_reserve_date
(Time.zone.now.to_date + max_reservation_window.days).to_date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def init_price_policy\n @start_date = start_date_from_params\n\n @price_policy = @product\n .price_policies\n .for_date(@start_date)\n .first\n end",
"def last_payment_due_on\n entry = workshop_price.specific_payment_schedule(initial_paymen... | [
"0.5751576",
"0.5749396",
"0.56607026",
"0.56480443",
"0.55638945",
"0.55220366",
"0.5513777",
"0.5502743",
"0.548693",
"0.5477138",
"0.5470819",
"0.5432807",
"0.5427598",
"0.53897786",
"0.53612137",
"0.53344107",
"0.53339636",
"0.5318268",
"0.5316101",
"0.53052264",
"0.53042... | 0.66259307 | 0 |
Get the most recent show created for a user | def current_show
shows.order('created_at DESC').first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_recent_view\n shows = Show.joins(:interests).where('interests.user_id' => self.id,\n 'interests.click' => [0,1]).order('interests.created_at DESC').limit(5)\n return shows.all\n end",
"def recent\n self.order('created_at DESC')\n end",
"def... | [
"0.6737024",
"0.6666001",
"0.63969785",
"0.6387438",
"0.63084865",
"0.6206757",
"0.61690277",
"0.6145733",
"0.61400074",
"0.6044594",
"0.6039638",
"0.60305357",
"0.6007029",
"0.60060525",
"0.5985517",
"0.5974664",
"0.59687203",
"0.59336776",
"0.5930878",
"0.59305674",
"0.5917... | 0.7298948 | 0 |
Selects the closest DJ slot to the current time should a user have more than one | def current_dj_slot
dj_slots.order('created_at DESC').order("ABS(start_time - #{Time.now.to_i})").first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_time_slot\n time_slot = check_club_times(next_user_time)\n\n if valid_tee_time?(time_slot)\n time_slot\n else\n go_to_next_day(time_slot)\n end\n end",
"def best_time(event)\n registrant_best_times.find_by(event: event) || registrant_choices.joins(:event_choice).merge(EventChoi... | [
"0.6392387",
"0.57438064",
"0.5517033",
"0.5349754",
"0.5348736",
"0.528312",
"0.5281394",
"0.5247513",
"0.52429277",
"0.52361834",
"0.51702213",
"0.5166689",
"0.51439786",
"0.51199365",
"0.51167697",
"0.5107501",
"0.50958717",
"0.507991",
"0.50675017",
"0.5062232",
"0.506109... | 0.61272323 | 1 |
the name properly capitalized. Hint: use str.upcase and str.downcase "abc".upcase => "ABC" | def format_name(str)
names = str.split (" ")
new_name = []
names.each do |name|
new_name << name[0].upcase + name[1..-1].downcase
# 2nd character to end (-1 last character of string)
end
return new_name.join(" ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capitalize_name\n self.name = name.sub(/\\S/, &:upcase) unless name.nil?\n end",
"def downcase_name\n name.downcase!\n end",
"def capitalized\n name.titleize.capitalize\n end",
"def normalize_name(name)\n CapitalizeNames.capitalize(name)\n end",
"def case_fix(name)\r\n fixed_name = nam... | [
"0.826947",
"0.82313806",
"0.8164194",
"0.81046695",
"0.80639523",
"0.8053243",
"0.80069137",
"0.7996569",
"0.7979893",
"0.7925619",
"0.7909197",
"0.79032665",
"0.789989",
"0.7863901",
"0.78248316",
"0.7742646",
"0.7738932",
"0.76848084",
"0.7670652",
"0.7653194",
"0.7649761"... | 0.0 | -1 |
shows printable login instructions for the user | def login_instructions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def displayLoginPage()\n\t# User Name: \n\t# Password:\n\t# Forgot Password?\tNew User?\n\treturn\nend",
"def login_display\n\t\tsystem(\"clear\")\n puts \"#######################\"\n puts \"# #\"\n puts \"# Welcome!! #\"\n puts \"# #\... | [
"0.7929269",
"0.74776876",
"0.70084953",
"0.6800409",
"0.6776907",
"0.66853034",
"0.66683584",
"0.6615448",
"0.6559028",
"0.6554196",
"0.6551497",
"0.65334314",
"0.65079224",
"0.64685035",
"0.6466299",
"0.6453437",
"0.6450038",
"0.6449188",
"0.636479",
"0.6359046",
"0.6359046... | 0.77138 | 1 |
exports the selected users to VCF format | def export
respond_to do |format|
format.vcf do
@users = params[:selected] ? load_selected_objects(User) : []
render(:text => @users.collect{|u| u.to_vcf}.join("\n"))
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hv_export_users(oHarvest, iDbg = 0)\n\n\tusers = oHarvest.users.all\n\n summary = Array.new()\n\n\tusers.each do |u|\n if (u.is_active == true && u.is_admin == false)\n p_user = Array.new(5)\n p_user[0] = u.first_name\n p_user[1] = u.id\n p_user[2] = u.emai... | [
"0.6759344",
"0.61193556",
"0.61078185",
"0.6103604",
"0.6096816",
"0.6092567",
"0.60069114",
"0.5913457",
"0.5908916",
"0.5898633",
"0.58735096",
"0.57904845",
"0.574313",
"0.57165915",
"0.56250036",
"0.5602154",
"0.5594625",
"0.5554911",
"0.55420506",
"0.55395424",
"0.55322... | 0.82592916 | 0 |
sets the current user's current mission to the last one used, and redirects to home page for that mission | def exit_admin_mode
if m = Mission.where(:id => session[:last_mission_id]).first
current_user.change_mission!(m)
end
redirect_to(root_url(:admin_mode => nil))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def home\n logger.info \"Got in action home in account controller\"\n @force_refresh_on_login = true\n \t@user = get_user\n @level = @user.get_level\n if(@level)\n next_level = @level.get_next_level\n if(next_level)\n @points_required = next_level.points_required - @user.total_points\... | [
"0.6688225",
"0.64438695",
"0.63228786",
"0.63144314",
"0.6178096",
"0.60388565",
"0.6022043",
"0.5977137",
"0.59042555",
"0.5891607",
"0.5871905",
"0.5836429",
"0.58280814",
"0.580259",
"0.57653016",
"0.57653016",
"0.57653016",
"0.57653016",
"0.5757574",
"0.5714365",
"0.5698... | 0.6690001 | 0 |
if we need to print instructions, redirects to the instructions action. otherwise redirects to index. | def handle_printable_instructions
if @user.reset_password_method == "print"
# save the password in the flash since we won't be able to get it once it's crypted
flash[:password] = @user.password
redirect_to(:action => :login_instructions, :id => @user.id)
else
redirect_to(inde... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doInstructions\n # do absolutely nothing at all... just render instructions\n end",
"def index\t\n # select help page to display\n if params[:ctrl] and @help_config['pages'][params[:ctrl]]\n if params[:page] and @help_config['pages'][params[:ctrl]][params[:page]]\n template = @help_conf... | [
"0.6123204",
"0.6071822",
"0.606791",
"0.57764775",
"0.5775483",
"0.5719447",
"0.5703976",
"0.5703976",
"0.5698535",
"0.5688436",
"0.5686752",
"0.5685302",
"0.5676001",
"0.56650096",
"0.5664012",
"0.5658744",
"0.56472737",
"0.56472737",
"0.56472737",
"0.56472737",
"0.56472737... | 0.58313113 | 3 |
prepares objects and renders the form template | def prepare_and_render_form
# create a blank mission assignment with the appropriate user_id for the boilerplate, but don't add it to the collection
@blank_assignment = Assignment.new(:active => true, :user_id => current_user.id)
# get assignable missons and roles for this user
@assignable_miss... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def render_iform\n @multi_objs.each do |obj|\n render :partial => 'iform', :object => obj\n end\n end",
"def prepare_and_render_form\n # get the users to which this response can be assigned\n # which is the users in this mission plus admins\n # (we need to include admins because they c... | [
"0.63980484",
"0.62180907",
"0.6200056",
"0.61610985",
"0.61573195",
"0.6121554",
"0.6108118",
"0.61065423",
"0.6020349",
"0.601631",
"0.5942688",
"0.5923766",
"0.5922497",
"0.591604",
"0.5901583",
"0.5896768",
"0.5837195",
"0.58136594",
"0.5799107",
"0.5791167",
"0.57859015"... | 0.62594646 | 1 |
builds a user with an appropriate mission assignment if the current_user doesn't have permission to edit a blank user | def build_user_with_proper_mission
@user = User.new(params[:user])
if cannot?(:create, @user) && @user.assignments.empty?
@user.assignments.build(:mission => current_mission, :active => true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_user_to_edit\n not_allow if (@job.user.id != current_user.id) \n end",
"def this_user!\n this_user || User.new(permission: :unapproved)\n end",
"def user(*args)\n super(*args) || build_user\n end",
"def give_access_to_creator\n user = User.current_user\n unless user.b... | [
"0.6445584",
"0.6189405",
"0.61245555",
"0.6121595",
"0.61079115",
"0.6078407",
"0.6075983",
"0.60514605",
"0.60167074",
"0.59241086",
"0.58772975",
"0.584203",
"0.58088946",
"0.58012784",
"0.57821715",
"0.57442886",
"0.5731034",
"0.5730324",
"0.5723996",
"0.57061094",
"0.569... | 0.78913254 | 0 |
GET /admin/news GET /admin/news.json | def index
@news = News.unscoped.order(created_at: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @admin_useful_news = Admin::UsefulNews.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_useful_news }\n end\n end",
"def index\n @news = News.all\n \n respond_to do |format|\n format.html # index.html.e... | [
"0.76681626",
"0.751364",
"0.7492779",
"0.7442193",
"0.7378122",
"0.73574585",
"0.7304973",
"0.7304973",
"0.7304973",
"0.7304973",
"0.72759384",
"0.72544456",
"0.72467923",
"0.7184177",
"0.7107979",
"0.7053882",
"0.7053882",
"0.7053882",
"0.7053882",
"0.70241797",
"0.7016415"... | 0.0 | -1 |
POST /admin/news POST /admin/news.json | def create
@news = News.new(news_params)
if @news.save
redirect_to admin_news_index_path, notice: 'Новость успешно добавлена!'
else
render :new
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @admin_news = Admin::News.new(admin_news_params)\n\n respond_to do |format|\n if @admin_news.save\n format.html { redirect_to session['previous_url'] || admin_news_index_url, notice: 'News è stato creato con successo.' }\n format.json { render :show, status: :created, location... | [
"0.77736366",
"0.7676479",
"0.7631418",
"0.7615547",
"0.7609859",
"0.7413583",
"0.73993707",
"0.7390492",
"0.73892623",
"0.738267",
"0.73760337",
"0.7309467",
"0.72660184",
"0.72549134",
"0.72340685",
"0.72312516",
"0.7191794",
"0.71420455",
"0.7114383",
"0.7114383",
"0.71024... | 0.7149445 | 17 |
PATCH/PUT /admin/news/1 PATCH/PUT /admin/news/1.json | def update
if @news.update(news_params)
redirect_to admin_news_index_path, notice: 'Новость успешно отредактированна!'
else
render :edit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @news = News.find(params[:id])\n pt = params[:news]\n @news.node_id = pt[:node_id]\n @news.title = pt[:title]\n @news.body = pt[:body]\n\n respond_to do |format|\n if @news.update_attributes(params[:news])\n format.html { redirect_to @news, notice: t(\"news.update_news_su... | [
"0.6849178",
"0.68208855",
"0.6757747",
"0.6724604",
"0.6692453",
"0.6686013",
"0.66364336",
"0.66312397",
"0.66067886",
"0.66059685",
"0.6570141",
"0.655431",
"0.6538015",
"0.6535931",
"0.6482358",
"0.6475982",
"0.64731276",
"0.6469534",
"0.6393496",
"0.6391767",
"0.6391753"... | 0.61059034 | 49 |
DELETE /admin/news/1 DELETE /admin/news/1.json | def destroy
if @news.removed? || @news.draft?
@news.destroy
respond_to do |format|
format.html { redirect_to admin_news_index_path, notice: 'Новость успешно удалена!' }
format.json { head :no_content }
end
else
@news.removed!
respond_to do |format|
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @news.destroy\n respond_to do |format|\n format.html { redirect_to admin_news_index_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admins_news.destroy\n respond_to do |format|\n format.html { redirect_to admins_news_index_url }\n format.j... | [
"0.78717",
"0.76353323",
"0.7624624",
"0.7596042",
"0.75712144",
"0.7557445",
"0.7556464",
"0.7556464",
"0.7552589",
"0.75351554",
"0.75295657",
"0.7519029",
"0.7519029",
"0.7519029",
"0.7519029",
"0.750463",
"0.7489218",
"0.7469574",
"0.74254876",
"0.74225926",
"0.73611635",... | 0.7256617 | 33 |
Use callbacks to share common setup or constraints between actions. | def set_news
@news = News.unscoped.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 news_params
params.require(:news).permit(:user_id, :title, :description, :text, :youtube_url, :youtube_data, :status, :happened_at, location_attributes: [:address, :lat, :lng])
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 |
type could be ladp, horizon or mozy | def initialize(subdomain = nil, type = 'mozy')
@subdomain = subdomain
@type = type
self.class.set_url("https://#{@subdomain}.mozypro.com/login/user")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bike_type(type)\n if type == 1\n @discipline = \"mountain\"\n @frame = \"mountain\"\n elsif type == 2\n @discipline = \"road\"\n @frame = \"road\"\n else\n @discipline = \"cyclo-cross\"\n @frame = \"cyclo-cross\"\n end\n @discipline\n @frame\n end",
"def set_t... | [
"0.66726726",
"0.6429254",
"0.6274507",
"0.60714024",
"0.60548383",
"0.60228145",
"0.59751844",
"0.5972987",
"0.59055114",
"0.584823",
"0.58131075",
"0.57939947",
"0.57939947",
"0.57897425",
"0.5745344",
"0.5742331",
"0.5742331",
"0.5742331",
"0.5742331",
"0.5742331",
"0.5742... | 0.0 | -1 |
Public: get authentication failed text Example | def authentication_failed
authentication_failed_msg.text
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failure\n msg_returned = request.params['message']\n login_failed msg_returned.nil? ? 'Auth0 login failed.' : msg_returned\n end",
"def auth_fail\n fail(Kankri::AuthenticationFailure)\n end",
"def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end",
"def failed_text\n... | [
"0.70768714",
"0.6796995",
"0.67547995",
"0.661294",
"0.65412235",
"0.6400311",
"0.63880616",
"0.63739234",
"0.63640934",
"0.6360568",
"0.63569385",
"0.63567924",
"0.6341098",
"0.63234943",
"0.6297755",
"0.6274246",
"0.62717766",
"0.62691784",
"0.62691784",
"0.62536037",
"0.6... | 0.83829266 | 0 |
Create recap daily new job for freelancer | def recap_daily_for_new_job(options)
job = Job.find options['job_id']
admin_user = User.find options['admin_user_id']
skills = job.skills.map(&:id)
freelancers = FreelancerMember.where(email_validation_key: nil, email_notif_new_job: true, disabled: false)
freelancers = freelancers.any_in(skill_ids:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @job = Job.new(job_params)\n\n respond_to do |format|\n if @job.save\n if params[:type] != 'none'\n clone_job = @job\n (1..params[:repeats].to_i).each do |index|\n clone_job = clone_job.dup\n case params[:type]\n when 'weekly'\n ... | [
"0.5962915",
"0.5694462",
"0.56267154",
"0.5614001",
"0.5589156",
"0.5584245",
"0.55645454",
"0.5520627",
"0.5513501",
"0.5476041",
"0.54527223",
"0.54451644",
"0.5435867",
"0.53940177",
"0.53802115",
"0.5376032",
"0.53745383",
"0.5354971",
"0.5348687",
"0.53439045",
"0.53347... | 0.74750215 | 0 |
initialize the class with token and user to be used in class | def initialize(query)
@query = query
# move to credentials
@client_id = '70166a8803b64e91b28581c88583ec25'
@client_secret = '3e785abde5174e91ac592e08baaa7af5'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n setup_token\n end",
"def initialize(user_id, token)\n @user_id = user_id\n @token = token\n @errors = []\n end",
"def initialize\n auth_login_response = auth.login_with_token(EbanqApi.token,\n EbanqApi.secret)\n @... | [
"0.79834646",
"0.7637542",
"0.75113356",
"0.7397314",
"0.7360093",
"0.7315877",
"0.7315877",
"0.7315877",
"0.72931236",
"0.7284194",
"0.72416836",
"0.7234975",
"0.72228694",
"0.71283907",
"0.71261835",
"0.712317",
"0.7115026",
"0.71148515",
"0.7057356",
"0.7041217",
"0.703293... | 0.0 | -1 |
display executed process of log as the name of the associated task | def exc_process
self.task.name rescue 'No associated task!'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end",
"def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n els... | [
"0.76715034",
"0.7146184",
"0.69054306",
"0.6739442",
"0.6714096",
"0.66814494",
"0.6627756",
"0.6586225",
"0.65422004",
"0.6248001",
"0.622084",
"0.6180432",
"0.61715424",
"0.61617327",
"0.6156669",
"0.61336595",
"0.6077837",
"0.60668504",
"0.6047268",
"0.60148144",
"0.59549... | 0.66913104 | 5 |
Find a GPU or CPU associated with the first available platform | def create_device()
# Identify a platform
platforms_buf = ' ' * 4 * 32
err = clGetPlatformIDs(1, platforms_buf, nil)
platform = platforms_buf.unpack("L")[0]
abort("Couldn't identify a platform") if err < 0
# Access a device
dev_buf = ' ' * 4 * 32
err = clGetDeviceIDs(platform, CL_DEVICE_TYPE_GPU, 1, de... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def scan\n # start with the platform/families who have no families (the top levels)\n top = Train::Platforms.top_platforms\n top.each do |_name, plat|\n # we are doing a instance_eval here to make sure we have the proper\n # context with all the detect helper methods\n next unle... | [
"0.673341",
"0.6555816",
"0.6337557",
"0.62803143",
"0.6276857",
"0.6262905",
"0.6216449",
"0.6175457",
"0.6170042",
"0.6135426",
"0.61042666",
"0.61007124",
"0.60335356",
"0.60184044",
"0.6013356",
"0.6010757",
"0.6008459",
"0.5994639",
"0.59619784",
"0.5946652",
"0.5807925"... | 0.62612396 | 6 |
Create program from a file and compile it cl_context : ctx, cl_device_id : dev, const char : filename | def build_program(ctx, dev, filename)
abort("Couldn't find the program file") if not File.exists?(filename)
# Read program file and place content into buffer
program_buffer = File.read(filename)
# Create program from file
err_buf = ' ' * 4
program = clCreateProgramWithSource(ctx, 1, [program_buffer].pack(... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(context, owner, file)\n# puts \"calling Compiler on #{file}\"\n @context = context\n @owner = owner\n @file = file\n utterance = ''\n File.open(file) do |f|\n f.each_line { |l| utterance << l }\n end\n # Since this is a new compiler, we need to wipe out any old compiler ... | [
"0.65367967",
"0.6505419",
"0.63124365",
"0.6304905",
"0.6125393",
"0.6015751",
"0.59490794",
"0.59259504",
"0.590439",
"0.5820284",
"0.5788388",
"0.5764231",
"0.5763001",
"0.56604654",
"0.5652333",
"0.56488615",
"0.5647147",
"0.56413776",
"0.56231606",
"0.56026995",
"0.55990... | 0.7472702 | 0 |
drops and recreates the repository upwards to match model definitions | def auto_migrate!(repository_name = nil)
auto_migrate_down!(repository_name)
auto_migrate_up!(repository_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def wipe!\n resource_factory.orm_class.delete_all\n end",
"def recreate\n drop if exists?\n create\n end",
"def auto_migrate_down!(repository_name = self.repository_name)\n assert_valid\n if base_model == se... | [
"0.639126",
"0.62017536",
"0.60449237",
"0.6027914",
"0.6019219",
"0.6000072",
"0.59205836",
"0.59133565",
"0.5908567",
"0.5843638",
"0.58156765",
"0.57163525",
"0.5710001",
"0.5706957",
"0.5704037",
"0.5702099",
"0.56854624",
"0.567664",
"0.5653754",
"0.56279075",
"0.5616560... | 0.0 | -1 |
Returns whether the storage_name exists. | def storage_exists?(storage_name)
statement = <<-SQL.compress_lines
SELECT COUNT(*)
FROM "information_schema"."tables"
WHERE "table_type" = 'BASE TABLE'
AND "table_schema" = ?
AND "table_name" = ?
SQL
query(statement, schema_name, storage_name).... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def storage_exists?(storage_name)\n adapter.storage_exists?(storage_name)\n end",
"def storage_exists?\n File.exists?(file_path)\n end",
"def storage_exists?(storage_name)\n statement = <<-EOS.compress_lines\n SELECT COUNT(*)\n FROM `information_schema`.`columns`\n ... | [
"0.88591945",
"0.82302403",
"0.80905616",
"0.80009574",
"0.7941318",
"0.78460103",
"0.7721265",
"0.7615959",
"0.74903995",
"0.74706876",
"0.7453015",
"0.73492277",
"0.73485243",
"0.724435",
"0.71824926",
"0.7099948",
"0.7092438",
"0.69954437",
"0.6970955",
"0.6970955",
"0.697... | 0.82422173 | 1 |
Returns whether the field exists. | def field_exists?(storage_name, column_name)
statement = <<-SQL.compress_lines
SELECT COUNT(*)
FROM "information_schema"."columns"
WHERE "table_schema" = ?
AND "table_name" = ?
AND "column_name" = ?
SQL
query(statement, schema_name, storage_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_field?(field_name); end",
"def field_exists?(storage_name, field_name)\n true\n end",
"def has_field?(name)\n fields.key?(name.to_sym)\n end",
"def field_exists?(name)\n @fields.key?(name.to_s) || @fields.key?(name.to_sym)\n end",
"def has_field(field_name)\n\t\tend",
"def... | [
"0.82142496",
"0.8206393",
"0.8187201",
"0.807928",
"0.7908975",
"0.7719411",
"0.76879257",
"0.7677455",
"0.7568323",
"0.75506216",
"0.75404656",
"0.75358814",
"0.75082475",
"0.7489551",
"0.74803853",
"0.7461857",
"0.7398311",
"0.7377883",
"0.7287726",
"0.7144906",
"0.7103048... | 0.68711036 | 27 |
Destructively automigrates the datastore to match the model. First migrates all models down and then up. REPEAT: THIS IS DESTRUCTIVE | def auto_migrate!
DataMapper.auto_migrate!(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n DataMapper.auto_migrate!\n end",
"def migrate!\n @logger.fine('Dropping schema...')\n\n migrate(0) # migrate to version 0.\n migrate # migrate to latest version.\n end",
"def migrate_model(pg_model, mongo_model, transform = nil)\n attributes = pg_model.attribute_names\n... | [
"0.65622514",
"0.6364729",
"0.63607514",
"0.6336633",
"0.6294284",
"0.6189633",
"0.6035296",
"0.60217565",
"0.6014795",
"0.60144323",
"0.59986615",
"0.59983766",
"0.5940333",
"0.59013444",
"0.58998394",
"0.58998394",
"0.5865882",
"0.5846255",
"0.5831628",
"0.57997966",
"0.579... | 0.60883516 | 6 |
Safely migrates the datastore to match the model preserving data already in the datastore | def auto_upgrade!
DataMapper.auto_upgrade!(name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n DataMapper.auto_migrate!\n end",
"def migrate(_key, _options); end",
"def migrate\n raise NotImplementedError\n end",
"def upgrade_model_storage(repository, model)\n raise NotImplementedError\n end",
"def upgrade_model_storage(model)\n model = Persevere.... | [
"0.6307694",
"0.63037676",
"0.620898",
"0.6188834",
"0.61647195",
"0.61413324",
"0.6119254",
"0.60771936",
"0.60033345",
"0.5944799",
"0.5919913",
"0.58834183",
"0.58770525",
"0.5819666",
"0.5819666",
"0.5788523",
"0.57559085",
"0.5741714",
"0.57062846",
"0.57022655",
"0.5702... | 0.56488395 | 24 |
Destructively automigrates the datastore to match the model REPEAT: THIS IS DESTRUCTIVE | def auto_migrate!(repository_name = self.repository_name)
assert_valid
auto_migrate_down!(repository_name)
auto_migrate_up!(repository_name)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate_entities\n\n entity_keys = @source_redis.keys('entity:*')\n\n entity_keys.each do |entity_key|\n\n # TODO fix regex, check current code\n raise \"Bad regex for '#{entity_key}'\" unless entity_key =~ /\\Aentity:(#{ID_PATTERN_FRAGMENT})\\z/\n\n entity_id = $1\n\n entity_name = @source_redis... | [
"0.5940194",
"0.5831033",
"0.58073866",
"0.56877583",
"0.5611203",
"0.5587168",
"0.54824495",
"0.5469023",
"0.5445296",
"0.54272586",
"0.5425967",
"0.5419828",
"0.54131895",
"0.540629",
"0.5402696",
"0.53955317",
"0.537871",
"0.53362644",
"0.53297544",
"0.5322517",
"0.5319983... | 0.0 | -1 |
Safely migrates the datastore to match the model preserving data already in the datastore | def auto_upgrade!(repository_name = self.repository_name)
assert_valid
if base_model == self
repository(repository_name).upgrade_model_storage(self)
else
base_model.auto_upgrade!(repository_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n DataMapper.auto_migrate!\n end",
"def migrate(_key, _options); end",
"def migrate\n raise NotImplementedError\n end",
"def upgrade_model_storage(repository, model)\n raise NotImplementedError\n end",
"def upgrade_model_storage(model)\n model = Persevere.... | [
"0.6306328",
"0.63029623",
"0.62074786",
"0.618887",
"0.61652833",
"0.6141155",
"0.61196834",
"0.60771817",
"0.6002148",
"0.594506",
"0.59195113",
"0.588281",
"0.5877324",
"0.58196586",
"0.58196586",
"0.5790414",
"0.5755922",
"0.5740463",
"0.570519",
"0.57030845",
"0.57030845... | 0.5525518 | 35 |
Destructively migrates the datastore down, which basically deletes all the models. REPEAT: THIS IS DESTRUCTIVE | def auto_migrate_down!(repository_name = self.repository_name)
assert_valid
if base_model == self
repository(repository_name).destroy_model_storage(self)
else
base_model.auto_migrate_down!(repository_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup\n @models.reverse_each(&:destroy_all)\n end",
"def clean_database\n [Entry, Room, User].each do |model|\n model.delete_all\n end\nend",
"def down\n Widget.update_all data_table_id: nil\n\n [DataTableDataset, DataRow, DataTable].each do |clazz|\n clazz.delete_all\n end\n ... | [
"0.72942877",
"0.7023947",
"0.70191544",
"0.6929789",
"0.682968",
"0.68229425",
"0.6723844",
"0.66722655",
"0.6627511",
"0.65139985",
"0.65090877",
"0.64827055",
"0.64783454",
"0.64768165",
"0.64388156",
"0.64382845",
"0.63905615",
"0.6385152",
"0.6382948",
"0.6380324",
"0.63... | 0.69131345 | 4 |
Auto migrates the datastore to match the model | def auto_migrate_up!(repository_name = self.repository_name)
assert_valid
if base_model == self
repository(repository_name).create_model_storage(self)
else
base_model.auto_migrate_up!(repository_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def migrate\n DataMapper.auto_migrate!\n end",
"def auto_migrate!\n DataMapper.auto_migrate!(name)\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def auto_migrate!\n AutoMigrator.auto_migrate(name)\n end",
"def migrate(_key, _options); end"... | [
"0.77408165",
"0.7628361",
"0.69687873",
"0.69687873",
"0.6940014",
"0.6791717",
"0.67916423",
"0.67908585",
"0.67908585",
"0.67753434",
"0.6718737",
"0.66184133",
"0.64943",
"0.63606054",
"0.62686586",
"0.6070153",
"0.59762406",
"0.59577876",
"0.59354067",
"0.592575",
"0.592... | 0.65423596 | 12 |
def load_game? puts "would you like to load a game?(Y/n)" choice = gets.chomp if choice == "Y" File.open(saves/ open file and load that game in" else return end end | def game_play
find_word
board
load_game?
if @confirm != 'y'
game_intro
end
until game_end? || @incorrect_guess == 8
#p @the_word
guess
incorrect_guess?
hang_man_figure
update_board
save?
end
if game_end? != true
puts "\n" * 100
hang_man_figure
update_board
puts "SORRY, YOU LOST... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_game?\n\t\tputs \"Would you like to load a previously saved game\"\n\t\tputs \"(yes or no)\"\n\t\tanswer = gets.chomp.downcase\n\t\tif answer == \"yes\"\n\t\t\tload\n\t\telsif answer == \"no\"\n\t\t\treturn\n\t\telse\n\t\t\tputs \"I did not understand that answer, try again\"\n\t\t\tload_game?\n\t\tend\n\... | [
"0.864231",
"0.83405906",
"0.8307312",
"0.82509977",
"0.8129931",
"0.8129931",
"0.8039203",
"0.79747623",
"0.78824306",
"0.78609586",
"0.77445173",
"0.7728795",
"0.7718014",
"0.7355129",
"0.7342144",
"0.72420746",
"0.71203154",
"0.71180815",
"0.7105183",
"0.7084104",
"0.70147... | 0.0 | -1 |
Return the XML representation for this Command Object An example of a returned XML is: source test_app_otg2 /usr/bin/otg2 udp:dst_host 192.168.0.3 udp:local_host 192.168.0.2 OML_SERVER=tcp:10.0.0.200:3003 OML_EXP_ID=sandbox1 OML_NAME=source [Return] an XML element | def to_xml()
msg = REXML::Document.new
msg << REXML::Element.new("#{@type.to_s}")
msg.root << REXML::Element.new("GROUP").add_text("#{@group}") if @group != nil
msg.root << REXML::Element.new("ID").add_text("#{@procID}") if @procID != nil
msg.root << REXML::Element.new("PATH").add_text("#{@path... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_xml\n xml = String.new\n builder = Builder::XmlMarkup.new(:target => xml, :indent => 2)\n \n # Xml instructions (version and charset)\n builder.instruct!\n \n builder.source(:primary => primary_source) do\n builder.id(id, :type => \"integer\")\n builder.uri(u... | [
"0.62823147",
"0.5880475",
"0.5843234",
"0.5787618",
"0.5776589",
"0.5776446",
"0.5757343",
"0.57475954",
"0.57196045",
"0.5702211",
"0.5677292",
"0.56651944",
"0.5662018",
"0.5648687",
"0.56068736",
"0.55999875",
"0.55953646",
"0.55953646",
"0.5519342",
"0.5518673",
"0.55072... | 0.7094721 | 0 |
Create a new Command Object from a valid XML representation xmlDoc = an xml document (REXML::Document) object | def init_from_xml(xmlDoc)
@type = xmlDoc.expanded_name
xmlDoc.each_element("ID") { |e| @procID = e.text }
xmlDoc.each_element("GROUP") { |e| @group = e.text }
xmlDoc.each_element("PATH") { |e| @path = e.text }
xmlDoc.each_element("ARGSLINE") { |e| @cmdLineArgs = e.text }
xmlDoc.each_elemen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_from(xmlDoc)\n begin\n # Set the Type\n @attributes[:CMDTYPE] = xmlDoc.expanded_name.to_sym\n # Parse the XML object\n xmlDoc.each_element { |e|\n # For the OMLCONFIG tag, add the XML value to this Command Object\n if e.expanded_name.upcase.to_sym == :OMLCONFIG\n ... | [
"0.8127082",
"0.60267097",
"0.6018632",
"0.58527607",
"0.58104724",
"0.56506145",
"0.55867577",
"0.5557472",
"0.55316466",
"0.5443015",
"0.54217964",
"0.54052454",
"0.53603894",
"0.53555053",
"0.5344622",
"0.5335269",
"0.5335269",
"0.53278136",
"0.5327188",
"0.5321695",
"0.52... | 0.6694812 | 1 |
POST /arquivos POST /arquivos.json | def create
@arquivo = Arquivo.new(arquivo_params)
respond_to do |format|
if @arquivo.save
ligacao = UserArquivo.new
ligacao.arquivo_id = @arquivo.id
ligacao.user_id = current_user.id
ligacao.save!
format.html { redirect_to arquivos_url, notice: 'Arquivo was success... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @arquivo = Arquivo.new(params[:arquivo])\n @arquivo.save!\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: @arquivo.errors, status: :unprocessable_entity }\n end\n end",
"def import\n @obj = Node.create_sub_tree JSON.parse(F... | [
"0.5651235",
"0.5525996",
"0.5512189",
"0.5442466",
"0.5433059",
"0.5421903",
"0.54095733",
"0.53799355",
"0.5345019",
"0.5325539",
"0.52604806",
"0.52536565",
"0.5248293",
"0.5242015",
"0.5215727",
"0.5122442",
"0.51117253",
"0.50751",
"0.50690436",
"0.5064506",
"0.5064296",... | 0.5138629 | 15 |
TODO: Move this to a view model | def rule_text
"If #{trigger_value} #{'kid'.pluralize(trigger_value)}, price is $#{price.round}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def model\n self\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def model\n @model\n end",
"def list\n @view.listing\n end",
"def model\n end",
"def model; end",
"def model; end",
"def model; end",
"def model; end",
... | [
"0.5940752",
"0.59244764",
"0.59244764",
"0.59244764",
"0.59244764",
"0.5882347",
"0.5875775",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.58165586",
"0.5791741",
"0.5791741",
"0.5791741",
"0... | 0.0 | -1 |
index is in Bookshow | def cors_allow_all
headers['Access-Control-Allow-Origin'] = '*'
headers['Access-Control-Allow-Methods'] = 'POST, PUT, DELETE, GET, OPTIONS'
headers['Access-Control-Request-Method'] = '*'
headers['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @bookitems = Bookitem.all\n \n end",
"def index\n @booktypes = Booktype.all\n end",
"def index\n @bookitems = Bookitem.all\n end",
"def index\n @book_items = BookItem.all\n end",
"def index\n @book_items = BookItem.all\n end",
"def index\n @abooks = Abook.all\n end",
... | [
"0.6900465",
"0.6830157",
"0.68284994",
"0.677376",
"0.677376",
"0.67707205",
"0.6621979",
"0.65982276",
"0.6594332",
"0.6559083",
"0.6555713",
"0.65178776",
"0.65136594",
"0.65027237",
"0.6499718",
"0.6471594",
"0.6452202",
"0.6444897",
"0.6441645",
"0.6433792",
"0.6433792",... | 0.0 | -1 |
For certain objects you can get extra data by giving option `include_data`. For example with clips you can add `include_data: "list,via"`. | def fetch(options = {})
validate_collection_options(options)
collection_class.new(client.get(base_uri, options).body, client)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options = {})\n super(:include => { :member => { :only => [:name, :slug, :image_url] } })\n end",
"def as_json(options = {})\n super(options.merge(include: {\n user: { only: [ :name,:id ] }\n }\n ))\n end",
"def as_json(opt... | [
"0.6215839",
"0.5937635",
"0.5932647",
"0.5860626",
"0.5860626",
"0.5860626",
"0.5860626",
"0.5860626",
"0.5860626",
"0.5860626",
"0.5860626",
"0.585223",
"0.58469164",
"0.5835178",
"0.5830633",
"0.58296496",
"0.58296496",
"0.58296496",
"0.58287245",
"0.58287245",
"0.58199966... | 0.0 | -1 |
For certain objects you can get extra data by giving option `include_data`. For example with clips you can add `include_data: "list,via"`. | def [](resource_id, options = {})
response = client.get("#{base_uri}/#{resource_id}", options)
if response.success?
object_class.new(response.body, client)
else
raise Kippt::APIError.new("Resource could not be loaded: #{response.body["message"]}")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def as_json(options = {})\n super(:include => { :member => { :only => [:name, :slug, :image_url] } })\n end",
"def as_json(options = {})\n super(options.merge(include: {\n user: { only: [ :name,:id ] }\n }\n ))\n end",
"def as_json(opt... | [
"0.62151766",
"0.5936212",
"0.59310776",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5859129",
"0.5850901",
"0.5845498",
"0.58350766",
"0.5830211",
"0.5829227",
"0.5829227",
"0.5829227",
"0.58273095",
"0.58273095",
"0.58185536... | 0.0 | -1 |
GET /exceller_skills GET /exceller_skills.json | def index
@exceller_skills = ExcellerSkill.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skills = Skill.all\n\n render json: @skills\n end",
"def list_skills\n\t\trender json: Skill.where(language_id: params[:language_id]).to_json\n\tend",
"def test_get_skills_route\n render :json => get_profile_skills_for_profile(\"https://www.linkedin.com/in/marissamayer\").to_json\n end"... | [
"0.72437215",
"0.69939446",
"0.69771904",
"0.69594806",
"0.6926032",
"0.69106334",
"0.6888005",
"0.68848974",
"0.68437004",
"0.67712235",
"0.67507815",
"0.67087233",
"0.67087233",
"0.6645723",
"0.66445035",
"0.663061",
"0.652583",
"0.646758",
"0.6459422",
"0.64498496",
"0.643... | 0.7118699 | 1 |
GET /exceller_skills/1 GET /exceller_skills/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @skills = Skill.all\n\n render json: @skills\n end",
"def index\n @exceller_skills = ExcellerSkill.all\n end",
"def index\n @issue_skills = IssueSkill.all\n render json: @issue_skills\n end",
"def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n e... | [
"0.72847444",
"0.69850016",
"0.6938604",
"0.68935597",
"0.6888333",
"0.6878451",
"0.68780524",
"0.6842839",
"0.67772365",
"0.6758301",
"0.67424834",
"0.67182195",
"0.6695865",
"0.6695865",
"0.66105884",
"0.6603269",
"0.6530483",
"0.6509033",
"0.6509033",
"0.64886713",
"0.6476... | 0.0 | -1 |
POST /exceller_skills POST /exceller_skills.json | def create
@exceller_skill = ExcellerSkill.new(exceller_skill_params)
respond_to do |format|
if @exceller_skill.save
format.html { redirect_to @exceller_skill, notice: 'Exceller skill was successfully created.' }
format.json { render :show, status: :created, location: @exceller_skill }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @saved_skills, @unsaved_skills = [], []\n Skill.parse(params[:skills]).each do |skill|\n s = Skill.new(:name => skill, :user => current_user)\n begin\n s.save!\n @saved_skills << skill\n rescue\n @unsaved_skills << skill\n end\n end\n\n respond_to d... | [
"0.70029616",
"0.6847983",
"0.6817788",
"0.6723002",
"0.6631397",
"0.66188574",
"0.65925556",
"0.65810966",
"0.65613943",
"0.6559059",
"0.6549656",
"0.6543035",
"0.6491317",
"0.6480751",
"0.6476689",
"0.6459616",
"0.6455505",
"0.64239615",
"0.6409331",
"0.63952124",
"0.639326... | 0.7116777 | 0 |
PATCH/PUT /exceller_skills/1 PATCH/PUT /exceller_skills/1.json | def update
respond_to do |format|
if @exceller_skill.update(exceller_skill_params)
format.html { redirect_to @exceller_skill, notice: 'Exceller skill was successfully updated.' }
format.json { render :show, status: :ok, location: @exceller_skill }
else
format.html { render :edit ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @skill = Skill.find(params[:id])\n\n if @skill.update(skill_params)\n head :no_content\n else\n render json: @skill.errors, status: :unprocessable_entity\n end\n end",
"def update\n @admin_skill = Admin::Skill.find(params[:id])\n\n if @admin_skill.update(admin_skill_para... | [
"0.7214534",
"0.6989524",
"0.6974295",
"0.6955596",
"0.6872005",
"0.6822074",
"0.67629725",
"0.67629725",
"0.6707547",
"0.67037195",
"0.66876173",
"0.6681325",
"0.66789323",
"0.6641051",
"0.663954",
"0.66391915",
"0.6631356",
"0.66230756",
"0.6576388",
"0.65752184",
"0.657330... | 0.704656 | 1 |
DELETE /exceller_skills/1 DELETE /exceller_skills/1.json | def destroy
@exceller_skill.destroy
respond_to do |format|
format.html { redirect_to exceller_skills_url, notice: 'Exceller skill was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @person.skills.delete_all\n \n @person.destroy\n respond_to do |format|\n format.html { redirect_to people_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skill = Skill.find(params[:id])\n @skill.destroy\n\n respond_to do |format|\n form... | [
"0.75828826",
"0.73602176",
"0.7347549",
"0.72792685",
"0.7237351",
"0.72016656",
"0.7165082",
"0.70709085",
"0.7067639",
"0.70447236",
"0.7030396",
"0.7021501",
"0.7008043",
"0.6993563",
"0.6986223",
"0.696303",
"0.6962978",
"0.6951939",
"0.6942127",
"0.6935605",
"0.69344234... | 0.74782115 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_exceller_skill
@exceller_skill = ExcellerSkill.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6162554",
"0.60452986",
"0.5945278",
"0.59169763",
"0.58877826",
"0.5834763",
"0.5775349",
"0.5704972",
"0.5704972",
"0.56543803",
"0.5621491",
"0.5427202",
"0.54093206",
"0.54093206",
"0.54093206",
"0.53975695",
"0.53776276",
"0.53562194",
"0.5340594",
"0.5337824",
"0.532... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def exceller_skill_params
params.require(:exceller_skill).permit(:exceller_id, :skill_id, :proficiency, :created_by, :modified_by, :deleted_at)
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.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.