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 ProgressView: UIView { | |
private var progressPath: UIBezierPath! | |
private var progressShape: CAShapeLayer! | |
private var backgroundShape: CAShapeLayer! | |
/// Set by user to increment or decrement progress | |
/// On being set, this changes the `strokeEnd` property of the | |
/// `progressShape`, denoting where the stroke should end | |
/// Value between 0.0 - 1.0 | |
var progress: Float = 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
fun partTwo(input: String): Int { | |
var frequency = 0 | |
val diff = measureTimeMillis { | |
val lines = input.split("\n").map { it.toIntOrNull() ?: 0 } | |
val frequencies = mutableSetOf<Int>() | |
for (i in 0..Int.MAX_VALUE) { | |
frequency += lines[i % lines.count()] | |
if (!frequencies.add(frequency)) break | |
} |
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
func PartTwo(input string) int { | |
f, err := os.Create("p2cpu.pprof") | |
if err != nil { | |
fmt.Println("pprof file error") | |
panic(err) | |
} | |
pprof.StartCPUProfile(f) | |
defer pprof.StopCPUProfile() | |
lines := strings.FieldsFunc(input, func(r rune) bool { | |
return unicode.IsSpace(r) || r == '\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
<?xml version="1.0" encoding="utf-8"?> | |
<!-- | |
Copyright 2016 Google Inc. | |
Licensed under the Apache License, Version 2.0 (the "License"); | |
you may not use this file except in compliance with the License. | |
You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.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 android.content.Context; | |
import android.graphics.Canvas; | |
import android.support.design.widget.TextInputLayout; | |
import android.support.v4.view.ViewCompat; | |
import android.util.AttributeSet; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.EditText; | |
public class CustomTextInputLayout extends TextInputLayout { |
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 ScrollingFABBehavior extends CoordinatorLayout.Behavior<FloatingActionButton> { | |
private int toolbarHeight; | |
public ScrollingFABBehavior(Context context, AttributeSet attrs) { | |
super(context, attrs); | |
this.toolbarHeight = Utils.getToolbarHeight(context); | |
} | |
@Override | |
public boolean layoutDependsOn(CoordinatorLayout parent, FloatingActionButton fab, View dependency) { |
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
package com.example.avjindersinghsekhon.toodle; | |
import android.content.Context; | |
import android.support.design.widget.AppBarLayout; | |
import android.support.design.widget.CoordinatorLayout; | |
import android.support.design.widget.FloatingActionButton; | |
import android.support.design.widget.Snackbar; | |
import android.support.v4.view.ViewCompat; | |
import android.util.AttributeSet; | |
import android.util.Log; |