Skip to content

Instantly share code, notes, and snippets.

Uriel Avalos frankandrobot

Block or report user

Report or block frankandrobot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View real_return_n.R
#' Calculate the real return on an index fund.
#'
#' @param yield - percent as a decimal
#' @param expense_ratio - percent as a decimal
#' @param balance
#' @param n - number of years
#'
#' @return
#' @examples
real_return_n <- function(yield, expense_ratio, starting_balance, n) {
View index.r
#' Calculate the real return on an index fund over a single year.
#'
#' @param yield - percent as a decimal
#' @param expense_ratio - percent as a decimal
#' @param balance
#'
#' @return
#' @examples
real_return <- function(yield, expense_ratio, balance) {
# if there was no expense ratio, this would be your new balance
View is_visible.py
def is_visible(object_value, current_visibility, desired_visibility):
specified = object_value['visibility']
if current_visibility == 'hide':
if desired_visibility == 'show':
return specified == desired_visibility
else:
return True
# current_visibility is "show"...
@frankandrobot
frankandrobot / .gitignore
Last active Jul 20, 2016
Recursive Flatten vs Tail-Recursive Flatten
View .gitignore
.gradle/
.idea/
build/
*.iml
gradle/
@frankandrobot
frankandrobot / bacon.combineTemplate.js
Last active Nov 7, 2015
BaconJS combineTemplate vs HighlandJS zip vs Bluebird join vs BaconJS zip vs Kefir zip
View bacon.combineTemplate.js
const restify = require('restify');
const server = restify.createServer();
const Bacon = require('baconjs');
server.get('/', function(req, res, next) {
const a = Bacon.once('a');
const b = Bacon.once('b');
@frankandrobot
frankandrobot / ScalaAsyncMapPlayground
Created Mar 26, 2015
Playground showing complex async transforms
View ScalaAsyncMapPlayground
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future
case class Tag(name:String = "0")
object HelloWorld {
def fetchAllTags:Future[List[Tag]] = Future{ List(Tag("a"), Tag("b"), Tag("c")) }
View ProviderWithUnion.java
static private class TaskUnionRepeatQuery implements TaskQuery
{
@Override
public Cursor query(SQLiteOpenHelper openHelper,
Uri url,
String[] projectionIn,
String selection,
String[] selectionArgs,
String sort)
{
@frankandrobot
frankandrobot / Datastructure.java
Created Aug 10, 2013
Gist for Android Studio bug
View Datastructure.java
package com.frankandrobot.reminderer.datastructures;
import java.util.HashMap;
import java.util.Map;
import java.util.Calendar;
/**
* A datastructure with auto-generated getters and setters.
*
* It is possible to write functions that take variable __names__ as arguments
@frankandrobot
frankandrobot / Task.java
Created Aug 10, 2013
Gist for Android Studio bug
View Task.java
package com.frankandrobot.reminderer.datastructures;
import android.content.ContentValues;
import android.database.Cursor;
import android.os.Parcel;
import android.os.Parcelable;
import com.frankandrobot.reminderer.database.TaskTable.TaskCol;
import com.frankandrobot.reminderer.parser.GrammarRule.RepeatsToken;
import com.frankandrobot.reminderer.datastructures.DataStructure.*;
@frankandrobot
frankandrobot / CursorProxyDelete.java
Created Aug 9, 2013
Proxy for the Android Cursor class that ignores the row passed in the constructor. Use this to "delete" rows in the listview before deleting them for real in the database.
View CursorProxyDelete.java
package com.frankandrobot.reminderer.database.databasefacade;
import android.annotation.TargetApi;
import android.content.ContentResolver;
import android.database.AbstractCursor;
import android.database.CharArrayBuffer;
import android.database.ContentObserver;
import android.database.Cursor;
import android.database.DataSetObserver;
import android.net.Uri;
You can’t perform that action at this time.