Skip to content

Instantly share code, notes, and snippets.

View raae's full-sized avatar
💭
I may be slow to respond.

Benedicte Raae raae

💭
I may be slow to respond.
View GitHub Profile
@raae
raae / exchange-jwt.ts
Last active April 8, 2024 12:40
Supabase Edge Function to exchange an Outseta-signed JWT with a Supabase-signed JWT
// Deploy as a Supabase function with --no-verify-jwt
// as we are providing an Outseta token, not a Supabase token
// command: supabase functions deploy exchange --no-verify-jwt
import * as jose from "https://deno.land/x/jose@v4.14.4/index.ts";
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers":
"authorization, x-client-info, apikey, content-type",
// Replace const stripe .... with the snippet below.
const [stripe, setStripe] = useState()
useEffect(() => {
setStripe(window.Stripe(STRIPE_KEY))
}, [])
@raae
raae / vue-lazy-load.vue
Last active September 1, 2017 15:02
Super simple vue snippet for lazy loading images
<template>
<transition name="fade">
<img v-if="imageSrc" :src="imageSrc" />
</transition>
</template>
<script>
export default {
props: [
@raae
raae / acf-rest-api-example.php
Last active July 8, 2016 12:10
ACF field in WP RSS feed
add_filter( 'rest_api_allowed_public_metadata', 'allow_my_metadata' );
function allow_my_metadata() {
$allowed_meta_keys[] = 'audio_url';
$allowed_meta_keys[] = 'start_station';
$allowed_meta_keys[] = 'end_station';
return $allowed_meta_keys;
}
@raae
raae / update.sql
Last active August 29, 2015 14:23
SQL updates when base url change in Wordpress
/* Do for each site */
/* x is site number, for site 1 omit "_x" */
UPDATE `wp_x_options` SET `option_value` = REPLACE(option_value, "old_domain", "new_domain");
UPDATE `wp_x_comments` SET `comment_author_url` = REPLACE(comment_author_url, "old_domain", "new_domain");
UPDATE `wp_x_postmeta` SET `meta_value` = REPLACE(meta_value, "old_domain", "new_domain");
UPDATE `wp_x_posts` SET `post_content` = REPLACE(post_content, "old_domain", "new_domain");
@raae
raae / main.js
Last active August 29, 2015 13:59
Moment Timzone Support in Parse.com Cloud
// Read full blogpost explaining this at http://labs.lillyapps.no/2014/04/12/handle-timezones-parse-com
var moment = require('cloud/moment-timezone.js');
moment.tz.add(require('cloud/moment-timezone-data.js'));
Parse.Cloud.define("momentTest", function (request, response)
{
var osloSummerTime = moment.tz('2014-04-12 11:55', 'Europe/Oslo');
var osloWinterTime = moment.tz('2013-11-18 11:55', 'Europe/Oslo');
@raae
raae / NorwayMapUtility.h
Last active December 30, 2015 06:49
A simple utility class creating MKCoordinateRegions containg Norway
#import <MapKit/MapKit.h>
@interface NorwayMapUtility : NSObject
+ (MKCoordinateRegion) regionContainingTheKingdomOfNorway;
+ (MKCoordinateRegion) regionContainingMainlandNorway;
+ (MKCoordinateRegion) regionContainingMainlandNorwayWithIslands;
@end