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
d = { "a":3, 1:'b'} | |
dd ={} | |
dd[1] = 'b' | |
dd['a'] = 2 | |
dd[(1,2)] = 0 # using a tuple as a key | |
print d | |
print dd | |
listOfKeysToPop = [] |
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 Complement<T> extends PersonalityBased implements Rapportable{ | |
private Person crush; | |
Complement(Person crush){this.crush = crush;} | |
// test | |
{new Complement<Genuine>(new Person("Jane Doe")).exciting();} // use builder for multi attribute complements | |
@Override public String funny(){ | |
return crush.name + ""; |
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 SC{ | |
static class N{ | |
@Retained N1 n1; | |
@Retained N2 n2; | |
} | |
static class O{ | |
@Retained O1 o1; | |
@Retained O2 o2; | |
} |
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 Frag00 extends Fragment{ | |
@Arg | |
String required; | |
@Arg | |
boolean isTablet; | |
} | |
@FragmentArgsInherited | |
public class Frag02 extends Frag00{ | |
@Arg | |
String a; |
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
Conversion terminology cheat sheet | |
Ad clicks per conversion: The total number of ad clicks on conversion paths divided by the number of conversions. | |
Ad impressions per conversion: The total number of ad impressions on conversion paths divided by the number of conversions. | |
Assisted conversions: The number of conversions that were assisted by a particular campaign, ad group, or keyword. Assisted conversions don't include last click conversions. | |
Attribution: Assigning value to the different interactions on a customer’s conversion path. |
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
http://stackoverflow.com/questions/1274057/making-git-forget-about-a-file-that-was-tracked-but-is-now-in-gitignore?rq=1 | |
Try the following, else goto link. | |
git update-index --assume-unchanged <file> |
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
// jar task modification | |
task androidJar(type: Jar){ | |
dependsOn assemble | |
group 'Build' | |
description 'blah blah' | |
from zipTree( | |
'build/intermediates/bundles/release/classes.jar') | |
from zipTree( | |
'../annotations-processor/build/libs/processor.jar') | |
from zipTree( |
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
// for sources | |
task androidSourcesJar(type: Jar){ | |
from android.sourceSets.main.java.srcDirs | |
} | |
// for javadoc.jar | |
android.libraryVariants.all { variant -> | |
task("javadoc${variant.name.capitalize()}", type: Javadoc){ | |
description "Generates Javadoc for $variant.name." | |
group 'Docs' |
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 static void testMontyHall(){ | |
Random random = new Random(1); | |
float percentOfWinsForStay = 0; | |
float percentOfWinsForSwitch = 0; | |
float numberOfPlays = 100; | |
for(int aPlay = 0; aPlay < numberOfPlays; aPlay++){ | |
int guess = random.nextInt(3); |
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 StrategyRecursiveGenerics { | |
public void clientProvideStrategy(){ | |
long amount = 10000000L; | |
Person person = new Person(amount, new DefaultTaxStrategy<Person>()); | |
Person person1 = new Person(amount, new DodgingTaxStrategy<Person>()); | |
Trust nonProfit = new Trust(amount, new TrustTaxStrategy(), true); | |
Trust forProfit = new Trust(amount, new TrustTaxStrategy(), false); | |
assert person.computeTax() == 4000000; |