Skip to content

Instantly share code, notes, and snippets.

View rossmartin's full-sized avatar

Ross Martin rossmartin

View GitHub Profile
@rossmartin
rossmartin / reviews.ts
Created May 5, 2023 20:15
Server side handler for ios app store review scraper that does analysis on them with chatgpt
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import { NextApiRequest, NextApiResponse } from 'next';
import { getReviews } from 'app-store-scraper-reviews';
import { Configuration, OpenAIApi } from 'openai';
const configuration = new Configuration({
apiKey: process.env.OPENAI_API_KEY,
});
const openai = new OpenAIApi(configuration);
@rossmartin
rossmartin / profile.ts
Last active January 13, 2023 18:27
Profile completion
enum ProfileSteps {
EmailVerification = 'emailVerification',
Employment = 'employment',
Education = 'education',
Licenses = 'licenses',
Certifications = 'certifications',
References = 'references',
SkillsChecklist = 'skillsChecklist',
BackgroundQuestions = 'backgroundQuestions',
PersonalInfo = 'personalInfo',
var dropbox = (function() {
var pluginName = "DropboxSync",
exec = cordova.require("cordova/exec"),
me = {};
me.link = function() {
var deferred = $.Deferred();
exec(
function(result) {
package com.rossmartin.dropbox;
import org.apache.cordova.*;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
@rossmartin
rossmartin / phonegap-dropbox-sync AppMainActivity
Last active December 21, 2015 13:49
phonegap-dropbox-sync AppMainActivity
package com.rossmartin.dropbox;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import org.apache.cordova.*;
public class PhoneGapSync extends CordovaActivity
@rossmartin
rossmartin / dropbox.js
Created April 24, 2013 00:25
JavaScript function that is called from Objective-C to show content of a file from Dropbox as soon as it has downloaded to the file system.
function showFileContents(file){
console.log("showFileContents()");
console.log(file);
}
@rossmartin
rossmartin / return.m
Last active December 16, 2015 14:28
Return file contents to JavaScript from Objective-C
- (void) restClient:(DBRestClient*)client loadedFile:(NSString*)localPath {
NSLog(@"File loaded into path: %@", localPath);
NSData *fileData;
fileData = [NSData dataWithContentsOfFile:localPath];
if (!fileData){
NSLog(@"Error - File not found");
}
NSString* fileString = [[NSString alloc] initWithData:fileData encoding:NSUTF8StringEncoding];
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
// you can set this fix in DOM ready or jQM's mobileinit
// DOM ready
$(function(){
$.event.special.swipe.scrollSupressionThreshold = 100;
});
// jQM defaults
$(document).bind("mobileinit", function(){
$.event.special.swipe.scrollSupressionThreshold = 100;
@rossmartin
rossmartin / PG-WebSQL.js
Last active December 11, 2015 19:48
Web SQL - Combine two SELECT statements with a LIMIT using UNION
for (var i = 0; i < testResults.length; i++){
(function(i){
db.transaction(function(tx){
tx.executeSql(
"SELECT * FROM ( " +
"SELECT 'lab' AS table_name, id FROM lab_test_names " +
"WHERE organizerClassId = ? " +
"LIMIT 1 " +
" ) " +
"UNION " +
@rossmartin
rossmartin / WebSQL UNION with LIMITs
Created January 27, 2013 20:19
Web SQL UNION with multiple LIMITs
SELECT * FROM (
SELECT 'lab' AS table_name, id FROM table1
WHERE organizerClassId = '4013-5' LIMIT 1)
UNION
SELECT * FROM (
SELECT 'rad' AS table_name, id FROM table2
WHERE organizerClassId = '4013-5' LIMIT 1);