Skip to content

Instantly share code, notes, and snippets.

View jeremytregunna's full-sized avatar

Jeremy Tregunna jeremytregunna

View GitHub Profile
{"data":[{"id":4331,"state":"open","type":"DevelopmentProject","evaluation_begins_at":null,"evaluation_ends_at":null,"staff_evaluation_begins_at":null,"staff_evaluation_ends_at":null,"brief":false,"submission_begins_at":null,"submission_ends_at":null,"description":"In this project we'll be asking the community between different design directions for this product. Please review each of the three concepts, vote for your favorite, and leave commentary!","ends_at":"2018-12-10T16:41:20-05:00","title":"Design","product_id":127,"user_votes":1,"consideration_threshold":null,"product_stage_name":"product design","votes_left":0,"influence":3,"ideation_count":3,"influencer_count":0,"is_evergreen":false,"pricing_summary":null,"comparisons_created":null,"unanswered":null,"product":{"id":127,"name":"Silicone Zip Bag","tagline":"","price":{"cents":0,"currency":"USD"},"state":"development","description":"This silicone zip-bag offers a microwave and freezer safe eco-friendly alternative to disposable zip-lock bags. This reus

Let's replace Objective-C

I liked the enthusiasm that Ash Furrow posted on his blog today, but I have a hard time seeing it as an honest proposal for a starting point. Let's face it, we have compatibility issues that we need to address. So, what can we do?

Well even if we fully acknowledge that there are some things we can only reasonable do while we break the ABI, and we would like to see some forward looking, let's start to decide what kind of base level abstractions that we need irrespective of the language. This list is in no particular order:

  • Able to call into Objective-C & ASM, let's face it, we need it.
  • A partial reference tracking mechanism, maybe a full blown collector to handle cycles, if justifiable.
  • Type safety with inference
  • Constructs and flow control operations designed for the way we're writing code today, and in the future.

Keybase proof

I hereby claim:

  • I am jeremytregunna on github.
  • I am jer (https://keybase.io/jer) on keybase.
  • I have a public key whose fingerprint is CFCA AF14 0536 1974 F286 23B0 CCA4 08CE 1B8B 5682

To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am jeremytregunna on github.
  • I am jer (https://keybase.io/jer) on keybase.
  • I have a public key whose fingerprint is D6F1 035C 880E 74CF 819C D8B3 1A04 2D72 69D0 0255

To claim this, I am signing this object:

template<class X> using Maybe = std::unique_ptr<X>;
template<class X> Maybe<X> Just(const X& x)
{
return Maybe<X>( new X(x) );
}
template<class X> Maybe<X> Nothing()
{
return Maybe<X>(nullptr);
@implentation UserForm
- (SurveyTextField *)username
{
return SurveyDefineTextField(^(SurveyTextField *field) {
field.placeholder = @"username";
});
}
// OR
{"data":[{"id":752,"state":"sales","description":"<p>Aros learns from your budget, location, schedule, and usage to automatically maintain the perfect temperature and maximize savings for your home. What's more, it can be controlled from anywhere using the Wink app on your mobile device.<\/p>","category":"electronics","discounted_price":{"cents":30000,"currency":"USD","bank":{"rates":{},"mutex":{}}},"average_rating":3.69231,"units_sold":496,"price":{"cents":30000,"currency":"USD","bank":{"rates":{},"mutex":{}}},"attachments":[{"id":600044,"mid":"https:\/\/s3.amazonaws.com\/kore\/production\/attachments\/assets\/600044\/mid\/AROS_Quirky_03-17-13_Side_AC_B-2.jpg?1395254751","three20":"https:\/\/s3.amazonaws.com\/kore\/production\/attachments\/assets\/600044\/three20\/AROS_Quirky_03-17-13_Side_AC_B-2.jpg?1395254751","thumb":"https:\/\/s3.amazonaws.com\/kore\/production\/attachments\/assets\/600044\/thumb\/AROS_Quirky_03-17-13_Side_AC_B-2.jpg?1395254751","parent_id":752,"four65":"https:\/\/s3.amazonaws.com\/kore\
// Notification name as a constant, keep things clean. You'll see why this is needed soon.
static NSString* const MyStopNotificationName = @"MyStopNotificationName";
// Somewhere in your code you've got a button...
[self.someButton addTarget:self action:@selector(startConnection) forControlEvents:UIControlEventTouchUpInside];
// Somewhere else you have this method implemented
- (void)startConnection
{
self.someButton.enabled = NO;
# Heavy State Sync
require 'faye/websocket'
require 'json'
class HeavyStateSync
KEEPALIVE_INTERVAL = 15
def initialize(app)
@app = app
public enum Either<A, B> {
case Left(@autoclosure () -> A)
case Right(@autoclosure () -> B)
}