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
#include <iostream> | |
using namespace std; | |
void main() | |
{ | |
int a = 1, b = 2; | |
int arr[] = {1, 3, 5, a, b}; | |
int *p = arr + 1; | |
int **q = &p; | |
int ***crazy = new int**[*(arr + 4)]; |
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
public interface ConditionTester { | |
boolean isTrue(); | |
} | |
public static void delayedAssert(ConditionTester tester, | |
long timeout, | |
long pollingInterval) | |
throws InterruptedException { | |
long startTime = System.currentTimeMillis(); |
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
''' | |
Created on Apr 14, 2011 | |
''' | |
class LCDCalculator(object): | |
def calc(self, num1, num2): | |
return reduce(lambda x, y: x * y, self.smart_union(self.factorize(num1), self.factorize(num2))) | |
def factorize(self, num): |
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
# Old version: | |
>>> from mock import MagicMock | |
>>> a = MagicMock() | |
>>> a.foo("hello") | |
<mock.MagicMock object at 0xa40cecc> | |
>>> a.foo("goodbye") | |
<mock.MagicMock object at 0xa40cecc> | |
>>> a.foo.call_args_list | |
[(('hello',), {}), (('goodbye',), {})] | |
>>> a.foo.call_args_list[0] |
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
#import <SenTestingKit/SenTestingKit.h> | |
@interface MyTest : SenTestCase | |
@end |
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
''' | |
Created on Jan 30, 2012 | |
@author: yonits | |
''' | |
import unittest | |
def flip_indices(new_list, first_idx, second_idx): |
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
public abstract class A { | |
private int x = 7; | |
public A(int x) { | |
this.x = x; | |
System.out.println("A::A, x=" + x); | |
} | |
public int getX() { |
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 A { | |
private int x; | |
public A() { | |
this(7); | |
} | |
public A(int x) { | |
setX(x); | |
} |
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
public class Main { | |
public static void main(String[] args) { | |
doSomething(7); | |
} | |
private static void doSomething(int num) throws Exception { | |
if (num > 10) { | |
throw new Exception("abcd"); | |
} else { | |
System.out.println(num); |
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
#!/bin/bash | |
while [ 1 == 1 ]; do | |
curl http://www.leaan.co.il | grep Lean-Logo.png 2>&1 > /dev/null | |
if [ $? == 0 ]; then | |
open http://www.leaan.co.il; | |
fi | |
sleep 1 | |
done |
OlderNewer