Skip to content

Instantly share code, notes, and snippets.

View pontusab's full-sized avatar
🦁

Pontus Abrahamsson pontusab

🦁
View GitHub Profile
@pontusab
pontusab / upload.ts
Created October 25, 2023 19:49
upload.ts
import { SupabaseClient } from "@supabase/auth-helpers-nextjs";
type UploadParams = {
file: File;
path: string;
};
export async function upload(
client: SupabaseClient,
{ file, path }: UploadParams,
@pontusab
pontusab / component.tsx
Last active October 28, 2023 09:56
component.tsx
"use client";
import { useUpload } from "@/hooks/useUpload";
import { getSupabaseBrowserClient } from "@midday/supabase/browser-client";
import { useDropzone } from "react-dropzone";
export function Attachments({ id }) {
const supabase = getSupabaseBrowserClient();
const [files, setFiles] = useState<Attachment[]>([]);
const { isLoading, uploadFile } = useUpload();
// NOTE: Required for reuse of connection
import './utils/typeorm-monkeypatch'
import * as express from 'express'
import { ApolloServer } from 'apollo-server-express'
import { getConnectionManager, Connection } from 'typeorm'
import { PostgresDriver } from 'typeorm/driver/postgres/PostgresDriver'
import * as depthLimit from 'graphql-depth-limit'
import formatError from './utils/formatError'
import schema from './schema'
import { options} from './models'
// Client
import { setContext } from 'apollo-link-context'
export default setContext(async (_, { headers }) => ({
headers: {
...headers,
authorization: `Bearer ${localStorage.getItem('token')}`,
},
}))
@pontusab
pontusab / install.sh
Created February 5, 2014 11:10
Install Nginx 1.5.9 SPDY draft 3.1
#!/bin/sh
NGINX_VERSION=1.5.9
TMP_PATH=/tmp
# Fetch and extract nginx source
cd $TMP_PATH
wget http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz
tar xvfz nginx-$NGINX_VERSION.tar.gz
cd nginx-$NGINX_VERSION
@pontusab
pontusab / Bottlr
Created February 5, 2014 08:40
Bottlr - Project description
About 3 month ago, I discovered Vine (yeah late i know), but i really like the small video clips that made my day. But im a developer and most of the time im sitting in front of the computer so i begun to find a way to watch vines on the computer, but at that moment there where only some simple sites where you couldn't login and get your feed.
So i was thinking that maby i can do this by my own, and as a developer i took my iPhone and find all the endpoints for the API. Then a started to design, and this was my first real project that i designed. So i ended upp on dribbble and find inspiration and stated my jurny to build Bottlr.
And the result is bellow, the project is done but as you all know the fun part has just begun. I will rebuild and do it better on every free minute. There are many features that will be built in the near feature.
Hope you like it! And if you do please check the real thing out here https://bottlr.co
Description of technology:
Laravel Framework
@pontusab
pontusab / gist:8785556
Last active August 29, 2015 13:55
Get latest post on single post
<?php
// Get latest posts on single post
// Exclude current post
function GetLatestPosts( $number = 5 )
{
global $post;
$args = array(
'posts_per_page' => $number,
@pontusab
pontusab / gist:5930197
Created July 4, 2013 20:59
Control Google Maps Zoom by your own html thru jQuery.
$('.control a').click( function()
{
var currentZoom = map.getZoom();
if( $(this).text() == '+')
{
if( currentZoom < 4 )
{
var currentZoom = parseFloat( currentZoom ) + 1;
}
@pontusab
pontusab / Walker.php
Last active December 14, 2015 09:18
WordPress simple bootstrap-menu like this: http://twitter.github.com/bootstrap/components.html#navbar
<?php
/**
* Class Name: Bootstrap
* Author: Pontus Abrahamsson
*/
class Bootstrap extends Walker_Nav_Menu
{
function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 )