Menu
  • HOME
  • TAGS

Java check if two rectangles overlap at any point

java,math,selection,shapes,contain

This will find if the rectangle is overlapping another rectangle: public boolean overlaps (Rectangle r) { return x < r.x + r.width && x + width > r.x && y < r.y + r.height && y + height > r.y; } ...

Ruby Hash check is subset?

ruby,hash,subset,contain

The solution that came into my mind use Hash#merge method: class Hash def include_hash?(hash) merge(hash) == self end end hash = {a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7} hash.include_hash?({}) # => true hash.include_hash?(f: 6, c:3) # => true hash.include_hash?(f: 6, c:1) # =>...

Check if string contains JS in PHP

php,string,pattern-matching,preg-replace,contain

Why not use strip_tags from php? Link here.

Fastest way to check does string contain any word from list

python,string,list,contain

There is the any built-in function specially for that: >>> message = "sometext" >>> lista = ["a","b","c"] >>> any(a in message for a in lista) False >>> lista = ["a","b","e"] >>> any(a in message for a in lista) True Alternatively you could check the intersection of the sets: >>> lista...

Am I using puppet contain correctly?

dependencies,puppet,contain

I believe this is the correct way as per this article. Role: class roles::dev{ include profiles::phpwebserver include profiles::silex_api Class ['profiles::phpwebserver'] -> Class ['profiles::silex_api'] } Profile: class profiles::silex_api{ class { '::silex' : package_version => '1.6.2', } class {'::composer' : command_name => 'composer.phar', target_dir => '/var', user => 'root' } contain ::composer...

Insert html based on contain

javascript,jquery,html,insert,contain

You can append the img based on the contains criteria: $("h3:contains('Men')").append("<img src='images/men.png'>"); JS Fiddle...

how to align the arrow in menu item?

html,css,responsive-design,menuitem,contain

If you are trying to align it to the right try this http://jsfiddle.net/omcuL0vw/ #menu-bar li ul li > a:after { float:right; content: '▶'; } ...

I'm having trouble making the parent div expand to fit its content

html,css,overflow,expand,contain

Added some media queries in css @media(max-width:960px){ #about{ font-size: 2.5em; } } @media(max-width:767px){ #about{ position: static; margin-top: 30px; } } https://jsfiddle.net/gxpwxhfh/7/...

.contains() method not working — finding an int in array Java

java,arrays,string,contain

int[] is a primitive array and does not have a method .contains(). If you used List<Integer> instead, that would give you a .contains() method to call. Also, your search method must return a value even when val < 1 or val > 50. If you need numberList to be an...

Check if string contains any elements from list

python,list,contain

>>> item_list = ["Non-Tradable Ubersaw", "Screamin' Eagle", "'Non-Craftable Spy-cicle"] >>> not_allowed = {"Non-Tradable", "Non-Craftable"} You can use a list comprehension with any to check if any of the disallowed substrings are in the current element >>> filtered = [i for i in item_list if not any(stop in i for stop...

If a string contains the same value as cells k4:k7, give true

excel,compare,contain

=ISNUMBER(LOOKUP(1;0/SEARCH(L4;$K$4:$K$7))) Regards...

How to check whether form contains file input? ColdFusion

file,session,coldfusion,coldfusion-10,contain

A couple problems - make sure in your cffile that you get the name of the fileField correct (fileContent is the name of the field in your form). Secondly, the error you're receiving is because you didn't specify cffile.serverDirectory. If you dump the session on formComplete.cfm before your error you'll...

Remove href containing specific text part

jquery,contain

You can use .removeAttr() to remove attributes from elements.try this: $('a[href*="ext"]').removeAttr('href'); To replace with empty href: $('a[href*="ext"]').attr('href',''); ...

Underscore.js— the relationship between _.contains and _.reduce

javascript,underscore.js,reduce,contain

Although that is a working version of _contains, it is not a very efficient one. It's not the one I see in the Github repo or the different one I see in the annotated source. But it should work, and here's how: reduce takes three parameters. (Well, there's an optional...