This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.divisors_count = function (n) { | |
var count = 0 | |
var bound = Math.floor(Math.sqrt(n)) | |
if (bound*bound == n) { | |
count = 1; | |
bound -= 1; | |
} | |
else if ((bound+1)*(bound+1) == n) { | |
count = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- control frame ---------- | |
c:0103 p:---- s:0452 b:0452 l:000451 d:000451 CFUNC :respond_to? | |
c:0102 p:0013 s:0448 b:0448 l:000447 d:000447 METHOD .../gems/activesupport-3.1.3/lib/active_support/core_ext/class/inheritable_attr | |
c:0101 p:---- s:0443 b:0443 l:000442 d:000442 FINISH | |
c:0100 p:0011 s:0441 b:0441 l:000440 d:000440 CLASS .../gems/mail-2.3.0/lib/mail/elements/content_type_element.rb:3 | |
c:0099 p:0009 s:0439 b:0439 l:000438 d:000438 TOP .../gems/mail-2.3.0/lib/mail/elements/content_type_element.rb:2 | |
c:0098 p:---- s:0437 b:0437 l:000436 d:000436 FINISH | |
c:0097 p:0027 s:0435 b:0435 l:000434 d:000434 METHOD .../gems/mail-2.3.0/lib/mail/fields/content_type_field.rb:37 | |
c:0096 p:0055 s:0432 b:0432 l:000431 d:000431 METHOD .../gems/mail-2.3.0/lib/mail/fields/content_type_field.rb:31 | |
c:0095 p:0165 s:0428 b:0428 l:000427 d:000427 METHOD .../gems/mail-2.3.0/lib/mail/fields/content_type_field.rb:23 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# When using the gems rspec_mocks and rspec_spies | |
class Widget | |
def a_method | |
'I am a method!' | |
end | |
end | |
describe Widget do | |
let(:item) {Widget.new} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin cylinder($width,$height,$proportion: .4) | |
position: relative | |
width: $width | |
height: $height | |
&:before, &:after | |
// only using chrome for now, so not adding in moz | |
-webkit-transform: scaley($proportion) | |
width: $width | |
height: $width | |
border-radius: $width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DiffObject | |
attr :left, :right | |
def initialize(left, right) | |
@left = left | |
@right = right | |
end | |
end | |
class Hash | |
# a_hash.deep_diff(b_hash) returns: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fails linter | |
myComponent1 = ({tintColor}) => <Image style={{tintColor}} /> | |
// passes linter | |
myComponent2 = ({tintColor}) => <Image style={{tintColor}} /> | |
myComponent2.propTypes = { | |
tintColor: PropTypes.string.isRequired | |
} | |
// fails linter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mockRootNavigator1 = function() { | |
return { | |
router: { | |
getComponentForState: jest.fn | |
} | |
} | |
} | |
function mockRootNavigator2() { | |
return { |