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
@RunWith(AndroidJUnit4.class) public class FragmentTest { | |
// Setup an ActivityTestRule as such that the Activity is not launched until we say so | |
@Rule public ActivityTestRule<EmptyActivity> rule = | |
new ActivityTestRule<>(EmptyActivity.class, true, false); | |
private Fragment fragment; | |
private EmptyActivity activity; | |
@Before public void setup() { |
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
@RunWith(AndroidJUnit4.class) public class FragmentTest { | |
// Setup an ActivityTestRule as such that the Activity is not launched until we say so | |
@Rule public ActivityTestRule<EmptyActivity> rule = | |
new ActivityTestRule<>(EmptyActivity.class, true, false); | |
private Fragment fragment; | |
private EmptyActivity activity; | |
@Before public void setup() { |
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 EmptyActivity extends AppCompatActivity { | |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
} | |
} |
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
<TextView | |
android:width="match_parent" | |
android:height="match_parent" | |
android:text="Hello world!" | |
/> |
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
#!/usr/bin/racket | |
#lang racket | |
(define sum | |
(lambda (x) | |
(if (null? x) | |
0 | |
(if (cons? x) | |
(if (number? (car x)) | |
(+ (car x) (sum (cdr x))) | |
(+ (sum (car x)) (sum (cdr 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
import java.util.*; | |
public class Solution { | |
private int numberOfOneBits(int num) { | |
int count = 0; | |
while (num != 0) { | |
if ((num & 1) == 1) { | |
++count; | |
} | |
num >>= 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
#!/bin/bash | |
# This script will print all java files found recursively from the current directory, and then print the ones that | |
# have not been involved in a git commit in some number of months | |
# | |
# Based on: | |
# https://hackerific.net/2016/04/30/git-file-age-a-script-to-show-when-files-were-last-modified-in-git/ | |
find . -name *.java | xargs -I § git log -1 --pretty="format:%ct %cr %h §;" § | tr ';' '\n' | sort | cut -f 2- | grep "month" |
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 java.util.*; | |
public class Solution { | |
public boolean repeatedSubstringPattern(String str) { | |
int length = str.length(); | |
if (length <= 1) return false; | |
List<Integer> factors = new ArrayList(); | |
// Factor | |
for (int i = 1; i * 2 <= length; ++i) { |
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 <stdio.h> | |
#include <time.h> | |
#include <stdlib.h> | |
#include <math.h> | |
double absd(double n) { | |
unsigned long *gg = (unsigned long int *)&n; | |
*(gg) &= 0x7FFFFFFFFFFFFFFFull; | |
return n; | |
} |
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
Why coding streams/shows are interesting to me: in some livestreams, the experience is very similar to pair programming, | |
but those people are experts. In VODs, it's more about problem solving and learning skills and approaches. The devs are really good | |
at what they do and there is *always* a lot to learn. | |
In no particular order: | |
1) Handmade Hero | |
About the author: Casey Muratori. Worked at RAD. | |
Description and why I like it: It kinda started the whole thing for me. Casey is coding a complete game and engine on stream, | |
from scratch, one hour a day. He knows what he's doing on so many of the domains of game development and regular programing, |