Skip to content

Instantly share code, notes, and snippets.

View webdevotion's full-sized avatar

Bram Plessers webdevotion

View GitHub Profile
@webdevotion
webdevotion / bacon.rb
Created December 1, 2010 15:13
working code for the "Rails 3 in action" ebook ( chapter 2 - section 2.3.1 )
class Bacon
attr_accessor :expired
def edible?
!expired
end
def expired!
self.expired = true
end
Feature: Signing in
In order to use the site
As a user
I want to be able to sign in
Scenario: Signing in via confirmation
Given there are the following users:
| email | password | confirm_user |
| user@ticketee.com | password | false |
And "user@ticketee.com" opens the email with subject "Confirmation instructions"
@webdevotion
webdevotion / build.xml
Created February 16, 2011 12:49
contents of my build.xml
<?xml version="1.0"?>
<project default="release">
<target name="release">
<echo>
Building release build
</echo>
<fb.exportReleaseBuild project="Amazing Project" />
</target>
@webdevotion
webdevotion / config-compass.rb
Created May 17, 2011 06:48
heroku compass config
# This configuration file works with both the Compass command line tool and within Rails.
# Require any additional compass plugins here.
project_type = :rails
project_path = Compass::AppIntegration::Rails.root
# Set this to the root of your project when deployed:
http_path = "/"
environment = Compass::AppIntegration::Rails.env
if environment == 'production'
css_dir = "tmp/stylesheets"
@webdevotion
webdevotion / build.properties
Created July 12, 2011 10:02
Flash Builder Premium: release build, copy release to web folder, git add / commit / push
RAILS_APP=../../../my_rails_app/
Feature: Creating Users
In order to add new users to the system
As an admin
I want to be able to add them through the backend
Background: # features/creating_users.feature:6
Given there are the following users: # features/step_definitions/user_steps.rb:1
| email | password | admin |
| admin@ticketee.com | password | true |
And I am signed in as them # features/step_definitions/user_steps.rb:10
@webdevotion
webdevotion / BNRDocument.m
Created March 4, 2012 14:51
error handling
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError
{
todoItems = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListMutableContainers format:NULL error:outError];
BOOL errorFound = todoItems == nil;
if (errorFound)
{
NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
[userInfo setValue:@"Custom Error Description" forKey:NSLocalizedDescriptionKey];
@webdevotion
webdevotion / NFRSSChannel.m
Created March 11, 2012 06:34
A better way to trim titles and post link
-(void)trimItemTitles
{
for(NFRSSItem *rssItem in [self items])
{
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CHOP CHOP: let's get what we need from the raw posttitle
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// we want 3 pieces of info: category, posttitle and possible "reply by" or "author"
// split the string up on " :: " - array length might be 2 or 3, depending on presence of " :: Reply by"
@webdevotion
webdevotion / helper.rb
Last active April 8, 2018 01:56
markdown
module ApplicationHelper
def markdown(text, options = {} )
options = [
:hard_wrap => true,
:space_after_headers => true,
:filter_html => true,
:autolink => true,
:no_intraemphasis => true,
:fenced_code => true,
@webdevotion
webdevotion / button.mm
Last active April 8, 2018 01:56
rotation
[self.loadDataButton setBackgroundImage:[[UIImage imageNamed:@"big-button"] resizableImageWithCapInsets:UIEdgeInsetsMake(4.f, 4.f, 4.f, 4.f)]
forState:UIControlStateNormal];
[self.loadDataButton setBackgroundImage:[[UIImage imageNamed:@"big-button-highlighted"] resizableImageWithCapInsets:UIEdgeInsetsMake(4.f, 4.f, 4.f, 4.f)]
forState:UIControlStateHighlighted];
[self.loadDataButton setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
[self.loadDataButton setTitleColor:[UIColor blackColor] forState:UIControlStateHighlighted];