Skip to content

Instantly share code, notes, and snippets.

// find x, y, z and w such that
// x!=y
// y!=z
// z!=x
// but
// x==w
// y==w
// z==w
@yonatanm
yonatanm / 19-Oct-2017.js
Created October 19, 2017 12:43
why this expression is evaluated to true ?
[] == ![] // true
@yonatanm
yonatanm / 14-Sep-2017.java
Last active September 14, 2017 15:15
Explain why (r1 == true) and (r2==false) ?
Set<URL> mySet = new HashSet<>();
mySet.add(new URL("https://my.outbrain.com"));
boolean r1 = mySet.contains(new URL("https://my.outbrain.com")); // Returns true
System.out.println("r1 = " + r1);
Thread.sleep(60 * 1000); // sleeping for 1 minute
boolean r2 = mySet.contains(new URL("https://my.outbrain.com")); // Return false
System.out.println("r2 = " + r2);
@yonatanm
yonatanm / Logistics.md
Last active September 14, 2017 10:13
R&D Weekly Quiz

Format

  • On each Thursday I will send you a quiz, mainly around code / technology / programming.
  • Answers should be sent to RnDWeeklyQuiz@outbrain.com
  • The one who will answer the 1st correct answer will get 3 points, the 2nd - 2 points, and the 3rd - 1 point.

The Answers - facts && !fluffyWords

  • Short, accurate and concise.
  • Sharp and pointing the assense of the issue.
  • You can include links to documentation or StackOverlfow answers etc
  • Links should point directly to the method / answer / whatever-other resource you wish to refer to.
@yonatanm
yonatanm / quiz.js
Last active January 25, 2017 21:03
// Explain the (awkward) output of the following JS expression
['10','10','10'].map(parseInt)
{ msg: "this is my Json" }
class Challenge {
private static final Logger log = LoggerFactory.getLogger(Challenge.class);
private void doSomething(Collection<String> words) {
log.debug("doing work on " + Joiner.on(";").join(words));
doWork(words);
}
//
@yonatanm
yonatanm / Thunk.java
Created September 19, 2012 23:42
a Thunk Quiz
abstract class Thunk<T> {
private boolean evaluated;
private T value;
public T get() {
if (!evaluated) {
value = compute();
evaluated = true;
}
return value;
}
@yonatanm
yonatanm / fix.diff
Created November 21, 2011 23:57
a diff file that fixes syntax errors in https://gist.github.com/1382214
10c10
< benefits : all,
---
> benefits : 'all',
18,20c18,20
< make-a-difference : true,
< work-with-top-talent : true,
< close-to-customers : true
---
> 'make-a-difference' : true,
class AlephFS < RFuse::Fuse
# implement ....
do