Skip to content

Instantly share code, notes, and snippets.

View joelturnbull's full-sized avatar

Joel Turnbull joelturnbull

View GitHub Profile
@joelturnbull
joelturnbull / sol.rb
Created February 23, 2024 20:45
1367 Linked Lists in Binary Tree
def is_sub_path(head, root)
console = []
is_sub_pathx(head,root,console)
end
def is_sub_pathx(head, root, c)
rslts = []
Fetching gem metadata from https://rubygems.org/.........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using activesupport-inflector (0.1.0)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/joelturnbull/Developer/.rbenv/versions/2.1.0/bin/ruby extconf.rb
creating Makefile
source 'https://rubygems.org'
gem 'pry', :git => 'git@github.com:pry/pry.git'
gem 'pry-rescue'
gem 'pry-doc'
#gem 'pry-debugger', :git => 'git@github.com:nixme/pry-debugger.git'
gem 'pry-stack_explorer'
gem 'rspec'
gem 'require_all'
gem 'activesupport-inflector'
gem 'i18n'
@joelturnbull
joelturnbull / gist:4635006
Last active December 11, 2015 17:29
Creating an instance of Party
// Creating an instance of Party
Party *party = [[Party alloc] init];
@joelturnbull
joelturnbull / gist:4634990
Last active December 11, 2015 17:29
Setting Party values using accessors after initialization
// Setting Party values using accessors after initialization
Party *party = [[Party alloc] init];
party.date = [NSDate date];
party.location = @"Unicorn Office";
party.attendees = @[@"Joel",@"Bill",@"Peter"];
@joelturnbull
joelturnbull / gist:4634985
Last active December 11, 2015 17:29
Calling a customer Party initializer
// Calling a customer Party initializer
Party *party = [[Party alloc] initWithLocation: @"Unicorn Office"];
@joelturnbull
joelturnbull / gist:4634977
Last active December 11, 2015 17:29
The Party initializers interface
// The Party initializers interface
#import <Foundation/Foundation.h>
@interface Party : NSObject
@property (nonatomic,strong) NSDate* date;
@property (nonatomic,strong) NSString* location;
@property (nonatomic,strong) NSArray* attendees;
@joelturnbull
joelturnbull / gist:4634948
Last active December 11, 2015 17:29
Implementation of Party initializers deferring to a Designated Initializer
// Implementation of Party initializers deferring to a Designated Initializer
#import "Party.h"
@implementation Party
-(Party*)initWithLocation:(NSString*)location {
return [self initWithLocation: location date:[self defaultDate] attendees:[self defaultAttendees]];
};
@joelturnbull
joelturnbull / 1.feature
Created September 11, 2012 13:44
snippets for cucumber regex article
When I click "Edit"
@joelturnbull
joelturnbull / generate_email_button_html.rb
Created July 9, 2012 03:54
Adding a Share by Email Button to Your Tumblr Posts
require 'open-uri'
def main
image_url = "https://s3.amazonaws.com/gaslight-blog/email_button.png"
subject = "{Title}"
body = <<-eos
Check out this article...
{Title} <{ShortURL}>
eos