Skip to content

Instantly share code, notes, and snippets.

View mfurtak's full-sized avatar

Michael Furtak mfurtak

View GitHub Profile
@mfurtak
mfurtak / gist:548687
Created August 25, 2010 01:52
RSpec & Webrat gorgeousness
describe "failure" do
it "should not make a new user" do
lambda do
visit signup_path
fill_in "Name", :with => ""
fill_in "Email", :with => ""
fill_in "Password", :with => ""
fill_in "Confirmation", :with => ""
click_button
response.should render_template('users/new')
@mfurtak
mfurtak / gist:799294
Created January 27, 2011 21:17
Unicode in your Ruby source files
# encoding: utf-8
class I
def self.♥(thing)
puts "I ♥ #{thing}"
end
end
I.♥ "Ruby"
Feature: Managing a user session
In order to manage my session with the site
As a user
I should be able to sign in and sign out
Scenario: Navigate to the sign in page
Given I am not signed in
And I am on the home page
When I follow "Sign in"
@mfurtak
mfurtak / gist:815621
Created February 8, 2011 00:50
Testing poetry
describe User, 'as creator' do
subject { Factory(:user) }
let(:object) { mock 'arbitrary object' }
it "did not create another object when the object does not have a creator_id" do
subject.should_not be_creator_of(object)
end
it "did not create another object when the object's creator_id does not match" do
@mfurtak
mfurtak / assets.rake
Created August 4, 2012 23:26
Fixing use of I18n.t during asset precompilation on Heroku
# Rake task overriding, with original task calling. Found here:
#
# http://metaskills.net/2010/05/26/the-alias_method_chain-of-rake-override-rake-task/
Rake::TaskManager.class_eval do
def alias_task(fq_name)
new_name = "#{fq_name}:original"
@tasks[new_name] = @tasks.delete(fq_name)
end
end
hourPaint = new Paint();
hourPaint.setARGB(255, 200, 200, 200);
hourPaint.setStrokeWidth(6F);
hourPaint.setAntiAlias(true);
hourPaint.setStrokeCap(Paint.Cap.ROUND);
// ...
float hrX = (float) Math.sin(hrRot) * hrLength;
float hrY = (float) -Math.cos(hrRot) * hrLength;
@mfurtak
mfurtak / gist:5172101
Created March 15, 2013 18:49
Android exception on APK re-install via Run... from Eclipse
FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to instantiate application com.speek.SpeekApplication: java.lang.NullPointerException
at android.app.LoadedApk.makeApplication(LoadedApk.java:501)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4124)
at android.app.ActivityThread.access$1300(ActivityThread.java:130)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1255)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4745)
at java.lang.reflect.Method.invokeNative(Native Method)
@mfurtak
mfurtak / gist:5495531
Last active December 16, 2015 20:49
My current Slate configuration
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
# config keyboardLayout dvorak
@mfurtak
mfurtak / .slate
Created May 3, 2013 00:50
Slate configuration for my home laptop
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
config secondsBetweenRepeat 0.1
config checkDefaultsOnLoad true
config focusCheckWidthMax 3000
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
# config keyboardLayout dvorak
@mfurtak
mfurtak / A Moving Experience.md
Created May 17, 2013 13:27
Notes from the May 16 talk, "A Moving Experience" at Google I/O 2013

A Moving Experience

Elements of Good Animations

  • Keep them short, but appropriate to the action that is happening
    • (defaults to 300ms on Android for property animator)
  • Keep them smooth
    • Don't run layout during animation! Do it first.
    • Use the right timing curve
  • Keep them natural