Skip to content

Instantly share code, notes, and snippets.

View AKiniyalocts's full-sized avatar
🔭

Anthony Kiniyalocts AKiniyalocts

🔭
  • Big Nerd Ranch
  • Southgate, KY
View GitHub Profile
@AKiniyalocts
AKiniyalocts / com.ngrok.startup.plist
Created February 22, 2019 14:13
Start ngrok at startup as a LaunchDaemon. Place in your /Library/LaunchDaemons dir
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.ngrok.onstartup</string>
@AKiniyalocts
AKiniyalocts / GroupBy.swift
Created October 5, 2018 15:11
GroupBy.swift
extension Collection{
/**
* Groups elements of the original collection by the key returned by the given [keySelector] function
* applied to each element and returns a map where each group key is associated with a list of corresponding elements.
*
* The returned map preserves the entry iteration order of the keys produced from the original collection.
**/
public func groupBy<Value>(by keySelector:(Element) -> Value?) -> [Value?:[Element]]{
@AKiniyalocts
AKiniyalocts / DeCryptor.java
Created February 23, 2017 05:26 — forked from JosiasSena/DeCryptor.java
Encryptor and Decryptor for data encryption.decryption using the Android KeyStore.
/**
_____ _____ _
| __ \ / ____| | |
| | | | ___| | _ __ _ _ _ __ | |_ ___ _ __
| | | |/ _ \ | | '__| | | | '_ \| __/ _ \| '__|
| |__| | __/ |____| | | |_| | |_) | || (_) | |
|_____/ \___|\_____|_| \__, | .__/ \__\___/|_|
__/ | |
|___/|_|
*/
@AKiniyalocts
AKiniyalocts / EdgeDecorator.java
Created December 8, 2016 21:00
Quick way to add padding to first and last item in recyclerview via decorators
package com.batterii.mobile.ui.component.decorators;
import android.graphics.Rect;
import android.support.v7.widget.RecyclerView;
import android.view.View;
/**
* Created by anthonykiniyalocts on 12/8/16.
*
* Quick way to add padding to first and last item in recyclerview via decorators
@AKiniyalocts
AKiniyalocts / Scrolling.m
Created September 26, 2016 14:47
Scrolling a tableview along with a cursor inside of a UITextView
-(void)textViewDidChangeSelection:(UITextView *)textView {
CGPoint cursorPosition = [textView caretRectForPosition:textView.selectedTextRange.start].origin;
[self.tableView scrollRectToVisible:CGRectMake(cursorPosition.x, cursorPosition.y
, textView.frame.size.width, textView.frame.size.height) animated:YES];
}
@AKiniyalocts
AKiniyalocts / ColorTransition.java
Created September 1, 2016 19:15
Status/Toolbar color transition animator
private void safeAnimateToolbarAndStatus(boolean reverse){
Integer colorFrom = reverse ? ContextCompat.getColor(this, R.color.limeade) : ContextCompat.getColor(this, R.color.b4);
Integer colorTo = reverse ? ContextCompat.getColor(this, R.color.b4) : ContextCompat.getColor(this, R.color.limeade);
Integer colorStatusFrom = reverse ? ContextCompat.getColor(this, R.color.limeade_pressed) : ContextCompat.getColor(this, R.color.dark_grey);
Integer colorStatusTo = reverse ? ContextCompat.getColor(this, R.color.dark_grey) : ContextCompat.getColor(this, R.color.limeade_pressed);
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
@AKiniyalocts
AKiniyalocts / build_light.py
Created August 20, 2016 20:01
Python build light for greenhouse
import requests
import json
import time
import RPi.GPIO as GPIO
alive = True
while(alive):
headers = {'token': 'YOUR_TOKEN', 'release':'False'}
r = requests.get('https://app.greenhouseci.com/api/projects/YOUR_PROJECT_ID', headers)
@AKiniyalocts
AKiniyalocts / GrayscaleTransformation.java
Created January 15, 2016 18:31
Picasso Grayscale Transformation
/*
* Copyright (C) 2014 Square, 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
*
* Unless required by applicable law or agreed to in writing, software
@AKiniyalocts
AKiniyalocts / BaseViewHolder.java
Created December 7, 2015 20:45
Base class for RecyclerView holder that forces the bind() pattern
import android.support.v7.widget.RecyclerView;
import android.view.View;
import butterknife.ButterKnife;
/**
* Created by anthonykiniyalocts on 11/9/15.
*/
public abstract class BaseViewHolder extends RecyclerView.ViewHolder {
@AKiniyalocts
AKiniyalocts / drawer_toggle_style.xml
Created September 30, 2015 00:33
How to style an ActionBarDrawerToggle
<style name="MyTheme" parent="Theme.AppCompat">
<item name="drawerArrowStyle">@style/MyDrawerArrowToggle</item>
</style>
<style name="MyDrawerArrowToggle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="color">?android:attr/textColorSecondary</item>
<item name="middleBarArrowSize">16dp</item>
<item name="spinBars">true</item>
<item name="thickness">2dp</item>
<item name="topBottomBarArrowSize">11.31dp</item>