I hereby claim:
- I am jc4p on github.
- I am kasra (https://keybase.io/kasra) on keybase.
- I have a public key whose fingerprint is CC17 5E08 A771 3140 8965 5951 57CB 049F F2B5 C9D0
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
// Good idea or Bad idea? | |
// Lets say you have to call some API with lots of parameters that you don't control | |
// Like this http://developer.android.com/reference/android/text/StaticLayout.html#StaticLayout(java.lang.CharSequence, int, int, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean, android.text.TextUtils.TruncateAt, int) | |
// Do you prefer Option #1 or Option #2? Is Option #2 a terrible idea? | |
// I suppose Option #3 could be to wrap it in a Builder | |
class Foo { |
from SimpleCV import Camera, Display, HaarCascade, Image, Color | |
cam = Camera() | |
display = Display() | |
cascadeEye = HaarCascade("eye") | |
cascadeLeftEar = HaarCascade("left_ear") | |
cascadeRightEar = HaarCascade("right_ear") | |
cascadeMouth = HaarCascade("mouth") | |
// Run this on the JS console when logged into https://riders.uber.com/trips | |
var currentPage=1;var spent=0;var gotPage=function e(t){if($(t).find("td.text--right").length===0){console.log("All Done! You've spent: "+spent);return}$("td.text--right").each(function(e,t){spent+=parseInt($(this).children().remove().end().text().substring(1))});currentPage+=1;$.get("https://riders.uber.com/trips?page="+currentPage,e);console.log("Loading page "+currentPage)};$.get("https://riders.uber.com/trips?page="+currentPage,gotPage) |
from PIL import Image | |
from moviepy.editor import ImageSequenceClip | |
from os import remove | |
import sys | |
# The width and height for each picture in the x2-size image. | |
pic_size = 485, 368 | |
def get_frame(img, x, y): | |
return img.crop((x, y, x + pic_size[0], y + pic_size[1])) |
package com.kasra.androidsandbox; | |
import android.os.Bundle; | |
import android.support.v4.view.GravityCompat; | |
import android.support.v4.widget.DrawerLayout; | |
import android.support.v7.app.ActionBarActivity; | |
import android.support.v7.app.ActionBarDrawerToggle; | |
import android.support.v7.widget.LinearLayoutManager; | |
import android.support.v7.widget.RecyclerView; | |
import android.support.v7.widget.Toolbar; |
/** | |
* Calculates if the given textColor is readable when laid ontop of the given backgroundColor. | |
* | |
* http://www.seas.upenn.edu/~cse400/CSE400_2012_2013/reports/01_report.pdf | |
*/ | |
public static boolean isTextReadable(int backgroundColor, int textColor) { | |
double brightnessBackground = (299*Color.red(backgroundColor) + 587*Color.green(backgroundColor) + 114*Color.blue(backgroundColor)) / 1000.0; | |
double brightnessText = (299*Color.red(textColor) + 587*Color.green(textColor) + 114*Color.blue(textColor)) / 1000.0; | |
double brightnessDelta = Math.abs(brightnessBackground - brightnessText); |
<p class="category col two"><em>{{ category.title }}</em></p> | |
<ul class="project-list col seven"> | |
{% foreach post in category.posts %} | |
<li> | |
<div class="thumbnail col two"> | |
<img src="{{ post.thumb }}" alt=""></a> | |
</div> | |
<div class="summary col two"> | |
<p><a href="{{ url_for(post) }}">{{ post.title }}</a></p> | |
<p><em>{{ post.date|relative }}</em></p> |
Photo Collection Manager
Local electron app + PWA front end for viewing local files on your phone if on local wifi
No consolidated servers, but everything is OSS and PWA app can be set up on your own server to also use to view images stored in cloud
Back up to your own cloud
Import from any cloud / the Windows OS X Linux box it's running on / Lightroom / etc
// src/components/Hello.tsx | |
import { h, Component, render } from "preact"; | |
export interface HelloProps { compiler: string; framework: string; } | |
export default class Hello extends Component<HelloProps, undefined> { | |
constructor(props: any) { | |
super(props); | |
// #TODO: fetch() from the API, or set up a ServiceWorker to do so. |