Skip to content

Instantly share code, notes, and snippets.

View emmasteimann's full-sized avatar

Goose Goosington (Emma Steimann) emmasteimann

  • PNF-404
View GitHub Profile
@emmasteimann
emmasteimann / NSString+KBAdditions.h
Created May 23, 2012 14:22 — forked from kevboh/NSString+KBAdditions.h
Making UILabel's adjustsFontSizeToFitWidth and minimumFontSize play nice with multi-lined labels
@interface NSString (KBAdditions)
- (CGFloat)fontSizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size minimumFontSize:(CGFloat)minimumFontSize;
@end
@emmasteimann
emmasteimann / zsh.md
Created July 2, 2012 17:24 — forked from tsabat/zsh.md
Getting oh-my-zsh to work in Ubuntu

Install via apt-get

sudo apt-get update && sudo apt-get install zsh

Getting zsh to work in ubuntu is weird, since sh does not understand the source command. So, you do this to install zsh

wget –no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O – | sh

and then you change your shell to zsh

# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
@emmasteimann
emmasteimann / tetris.clj
Created July 6, 2012 19:58 — forked from alexander-yakushev/tetris.clj
Tetris implementation in Clojure
(ns tetris.core
(:import (java.awt Color Dimension BorderLayout)
(javax.swing JPanel JFrame JOptionPane JButton JLabel)
(java.awt.event KeyListener))
(:use clojure.contrib.import-static deflayout.core
clojure.contrib.swing-utils)
(:gen-class))
(import-static java.awt.event.KeyEvent VK_LEFT VK_RIGHT VK_DOWN VK_UP VK_SPACE)
@emmasteimann
emmasteimann / gist:3382794
Created August 17, 2012 21:18 — forked from insane-dreamer/gist:523774
access current_user in an Observer
class ApplicationController < ActionController::Base
before_filter :set_current_user
private
def set_current_user
UserActionObserver.current_user = current_user
end
end
class UserActionObserver < ActiveRecord::Observer
# assuming these all have created_by_id and updated_by_id
@emmasteimann
emmasteimann / heroku.rake
Created November 6, 2012 18:15 — forked from mscottford/heroku.rake
Rake task to restart one heroku web instance every 10 minutes
# Add `gem 'heroku-api', :git => 'https://github.com/heroku/heroku.rb.git'` to your Gemfile
# Set the APP_NAME environment variable to the name of the Heroku app you wish to control.
# Set the HEROKU_API_KEY environment variable to the API key found on the Heroku 'My Account' page.
# You can now create a scheduler instance that runs `bundle exec rake heroku:web:restart` to automate
# restarting workers. The task will select a different web instance every 10 minutes, based on the number of instances that are running.
namespace :heroku
namespace :web do
task :restart do
@emmasteimann
emmasteimann / bot.js
Created November 19, 2012 20:09 — forked from callumacrae/bot.js
Node.js IRC bot
var net = require('net'),
irc = {}, config;
config = {
user: {
nick: '',
user: '',
real: '',
pass: ''
},
@emmasteimann
emmasteimann / jquery.animbpos.js
Created November 20, 2012 06:52 — forked from bfncs/jquery.animbpos.js
jQuery Plugin: Animate Background Position
/**
* jQuery: animate background position
* Author: Marc Löhe
* Based on a work by Alexander Farkas
*/
(function ($) {
$.extend($.fx.step,{
backgroundPosition: function(fx) {
if (fx.state === 0) {
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')