Skip to content

Instantly share code, notes, and snippets.

### Keybase proof
I hereby claim:
* I am newbyca on github.
* I am newbyca (https://keybase.io/newbyca) on keybase.
* I have a public key whose fingerprint is 0B8C 4093 7CB9 E9A3 71E5 B3C3 159C 2A4E CB90 3235
To claim this, I am signing this object:
import os
import fnmatch
import unittest
import webapp2
import importlib
from time import clock
class RunUnitTests(webapp2.RequestHandler):
def get(self):
Verifying that +newbyca is my Bitcoin username. You can send me #bitcoin here: https://onename.io/newbyca
<link rel="import" href="../components/polymer/polymer.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 100%;
height: 100%;
@newbyca
newbyca / jquery.validity.chosen.js
Created July 17, 2012 22:45
custom Validity outputMode that handles Chosen <select> controls
(function($) {
function getIdentifier($obj) {
return $obj.attr('id').length ?
$obj.attr('id') :
$obj.attr('name');
}
$.validity.outputs.labellocal = {
cssClass:"error",
@newbyca
newbyca / password.coffee
Created June 17, 2012 03:20
a password class i'm using in my nodejs project. i decided this abstraction was appropriate given a desire to create password hashs asyncly.
bcrypt = require 'bcrypt'
class password
text = null
salt = null
hash = null
@saltAndHash = (text, done) ->
bcrypt.genSalt (err, salt) ->
@newbyca
newbyca / tickersetup.js
Created May 31, 2012 02:56
setup script for google finance ticker
$(document).ready(function () {
$('div#ticker').googlefinanceticker({ tickers: 'goog,aapl,msft,csco,intc,ibm,att,bidu' });
});
@newbyca
newbyca / ListenableAsyncTask.java
Created May 9, 2012 00:00
Android ListenableAsyncTask: AsyncTask extension that lets you set an onPostExecute listener from a task's client
public abstract class ListenableAsyncTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result>{
@Override
protected final void onPostExecute(Result result) {
notifyListenerOnPostExecute(result);
}
private AsyncTaskListener<Result> mListener;
public interface AsyncTaskListener<Result>{
public void onPostExecute(Result result);
@newbyca
newbyca / Typefaces.java
Created March 12, 2012 00:05
workaround class for Android Typeface.createFromAsset memory leak
public class Typefaces{
private static final Hashtable cache = new Hashtable();
public static Typeface get(Context c, String name){
synchronized(cache){
if(!cache.containsKey(name)){
Typeface t = Typeface.createFromAsset(
c.getAssets(),
String.format("fonts/%s.ttf", name)
@newbyca
newbyca / AnimationLooper.java
Created March 11, 2012 23:31
workaround class for Android animation set repeatCount problem.
import android.view.View;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Animation.AnimationListener;
public class AnimationLooper{
public static void start(final View v, final int animationResId){
v.getViewTreeObserver().addOnGlobalLayoutListener(new OnGlobalLayoutListener() {