Skip to content

Instantly share code, notes, and snippets.

View jensellfors's full-sized avatar

Jens Ellfors jensellfors

  • London
View GitHub Profile
@jensellfors
jensellfors / gist:5721994
Last active December 18, 2015 03:58
A simple way to profile execution time of a code snippet.
static CFAbsoluteTime JAProfilingBlock (void (^block)(void)) {
CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
block ();
CFAbsoluteTime end = CFAbsoluteTimeGetCurrent();
return end - start;
}
#example usage
@jensellfors
jensellfors / JAConcat.m
Created January 5, 2014 20:24
String concatenation in Objective-C, using one line of code. Takes a list of NSObject and concatenates their description.
#define $(...) ((NSString *)[[NSArray arrayWithObjects:__VA_ARGS__, nil] componentsJoinedByString:@""])
/*
* Example
*/
NSString *string = $(@"Hello", @" ", @"World!", @"\n", @"1 + 2 = ", @(1+2));
@jensellfors
jensellfors / JHAVerticalTextView.h
Last active December 29, 2015 01:30
Simple UITextView subclass for vertically aligning text in middle.
//
// JHAVerticalTextView.h
// Quotes background
//
// Created by Jens Andersson on 23/02/14.
// Copyright (c) 2014 Jens Andersson. All rights reserved.
//
#import <UIKit/UIKit.h>
@jensellfors
jensellfors / cloudSettings
Created March 7, 2018 14:03
Visual Studio Code Settings Sync Gist
{"lastUpload":"2018-03-07T14:02:41.170Z","extensionVersion":"v2.9.0"}
@jensellfors
jensellfors / update-diff.ts
Created February 28, 2020 10:50
React componentDidUpdate diff
console.log('Rrow update diff:');
console.log('++++++++++++++++++++');
console.log('++++++++++++++++++++');
const now = Object.entries(this.props);
const added = now.filter(([key, val]) => {
if (prevProps[key] === undefined && val !== undefined) return true;
if (!isEqual(prevProps[key], val)) {
console.log(`${key}
- ${JSON.stringify(prevProps[key])}
@jensellfors
jensellfors / [email protected]
Created February 23, 2023 10:23
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.17+commit.8df45f5f.js&optimize=true&runs=200&gist=
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
/**
* @dev String operations.
*/

Internal AI Storybook Generator Prototype

Please Note: This is purely an evaluation exercise. We will not be using the code you produce directly in our production systems. We are interested in your thought process, architectural choices, and how you strategically leverage AI as a development partner to build efficiently and effectively.

Company Context:

Giant is building AI-powered apps and content for kids, starting with storybooks. We heavily leverage AI not only in our products but also integrate it deeply into our development workflows to accelerate innovation.

Purpose of this Test: