Skip to content

Instantly share code, notes, and snippets.

@kleneway
kleneway / gist:3709815
Created September 12, 2012 20:50
My implementation of FPPickerController didFinishPickingMediaWithInfo
-(void)FPPickerController:(FPPickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
// first check for image from camera roll or camera
UIImage *image = [info objectForKey:@"FPPickerControllerOriginalImage"];
// if not found, check to see if the image has been downloaded
if(!image) {
NSData *localData = [NSData dataWithContentsOfURL:[info objectForKey:@"FPPickerControllerReferenceURL"]];
if(localData) {
image = [UIImage imageWithData:localData];
}
@kleneway
kleneway / gist:6171239
Created August 7, 2013 04:44
Animated Shadow on UICollectionViewCell
/**
* Code to add an animated shadow to a UICollectionViewCell
*/
//
// HAIMainMenuCollectionViewCell.m
// app-haikudeck
//
// Created by Kevin Leneway
@kleneway
kleneway / gist:6171311
Created August 7, 2013 04:58
UIPanGestureRecognizer for creating parallax effect on an image view with text view
- (IBAction)handlePanGesture:(UIPanGestureRecognizer*)gesture
{
CGPoint translation = [gesture translationInView:self.view];
if (gesture.state == UIGestureRecognizerStateChanged) {
// user is swiping, translate the view for the image by 1/4 the translation, and the text by 1/2 the translation to give parallax effect
self.currentSlide.imageView.frame = CGRectMake(self.currentSlide.imageView.frame.origin.x+translation.x/4,0,self.currentSlide.imageView.frame.size.width, self.currentSlide.imageView.frame.size.height);
self.currentSlide.slideText.view.frame = CGRectMake(self.currentSlide.slideText.view.frame.origin.x+translation.x/2,0,self.currentSlide.slideText.view.frame.size.width, self.currentSlide.slideText.view.frame.size.height);
// save the cumulative translation and reset the local translation
self.panTranslation += translation.x;
@kleneway
kleneway / gist:6171372
Created August 7, 2013 05:10
Using NSLinguisticTagger to stem Haiku Deck tags
// use the built-in ios linguistics functionality to stem the tags
+ (NSMutableArray *)stemTags:(NSMutableArray*)originalTags {
NSLinguisticTagger *tagger = [[NSLinguisticTagger alloc]
initWithTagSchemes:[NSArray arrayWithObjects:NSLinguisticTagSchemeLemma, nil]
options:(NSLinguisticTaggerOmitWhitespace | NSLinguisticTaggerOmitPunctuation)];
NSMutableArray *stemmedTags = [[NSMutableArray alloc] init];
// convert tags to string
[tagger setString:[originalTags componentsJoinedByString:@" "]];
@kleneway
kleneway / gist:6171650
Created August 7, 2013 06:14
Example of drawing a pie chart slice from Haiku Deck using Core Graphics
- (UIBezierPath*)slicePathForDataPoint:(DataPoint*)dataPoint forCompleted:(float)completed forTotal:(float)total {
if(!total) {
return nil;
}
float percentOfTotal = (completed+fabsf([dataPoint.number floatValue]))/total;
float percentCompleted = completed/total;
percentOfTotal *= self.animationScaleFactor;
percentCompleted *= self.animationScaleFactor;
"use strict";
const cors = require("cors");
const express = require("express");
const smartcar = require("smartcar");
const app = express().use(cors());
const port = 8000;
const client = new smartcar.AuthClient({
/*jshint esversion: 6 */
var axios = require("axios");
// FOR ASSISTS
const NAMES = [
"Devin Booker",
"Khris Middleton",
"Giannis Antetokounmpo",
"Jrue Holiday",
@kleneway
kleneway / prompt.js
Created February 18, 2023 17:43
Prompt Example
const inputTopic = "How to care for orchids";
const prompt = `
interface WritingMindMap {
topic: string;
l1: {
name: string;
l2: {
name: string;
details: string;
uniqueInsight?: string;
@kleneway
kleneway / gist:bdfbdd82d07ab80dadb9bcfb5c3a5fef
Created April 30, 2024 16:30
JACoB conversational prompt
Act as a remote junior software developer named Jacob who has been tasked with gathering requirements from a client to write up a new GitHub issue for the development team to implement. Jacob is a little bit quirky and funny, and he has a lot of respect and admiration for the client. This specific client is his favorite to work with, and he wants to make sure they have a great experience while also getting all the information needed for the GitHub issue write-up.
Your job is to have a very short, concise, friendly conversation with the client to elicit all the key details needed for the GitHub issue write-up. The issue write-up should allow another developer to fully understand the scope and requirements without needing any additional information.
Engage in the conversation using the following phases:
Phase 1: Introduction
Greet the client in a friendly manner. Explain that you will be asking them a series of questions to understand their requirements for a new software feature or bug fix. Let them know
import {
defineBehaviorModule,
defineTool,
createVdotMachine,
sendMessage,
Content,
} from "@pioneersquarelabs/vdot";
import { z } from "zod";
// Define the weather tool